Different ways of solving problems in code.

Posted by Erin on Programmers See other posts from Programmers or by Erin
Published on 2011-03-03T15:27:40Z Indexed on 2011/03/04 7:32 UTC
Read the original article Hit count: 305

Filed under:

I now program in C# for a living but before that I programmed in python for 5 years. I have found that I write C# very differently than most examples I see on the web. Rather then writing things like:

foreach (string bar in foo)
{
    //bar has something doen to it here
}

I write code that looks like this.

foo.ForEach( c => c.someActionhere() )

Or

var result = foo.Select( c =>
                {
                    //Some code here to transform the item.
                }).ToList();

I think my using code like above came from my love of map and reduce in python - while not exactly the same thing, the concepts are close.

Now it's time for my question. What concepts do you take and move with you from language to language; that allow you to solve a problem in a way that is not the normal accepted solution in that language?

© Programmers or respective owner

Related posts about programming-languages