Saturday, June 7, 2008

Which "programming language" I have been dealing with for these days ? (Winter of 2008)

If you're interested in learning new technologies on programming languages and the global development environment you have to be fresh and robust.

Nowadays, i have fully concentrated my leisure time on learning new
programming languages that run the web. I was always asked "Which programming language is the best to learn?" by my friends and co-workers, i generally answer this kind of question like that: " If you only know one, then your in serious trouble" :)

This got me thinking on what programming languages should a programmer know to maximize his talent and marketability. Below is the top five languages that every programmer should know:


Ruby on Rails

Why you should learn it:
Cause it is the future. If you want to build a website writing only 8 lines of code Ruby on Rails(RoR) is the language for you. There has always been talk of Object Oriented Programming(OOP) and Ruby on Rails is OOP in its purest form.
Why it is not my first choice: Cause it is still in infancy and it does not have a debugger or a true IDE. Also its has a STEEP learning curve and its hard to understand how each component is put together, but all in all, it is the newest, most innovative one and very interesting with pure futures.
Resources: Top 12 Ruby on Rails Tutorials

My Tips to Become a Better Softare Developer just after the "Newbie" State


Today, at the line of retiring programming, i have tips to store for myself and should be helpful for new programmers and open minded (developers with the high improvement ability on work), these are formed in five steps;

Tip 1. Methodize... don't memorize

A programmer friend of mine use to always tell me how his memorization of over 200 function in C++ helped him greatly. "I never have too look up function definitions , therefore I can code 50% faster then the average coder!" he would brag. So what happened? Intellisense for one, two when C# came out all his diligence in memorizing functions went to waste. Of course in coding some memorization is a necessity but you should spend more time learning the method of doing things, i.e. creating a db connection, consuming a RSS feed, etc. then memorizing the code on how to do them. Learn the correct methods of doing thing, don't memorize.

Tip 2. Create your own Resource library

We all have a block of code that for some reason or another we have to look up. I can never remember the exact sequence of code to connect to a database. So every time I had to do this I would spend 10 minutes finding the book, looking up the link, etc. To combat this I created a word document that has snippets of code that I have trouble remembering for some reason or another. One of my colleagues creates a bookmarks of links, another stores all his in a email. What ever your method is its a good habit to keep that file close by . The point is that you should be building you knowledge base and you will find that it will greatly help you in coding better and faster.

Tip 3. Learn WHAT not HOW

A lot of junior programmers ask me "How do I do this, or How do I do that?" and I always ask them "What do you want to do?" and they stare at me like I am dating their mothers or somethings. This brings me to my next point, never learn How always know What you want to do. Example, lets say a programmer wanted to search a text file to see if it contains a certain word. This is HOW you would do it in C#:
string fileContent;
System.IO.FileStream myStream = new FileStream("c:\\aa.txt", FileMode.Open);
System.IO.StreamReader myStreamReader = new StreamReader(myStream);
fileContent = myStreamReader.ReadToEnd();
myStreamReader.Close();
int idx = fileContent.IndexOf("string");
if (idx)
{
return true
}

Now sure I could give him the code to do this but its more important to understand WHAT you are trying to do. In this example WHAT you want to do is:
1) Open a file
2) Read the file contents
3) Close the file
4) Search for string
5) If found output success message.

Breaking down the task in the manner does two things
1) it makes it language independent
2) it gives you a focus on WHAT needs to be done.
3) It makes your code more readable and usefull
Know WHAT you are trying to do makes the language you are trying to code it in inconsequential. Now it should be easy to create this code in C++, PHP, VB.NET, Ruby on Rails because you understand WHAT you need to do instead of HOW to do it.

Tip 4. Comment to match your style

Everybody coder hates commenting but in order to write quality/readable code every coder must comment. The problem most coders have is that they are always TOLD how to comment. Some companies want a comment on every line, others want a block of comment before every functions, others wants comments on difficult code blocks. I disagree with the policy and say that as long as the comments are usable, readable and useful then a coder should be able to comment in a format that works for him/her.For me commenting on every line breaks up my coding rhythm. I prefer to comment at the beginning of a functions listing step by step what I am going to do, then I referencing the steps as comment inside the functions. This works for me because it helps me organize my plan before I starting coding, its keeps me in rhythm as I don't have to stop coding to comment, and its help other readers read my code. Heres a example of how I comment:

/* 1. Open File
* 2. Read file into string
* 3. Close file
* 4. Search for key word
* 5. If fond return true;
*/
string fileContent;
//1.
System.IO.FileStream myStream = new FileStream("c:\\aa.txt", FileMode.Open);
System.IO.StreamReader myStreamReader = new StreamReader(myStream);
//2.
fileContent = myStreamReader.ReadToEnd();
//3.
myStreamReader.Close(); //4.
int idx = fileContent.IndexOf("string");
if (idx)
{
//5.
return true;
}

My point here is that this commenting style works for me and most programmers can read it with ease. Find a commenting style that works for you.

Tip 5. Master one...Learn another... but keep your eye on the next thing

Programmers sometimes email me and ask me what language should I learn, what is the best programming language to learn, etc. I you should at least master one programming language, be able to program fairly well in another and always, ALWAYS be on the look out for the next thing. Myself for example, I am great in C#, good in PHP and have been playing around with Ruby on Rails for the last month or two. Why do this? Well for one being a programmers is always about evolving. Evolving to write better code, evolving to find better ways of doing a task, always evolving ;)