www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Dee-sign patterns.

reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
After using D for quite a while I've developed some minor design
patterns and code style suggestions, that could be useful.
I wanted to post them somewhere on the internet, but then i thought,
that the best place to put D-related useful information is on the
official webpage itself.
So i ask you guys, do you think it would be a good idea to create a
section on http://www.d-programming.language.com/, devoted to design
patterns, guidelines, best practice advices and similar stuff?
If so, I'd like you to post your experience to that section, so there
will be a big and reliable source of help on how to program on D on
it's official site.

Example of a coding pattern:

If you have a class or struct, that has a lookup function by string
identifier, consider using opDispatch to add a very convenient syntax
sugar to your class or struct. And if the lookup term can be run-time
defined, make an opIndex for that, write the implementation in opIndex
and forward the call from opDispatch to opIndex, possibly doing
caching, knowing, that the search term is compile-time defined.

Cheers,
Gor.
Sep 27 2011
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 9/27/2011 8:57 AM, Gor Gyolchanyan wrote:
 So i ask you guys, do you think it would be a good idea to create a
 section on http://www.d-programming.language.com/, devoted to design
 patterns, guidelines, best practice advices and similar stuff?
The D wiki is the perfect place: http://prowiki.org/wiki4d/wiki.cgi?FrontPage
Sep 27 2011
parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
So i will. :-)
That wiki looks like it hasn't been refreshed for a long time now.

On Wed, Sep 28, 2011 at 12:39 AM, Walter Bright
<newshound2 digitalmars.com> wrote:
 On 9/27/2011 8:57 AM, Gor Gyolchanyan wrote:
 So i ask you guys, do you think it would be a good idea to create a
 section on http://www.d-programming.language.com/, devoted to design
 patterns, guidelines, best practice advices and similar stuff?
The D wiki is the perfect place: http://prowiki.org/wiki4d/wiki.cgi?FrontPage
Sep 28 2011