Showing posts with label teaching. Show all posts
Showing posts with label teaching. Show all posts

Monday, March 3, 2014

A good developer should be both wise and lazy?

How I miss a good software dev... Really I miss him/her.
But I do have a list traits of a good one! Basically comes into two things: lazy and wise.
Lazy in a sense that he/she is so lazy to code from beginning without planning and reuse.
So, he/she should have these traits when being asked for questions or to do a task:

Ask the wise candidate about the solution of any recurring problems in code reuse, he shall answer with design pattern without too many theoretical mumbo jumbo.
Ask the wise candidate about how to differentiate and choose the best approach to solve a problem in a pressing business process, he shall answer with the best hammer for specific nail.
Ask the wise candidate about how to choose between platform to solve pressing enterprise needs instead of choosing programming language, he shall answer the reason with impeccable reasoning instead of burying our heads with fanatic programming language choice.
Ask the wise candidate about how to solve his past problems in his past works, he shall answer with impeccable reasoning and his answer will show that he can learn from the past, not simply having only one solution for all, and also this show that he can grow and willingness to grow and improve.
Ask the wise candidate about how to solve big problem or develop big application in pressing matter and time without no reason, and he will not have enough time to think the best solution, and you'll lose this wise candidate. Because the question will deny his laziness and his proper planning, thinking, and problem solving.

Mind you, this developer has thought beyond any programming languages, so the hell with C++,C#, Java, VB, or even my main language, F#.
He shall continue focusing on platform choice, instead of minding and burying with language programming choice.Time comes to choose whether Java or .NET, and there's no time to choose whether Java, Ruby, C#, C++, VB.

He shall continue to be lazy by reusing existing components, diminishing any adhoc tasks while continue to preach planning and problem solving in elegant manner... Gone are the religions of programming languages.

As I said, this is my personal rant. The quote above is from myself. I really miss him/her, and I won't tell you who he/she is.
I have no intention to insult or harm anyone else. I welcome suggestions, though.

Wednesday, January 8, 2014

TEACHING: Study club of MUGI Jadetabek on Developer Track, WEEK 5

Now, it’s week 5! We could not have the workshop within the next week of week 3 because of my busy schedule, sorry!

In this week 5, we decided again to meet at QQ Kopitiam, at Pacific Place at 10:00AM. This scheduled time was agreed upon us by communicating via email before. Unfortunately Wakhid has to take care of his administrative undergraduate submission paperworks so he couldn't attend this week. And Aris also can’t attend this for personal reason. Next time, please be punctual, guys!

Yup, the show must go! Sorry to leave you if you weren’t present, guys! It’s fortunate for Reza and Siti Smile

Now we already have grabbed the basic concept of generics and colections, now we are moving to LINQ concept but with the introduction of advanced Lambda expression.

Why do we have to know Lambda? Because the answer is quite simple but somehow often missed in many LINQ literature: LINQ is composed by anonymous delegate. This anonymous delegate is often written in functional syntax as Lambda, to emphasize that expressiveness of an anonymous function is available to use and to compose nicely.

Let’s revisit the basic sample of SELECT in LINQ to Object:

using System.Diagnostics;
using System.Linq;

namespace SampleAdvancedLambda
{
    class Program
    {
        static void Main(string[] args)
        {
            var processnames = (from p in Process.GetProcesses()
                                select p.ProcessName).ToList();
        }
    }
}

The code above (in bold) is basically the same as:

var processnames = Process.GetProcesses()
    .Select(p => p.ProcessName).ToList();

 

Again, type inference will infer that processnames is a List of String, the type syntax is List<String>. Type inference happens nicely because the select will infer the property of ProcessName, and this property is typed String.

The notation of “=>” in the Select method is a form of denoting Lambda Expression. Although this is a syntactic sugar, it’s quite powerful syntax to replace tedious one line anonymous delegate.

But, what happened inside a select? Basically this is a select method body: (it has to be inside of a static class)

public static class QueryHelper
{
    public static IEnumerable<U> Select<T,U>(this IEnumerable<T> data, Func<T,U> selector)
    {
        foreach (var item in data)
        {
            yield return selector(item);
        }
    }
}

If you look at the signature, there’s “this” keyword to identify that this is an extension method of IEnumerable<T> (the first parameter).

Looks like they were having a little bit difficulties to grab this concept, here are their expression: Smile

WEEK5_01

 

I also gave them some sample cases, like constructing your own ForEach and ForNext (For Each with index) as Lambda.

And Abdullah is joining force to dive this concept!

WEEK5_02

 

Fortunately, they began to see the light that Lambda Expression is not that hard!

WEEK5_03


Further references:

  1. C# Extension method reference in Visual Studio 2010: http://msdn.microsoft.com/en-us/library/bb383977(v=vs.100).aspx
  2. C# Lambda Expression in Visual Studio 2010: http://msdn.microsoft.com/en-us/library/bb397687(v=vs.100).aspx

Tuesday, December 10, 2013

TEACHING: Study club of MUGI Jadetabek on Developer Track, WEEK 4

Now, it’s week 4! We could not have the workshop within the next week of week 3 because of my busy schedule, sorry!

Also in the week 4, we decided to meet at QQ Kopitiam, at Pacific Place at 9:30 because I had something to do first in the morning. Not just my schedule, but the study club will need to adjust with the participants. Therefore this week 4 was commenced on 7th December, 2013.

To my surprise, the attendance were few: Wakhid and Aris weren’t present. But Wakhid was able to tell me that he’s still minding his final paper assignment.

Ok, the show must go! Sorry to leave you if you weren’t present, guys!

This week I reviewed the knowledge of basic generic and collection. To my surprise, not all of them understood and grabbed the full concept of last week.

WP_000182_thumb_5D41B33E

The assignment was to create a simple implementation of LINQ’s WHERE and also implement ICollection<T>, so I decided to repeat the explanation on how generic works.

Basically we can consider generic type as parameterized type or type as parameter. So, if we declare ICollection<T>, we could use and implement derived ICollection with String as parameter (or any type).

The type T then can be replaced by String, so the use will be ICollection<String> (read as ICollection of String). In fact, arrays in .NET 2.0 and above are implemented as collections of parameterized type, so when we have array of bytes, it’s actually implemented as collections of strongly typed bytes, not just array of boxed objects.

Sample from MSDN: (from http://msdn.microsoft.com/en-us/library/vstudio/b5bx6xee%28v=vs.110%29.aspx)

// The .NET Framework 1.1 way to create a list:
System.Collections.ArrayList list1 = new System.Collections.ArrayList();
list1.Add(3);
list1.Add(105);

System.Collections.ArrayList list2 = new System.Collections.ArrayList();
list2.Add("It is raining in Redmond.");
list2.Add("It is snowing in the mountains.");

Although it’s very subtle, the ArrayList will cast to objects, and this is called boxing.

As consequences, we also need to understand boxing and unboxing concept in C# and VB. For more info, visit boxing and unboxing in MSDN Library.

Now with .NET 2.0 and above, we can create list with strong typed:

// The .NET Framework 2.0 way to create a list
List<int> list1 = new List<int>();

// No boxing, no casting:
list1.Add(3);

// Compile-time error:  // list1.Add("It is raining in Redmond.");

Now every time we access each or any member of list1, we are confident that the type of the member is int.

This type parameter concept is very powerful, and it’s becoming a basic feature for all modern programming language nowadays. Not just languages on top of .NET platform, .NET itself has integrate generic deeply as part of CLI and CLR implementation.

Other platform such as Java had begun implementation of generic in Java 5 (JDK 1.5.0) although it came late. Luckily, there’s an official tutorial of generics in Java from Oracle.

By integrating generic deeply into the runtime, now it’s up to the programming language to leverage this! In .NET, we have C#, VB, F#, C++.

Hey, it’s time for the participants to try!

WP_000184-2_thumb_71186989

Finally, they could create the LINQ WHERE! …And now time to eat!

WP_000191_thumb_5A38D666

Next meetup: advanced LINQ concept.




Sidenote


Again, I encourage all of you to read TAPL book by Benjamin Pearce, to fully understand the type theory behind generic type.

Monday, November 18, 2013

TEACHING: Study club of MUGI Jadetabek on Developer Track, WEEK 3

It’s week 3 now! Time for MUGI participation! Now MUGI Jadetabek has initiated study club. Initially we have two tracks: developer track and infrastructure track.

Initially started as an idea from Abdullah Muhammad (chairman of MUGI Jadetabek) and I when attending Microsoft Community Summit, now it becomes realization. The place is at Microsoft Indonesia’s main office, JSX on 18th floor.

The course will be in the form of 5 times informal meeting weekly.

For developer track, we have 5 attendees. We have decided to limit the number of attendees for now, as we want to spread and teach the knowledge effectively.

Initial developer track will be delivered by myself, Eriawan. As for now, I deliver introduction to C#.


Week 3 is on 8th November, still at the same Microsoft Indonesia’s HQ at BEJ Jakarta.

Now, the subject is about advanced OOP and collections in .NET (including generics).

This week we only have 2 attendances because Wakhid was taking care of his final paper assignment and Aris was sick.

I had demo on LINQ Select:

Sample_SELECT_LINQ_thumb_2FD8A3A0

As always, the show must go on!

MUGI_studyclub_WEEK3_thumb_02271276

We moved to smaller rooms but I think it’s good, because it separated from the Infrastructure track that begins on developer’s week 3!

I gave home assignments to create implementations of ICollection<T> and also create WHERE method of LINQ.

As promised, the slide deck will be uploaded soon. I hope tomorrow I can download the slide gracefully as it’s quite large, more than 6MB!

The next week 4 will be scheduled on 23rd November. Stay tuned!

Friday, November 8, 2013

TEACHING: Study club of MUGI Jadetabek on Developer Track, WEEK 2

For developer track, we have 5 attendees. We have decided to limit the number of attendees for now, as we want to spread and teach the knowledge effectively.

Initial developer track will be delivered by myself, Eriawan. As for now, I deliver introduction to C#.

Hi there! This is Week 2 of Developer track study club, part of MUGI Jadetabek community program. As usual, we held this on Microsoft Indonesia office, on 2nd November, 2013.

This week I bring OOP concept in C# and the OOP.


Official link for OOP in C# and VB (for Visual Studio 2012) is at: http://msdn.microsoft.com/en-us/library/dd460654%28v=vs.110%29.aspx

Before that, we spent 1 hour to discuss last week homework task: creating butterfly.

These are the pictures from Week 2:

mugi_studyclub_week2_01 

And this is another style pose: Smile

mugi_studyclub_week2_02

Basically, OOP has these 3 pillars:

  1. Inheritance
  2. Polymorphism
  3. Encapsulation

Unfortunately, OOP was not described well in MSDN Library.

I suggest we look at the Oracle’s Java documentation of OOP at: http://docs.oracle.com/javase/tutorial/java/concepts/

They have nice illustration to describe encapsulation:

concepts-object

And the sample in real world:

concepts-bicycleObject

The slide will be available on week 3, tomorrow!

Tuesday, October 29, 2013

TEACHING: Study club of MUGI Jadetabek on Developer Track, WEEK 1

Time for MUGI participation! Now MUGI Jadetabek has initiated study club. Initially we have two tracks: developer track and infrastructure track.

Initially started as an idea from Abdullah Muhammad (chairman of MUGI Jadetabek) and I when attending Microsoft Community Summit, now it becomes realization. The place is at Microsoft Indonesia’s main office, JSX on 18th floor.

The course will be in the form of 5 times informal meeting weekly.

For developer track, we have 5 attendees. We have decided to limit the number of attendees for now, as we want to spread and teach the knowledge effectively.

Initial developer track will be delivered by myself, Eriawan. As for now, I deliver introduction to C#.


This is the picture from Week 1 on 26th October, 2013:

mugi_studyclub_week1_01

Above, Abdullah was delivering welcome speech.

I start this week with these discussions:

  1. Quick intro to Visual Studio 2012
  2. Installing offline documentation of Visual Studio 2012
  3. Creating Visual Studio C# project
  4. Basic primitive type of C#
  5. Looping (for and foreach)

The topics above was adjusted with the current knowledge and current understanding of the audiences. This is why some of the topics are very basic.

In this week, I gave them homework task to display butterfly using “*” and spaces.

The slides will be ready after week 3, based on the evaluation for 2 weeks of participation, guys!

The next week: Fundamentals of OOP!

Interested? Ask Abdullah Muhammad, or visit MUGI Jadetabek on Facebook!