www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - More Illuminating Introductory Code Example on dlang.org

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Wednesday 19:th of Februari I'm giving my first talk on D for 
my fellow collegues at my consultant firm office HiQ, Linköping, 
Sweden.

If any of you are in the neighbourhood please let me know and I 
will invite you. The lecture will most likely be held in Swedish.

I'll try to make my best to convince them that D is the way to go 
for the future of programming.

On my strive I have one wish to the maintainers of dlang.org:

I believe the first code example a newbie sees when he/she first 
visits dlang.org should be some variation of Walter's showcase on 
Component Programming including all the bells and whistles of 
lazy evaluted ranges.

IMHO, this would increase the probability of the newbie staying a 
bit further on the site trying to figure out the details of what 
make this intriguing D code example tick. And, as a result, be 
more convinced about D's unique and powerful features.

What do you think, fellow D programmers?
Feb 12 2014
next sibling parent reply "Tove" <tove fransson.se> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 I believe the first code example a newbie sees when he/she 
 first visits dlang.org should be some variation of Walter's 
 showcase on Component Programming including all the bells and 
 whistles of lazy evaluted ranges.

 IMHO, this would increase the probability of the newbie staying 
 a bit further on the site trying to figure out the details of 
 what make this intriguing D code example tick. And, as a 
 result, be more convinced about D's unique and powerful 
 features.

 What do you think, fellow D programmers?

Absolutely and there is a process in place for this already, feel free to suggest something: "[your code here] Got a brief example illustrating D? Submit your code to the digitalmars.D forum specifying "[your code here]" in the title. Upon approval it will be showcased on a random schedule on D's homepage."
Feb 12 2014
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/14, 1:09 PM, Brad Anderson wrote:
 On Wednesday, 12 February 2014 at 20:54:28 UTC, Tove wrote:
 Absolutely and there is a process in place for this already, feel free
 to suggest something:

 "[your code here] Got a brief example illustrating D? Submit your code
 to the digitalmars.D forum specifying "[your code here]" in the title.
 Upon approval it will be showcased on a random schedule on D's homepage."

That's actually never happened even though people have shared stuff they'd like to appear there. The problem, I believe, is that there is no code in place to actually do the rotation of the showcase. Adding showcase rotation would be a nice little project for someone interested in contributing and who knows javascript (PHP is also an option as the server supports that).

A pull request for code rotation in PHP would be great. Andrei
Feb 12 2014
prev sibling next sibling parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Wednesday, 12 February 2014 at 20:54:28 UTC, Tove wrote:
 "[your code here] Got a brief example illustrating D? Submit 
 your code to the digitalmars.D forum specifying "[your code 
 here]" in the title. Upon approval it will be showcased on a 
 random schedule on D's homepage."

I'd probably write some examples if this process somehow used Github like everything else. Maybe a dlang.org/snippets sub-directory that the web server randomly chooses a snippet from now that the web server runs PHP...
Feb 12 2014
prev sibling next sibling parent "Brad Anderson" <eco gnuk.net> writes:
On Wednesday, 12 February 2014 at 20:54:28 UTC, Tove wrote:
 Absolutely and there is a process in place for this already, 
 feel free to suggest something:

 "[your code here] Got a brief example illustrating D? Submit 
 your code to the digitalmars.D forum specifying "[your code 
 here]" in the title. Upon approval it will be showcased on a 
 random schedule on D's homepage."

That's actually never happened even though people have shared stuff they'd like to appear there. The problem, I believe, is that there is no code in place to actually do the rotation of the showcase. Adding showcase rotation would be a nice little project for someone interested in contributing and who knows javascript (PHP is also an option as the server supports that).
Feb 12 2014
prev sibling next sibling parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Wednesday, 12 February 2014 at 21:09:20 UTC, Brad Anderson 
wrote:
 Adding showcase rotation would be a nice little project for 
 someone interested in  contributing and who knows javascript 
 (PHP is also an option as the server supports that).

I think server-side scripting is the preferable solution here.
Feb 12 2014
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/14, 12:49 PM, "Nordlöw" wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D for my
 fellow collegues at my consultant firm office HiQ, Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and I will
 invite you. The lecture will most likely be held in Swedish.

Congratulations and good luck!
 I'll try to make my best to convince them that D is the way to go for
 the future of programming.

 On my strive I have one wish to the maintainers of dlang.org:

 I believe the first code example a newbie sees when he/she first visits
 dlang.org should be some variation of Walter's showcase on Component
 Programming including all the bells and whistles of lazy evaluted ranges.

 IMHO, this would increase the probability of the newbie staying a bit
 further on the site trying to figure out the details of what make this
 intriguing D code example tick. And, as a result, be more convinced
 about D's unique and powerful features.

 What do you think, fellow D programmers?

Great idea. I think code samples on the homepage are due for some improvements. Andrei
Feb 12 2014
prev sibling next sibling parent "Mike" <none none.com> writes:
On Wednesday, 12 February 2014 at 21:19:55 UTC, Andrei 
Alexandrescu wrote:
 Great idea. I think code samples on the homepage are due for 
 some improvements.

I think visible code samples on the homepage are a good idea, bot please make them links to the wiki. A lot of sample code on the homepage was created a long time ago and not maintained as the language has evolved. Putting it on the wiki would hopefully elicit more community involvement in maintaining it. Mike
Feb 12 2014
prev sibling next sibling parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Wednesday, 12 February 2014 at 21:34:08 UTC, Mike wrote:
 On Wednesday, 12 February 2014 at 21:19:55 UTC, Andrei 
 Alexandrescu wrote:
 Great idea. I think code samples on the homepage are due for 
 some improvements.

I think visible code samples on the homepage are a good idea, bot please make them links to the wiki. A lot of sample code on the homepage was created a long time ago and not maintained as the language has evolved. Putting it on the wiki would hopefully elicit more community involvement in maintaining it. Mike

If the snippets end up as D source code files in a sub-directory, we have the option of automatically guaranteeing that they are state of the art.
Feb 12 2014
prev sibling next sibling parent "Mike" <none none.com> writes:
On Wednesday, 12 February 2014 at 21:39:45 UTC, Jakob Ovrum wrote:
 I think visible code samples on the homepage are a good idea, 
 bot please make them links to the wiki.  A lot of sample code 
 on the homepage was created a long time ago and not maintained 
 as the language has evolved. Putting it on the wiki would 
 hopefully elicit more community involvement in maintaining it.

 Mike

If the snippets end up as D source code files in a sub-directory, we have the option of automatically guaranteeing that they are state of the art.

Cool, put pull requests to dlang.org aren't published immediately. They seem to only get published with each DMD release. If you can get around that, that'd be great.
Feb 12 2014
prev sibling next sibling parent "Mike Parker" <aldacron gmail.com> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 I believe the first code example a newbie sees when he/she 
 first visits dlang.org should be some variation of Walter's 
 showcase on Component Programming including all the bells and 
 whistles of lazy evaluted ranges.

 IMHO, this would increase the probability of the newbie staying 
 a bit further on the site trying to figure out the details of 
 what make this intriguing D code example tick. And, as a 
 result, be more convinced about D's unique and powerful 
 features.

 What do you think, fellow D programmers?

I disagree. If that had been my first look at D, I would have run away and never looked back. That style of code looks like a foreign language to anyone who's not used to it, implying a steep learning curve. Some people might be intrigued enough to dig into it, but anyone looking to just get stuff done isn't going to bother. Alongside an imperative-style snippet, it's fine. I think it's great to show that D supports both styles. I'd suggest actually showing two ways to do the same task, one in imperative style and one using the range pipeline.
Feb 12 2014
prev sibling next sibling parent "ixid" <nuaccount gmail.com> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and I 
 will invite you. The lecture will most likely be held in 
 Swedish.

 I'll try to make my best to convince them that D is the way to 
 go for the future of programming.

 On my strive I have one wish to the maintainers of dlang.org:

 I believe the first code example a newbie sees when he/she 
 first visits dlang.org should be some variation of Walter's 
 showcase on Component Programming including all the bells and 
 whistles of lazy evaluted ranges.

 IMHO, this would increase the probability of the newbie staying 
 a bit further on the site trying to figure out the details of 
 what make this intriguing D code example tick. And, as a 
 result, be more convinced about D's unique and powerful 
 features.

 What do you think, fellow D programmers?

Be wary as one of Walter's examples is buggy. If someone has the link I will point it out.
Feb 13 2014
prev sibling next sibling parent "JR" <zorael gmail.com> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and I 
 will invite you. The lecture will most likely be held in 
 Swedish.

Were it in Luleå I would have loved to attend, but Linköping is way away. :<
Feb 13 2014
prev sibling next sibling parent "simendsjo" <simendsjo gmail.com> writes:
On Thursday, 13 February 2014 at 09:21:15 UTC, JR wrote:
 On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and 
 I will invite you. The lecture will most likely be held in 
 Swedish.

Were it in Luleå I would have loved to attend, but Linköping is way away. :<

Yeah, too bad all these events are in Stockholm and Linköping. Hoping for some events in Gothenburg or somewhere else closer to Oslo.
Feb 13 2014
prev sibling next sibling parent "Tofu Ninja" <emmons0 purdue.edu> writes:
On Thursday, 13 February 2014 at 04:30:26 UTC, Mike Parker wrote:
 On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 I believe the first code example a newbie sees when he/she 
 first visits dlang.org should be some variation of Walter's 
 showcase on Component Programming including all the bells and 
 whistles of lazy evaluted ranges.

 IMHO, this would increase the probability of the newbie 
 staying a bit further on the site trying to figure out the 
 details of what make this intriguing D code example tick. And, 
 as a result, be more convinced about D's unique and powerful 
 features.

 What do you think, fellow D programmers?

I disagree. If that had been my first look at D, I would have run away and never looked back. That style of code looks like a foreign language to anyone who's not used to it, implying a steep learning curve. Some people might be intrigued enough to dig into it, but anyone looking to just get stuff done isn't going to bother. Alongside an imperative-style snippet, it's fine. I think it's great to show that D supports both styles. I'd suggest actually showing two ways to do the same task, one in imperative style and one using the range pipeline.

I have to agree with this, if the first thing I saw when I came here was ranges I would have left a long time ago. I think most people who find themselves looking at D went looking for C++ like language with a cleaner syntax, so I think examples that illustrate that would be better for a front page kind of thing.
Feb 13 2014
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and I 
 will invite you. The lecture will most likely be held in 
 Swedish.

 I'll try to make my best to convince them that D is the way to 
 go for the future of programming.

 On my strive I have one wish to the maintainers of dlang.org:

 I believe the first code example a newbie sees when he/she 
 first visits dlang.org should be some variation of Walter's 
 showcase on Component Programming including all the bells and 
 whistles of lazy evaluted ranges.

 IMHO, this would increase the probability of the newbie staying 
 a bit further on the site trying to figure out the details of 
 what make this intriguing D code example tick. And, as a 
 result, be more convinced about D's unique and powerful 
 features.

 What do you think, fellow D programmers?

Ranges need definitely more examples, starting with the simplest use cases going on to more advanced stuff (how to apply filters, random access ranges). Especially the do's and donts (e.g. don't put anything in popFront()), how to write a range properly, the pitfalls, and maybe when not to use ranges. A lot of this "good practices" stuff is missing for D. Often I find an example of "good practice" randomly in a thread on this forum. But not on the start page, that would be a bit OTT, wouldn't it?
Feb 13 2014
prev sibling next sibling parent "NVolcz" <volcz kth.se> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and I 
 will invite you. The lecture will most likely be held in 
 Swedish.

I couldn't make it. How did it go?
Feb 21 2014
prev sibling next sibling parent "Francesco Cattoglio" <francesco.cattoglio gmail.com> writes:
On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 What do you think, fellow D programmers?

We could try to produce some simple ascii art :D
Feb 21 2014
prev sibling next sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Friday, 21 February 2014 at 16:06:04 UTC, NVolcz wrote:
 On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and 
 I will invite you. The lecture will most likely be held in 
 Swedish.

I couldn't make it. How did it go?

It went great! At least four of them said they will start hacking D as soon as they get the time. I will be holding more lectures in Linköping if I get the chance. Here's a reference to my lecture notes: https://drive.google.com/file/d/0BySO22MoUSXDZlBsVzllX1hsWjg/edit?usp=sharing Please correct anything if you get the chance. There's also the Facebook group "Software Craftsmanship Group Linköping" you could follow at https://www.facebook.com/groups/493309790788180/ /Per
Feb 21 2014
prev sibling next sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Friday, 21 February 2014 at 16:06:04 UTC, NVolcz wrote:
 On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and 
 I will invite you. The lecture will most likely be held in 
 Swedish.

I couldn't make it. How did it go?

How are you by the way? Do you live in Sweden? /Per
Feb 21 2014
prev sibling next sibling parent "NVolcz" <volcz kth.se> writes:
On Friday, 21 February 2014 at 21:22:48 UTC, Nordlöw wrote:
 On Friday, 21 February 2014 at 16:06:04 UTC, NVolcz wrote:
 On Wednesday, 12 February 2014 at 20:49:54 UTC, Nordlöw wrote:
 On Wednesday 19:th of Februari I'm giving my first talk on D 
 for my fellow collegues at my consultant firm office HiQ, 
 Linköping, Sweden.

 If any of you are in the neighbourhood please let me know and 
 I will invite you. The lecture will most likely be held in 
 Swedish.

I couldn't make it. How did it go?

How are you by the way? Do you live in Sweden? /Per

I live in Stockholm. We actually had a meetup group for D coders here in Stockholm last year. It was disbanded due to lack of interest. I was planning on going to your talk but some stuff got in the way. Are you on G+? //Niklas
Feb 25 2014
prev sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
 Are you on G+?


 //Niklas

Yep, I'm here: https://plus.google.com/+PerNordl%C3%B6wy/posts
Feb 25 2014