Tuesday, August 20, 2013

KASKUS Programmer forum gathering on 18th August 2013

Hi all!

Now I got invited by Kaskus programmer forum participants to meet at gathering session at FX Plaza on 18th August, 2013. In this gathering, there were more audiences than previous gathering.

For those wondering what Kaskus is, Kaskus is simply a free social gathering of those that has the same interest. It is generally more relaxed as there’s no organizational chapter whatsoever. It has governed by nobody but the forum is strictly moderated.

My main focus at Kaskus is the Programmer forum, and we usually have gathering for every 6 months.

I got the chance to demo what is lazy evaluation in C#/VB and the proof of the magic behind it.

Lazy evaluation in form of yield iterator in C# and VB (although VB has it since Visual Studio 2012). Using yield will make the code that use the iterator will be executed later, rather than immediately. This can be regarded as on demand but yield has more machinery. It can be seen as having a state machine to keep the state that it will run only as needed, especially when it comes to iterate an IEnumerable.

This is the code in Visual Studio 2010:

csharp_select_yield_thumb_5931E421

Just put the breakpoint at the line in the foreach in the Main method and run it.

csharp_yield_breakpoint_thumb_35B53FBC

At first breakpoint, the code Select above it is not yet executed. After going stepping to “in” before procnames, then the Select method above will be executed.

You, my dear reader, might wonder what select is. Select comes interpreted from an extension method of Select (look at this keyword).

csharp_extensionmethod_thumb_5FA51817

The code above is basically also a demo of how we can implement our own Select as select in LINQ to object. In fact, I have no reference on System.Linq at all!

By the way, the untranslated code of calling Select is:

csharp_translated_select_thumb_3FD5D8CF

Now I can argue that using LINQ is better, isn’t it?

Not just .NET, we were also having discussion on Java, PHP, and many things about programming as well.

Who are those attending this gathering?

Before that, here’s the picture of all attendances:

kopdar_kaskus_forumprogramer_thumb_6FF06A03

For more information on all of the gathering, please visit this thread on KASKUS forum programmers: http://www.kaskus.co.id/thread/51fb2a208327cfde1400000a/kopdar-programmer/

Thanks to Felix (cpuclear2) and Habib (bluething) for the pictures!