Friday, November 30, 2007

How to become a good programmer

At ReliSource, many of the times I am involved in the hiring process and need to take several interviews per week/month. Over the last two years, I’m observing one unfortunate truth which is: Bangladesh is lacking enough skilled programmers. Some people have talked about this issue previously and I think it’s time to take some real steps to improve the situation so that we do not face a disaster in the near future.

I’m putting some suggestions here for the fresh graduates and the college freshmen on how to become a good programmer.

In my own definition, a fresh graduate good/skilled programmer should have the followings:

  1. Strong skill of one or more good languages like C++, Java and C#.
    1. Must have strong skills with control structures. Don’t mess up if you’re asked to print out triangle or other shaped piles of ‘x’s with loops.
    2. Must have strong skills with recursion. You must know how to transform a looped task into a recursive one and vice versa, for example: multiplication using addition recursively.
    3. If your language is C/C++, you must know how to play with pointers and references.
    4. Understand pass by value and reference.
    5. Clearly understand scopes and memory allocation, de-allocation. Know when a object is destroyed and when to destroy.
    6. Know the usage of all operators including bit-wise ones.
  2. In-depth knowledge of OOP.
    1. Only being able to write classes and doing encapsulation and inheritance is not what you should call good OOP.
    2. Clearly understand how function overloading, overriding, polymorphism works.
    3. Clearly understand how constructor/destructor (if any) works with inheritance.
    4. Clearly know the difference and use of Interfaces and Abstract classes.
    5. Know how to overload operators. Why and how copy constructor is defined/used.
  3. Know common data structures
    1. At least know the common data structures like stack, queue, linked list, doubly linked list (know circular version of all of them) and trees.
    2. Be a skilled implementer of any of those, have clear concept of how push, pop, add, delete, peek etc method works on those data structures.
  4. Know most common algorithms well
    1. You don’t need to memorize pseudo codes line by line but you need to have clear concept of most common algorithms of sorting(bubble, quick, merge, heap, bucket, etc), searching (including DFS, BFS), etc.
    2. As a fresher you must know their time and space complexities, pitfalls and improvements (if any).
  5. General computing concepts:
    1. Know processes and threads, how are they related to each other, how to program them, etc.
    2. Understand TCP/IP: Don’t think it’s only the network administrator’s task to understand TCP/IP. All programmers ever doing any network or web programming should have clear TCP/IP concepts and understanding.
  6. Be skilled in debugging in IDEs:
    1. Be skilled in any of Visual Studio/Visual Studio.Net, Eclipse, Netbeans, KDevelop, etc.
    2. Know how to debug your code.
  7. Have basic knowledge of Software Engineering and SDLC.

Some advice for college freshmen:

  1. Start with C++ or Java, avoid starting with scripting languages:
    1. If you’re learning programming for the first time, avoid starting with scripting or loosely typed languages like: PHP, ASP, Perl, etc or Visual Basic. It may destroy your understanding of program execution, data types, memory allocation, etc.
    2. Start with C++ or Java. If you want to me to be specific, start with C++, you’ll love it for the rest of your life.. :) It’ll be easier for you to learn (almost) any other language (like: C#, PHP, ASP, etc).
    3. If you ask, do you need to know C to start with C++? Or should you learn C first and then C++? C definitely helps a lot for learning C++ but it's not mandatory to start with C.
  2. If you want to be a good programmer, keep on coding at least 20 hours a week for the next 4 years :).
  3. Never stop learning new technologies that are coming out everyday.
  4. Know some of the many languages/technologies but be master of one. Know at least one language very well.

Good luck!

An interesting interview with great programmers

Please check out this interesting interview.

The following persons were interviewed:

  • Bjarne Stroustrup - C++ creator
  • Linus Torvalds - The Linux kernel author
  • James Gosling - The Java language creator
  • Peter Norvig - Research Director at Google, a well known Lisper, author of famous (in some circles at least) books about AI.
  • Guido Van Rossum - The Python language creator
  • Tim Bray - One of the XML and Atom specifications author and a blogger too.
  • Dave Thomas - Author of the “Pragmmatic Programmer”, “Programming Ruby” and other great books about programming.
  • David Heinemeier Hansson - Author of the Rails Framework - the new hot web development framework.
  • Steve Yegge - Probably the least known from guys here, but also made one of the most interestings answers, has a popular weblog about programming. He is also the author of a game called “Wyvern”.

The following questions were asked:

  1. How did you learn programming? Were any schools of any use? Or maybe you didn’t even bother with ending any schools :) ?
  2. What do you think is the most important skill every programmer should posses?
  3. Do you think mathematics and/or physics are an important skill for a programmer? Why?
  4. What do you think will be the next big thing in computer programming? X-oriented programming, y language, quantum computers, what?
  5. If you had three months to learn one relatively new technology, which one would You choose?
  6. What do you think makes some programmers 10 or 100 times more productive than others?
  7. What are your favourite tools (operating system, programming/scripting language, text editor, version control system, shell, database engine, other tools you can’t live without) and why do you like them more than others?
  8. What is your favourite book related to computer programming?
  9. What is Your favourite book NOT related to computer programming?
  10. What are your favourite music bands/performers/compositors?

Url: http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer/

Chao!

Thursday, November 22, 2007

Some interesting facts about the origin of C++

If you don't know them alredy, enjoy:
  1. BCPL’s // comment convention was (re)introduced in C++.
  2. The class concept (with derived classes and virtual functions) was borrowed from Simula67.
  3. C++’s facility for overloading operators and the freedom to place a declaration wherever a statement can occur resembles Algol68.
  4. Templates were partly inspired by Ada’s generics (both their strengths and their weaknesses) and partly by Clu’s parameterized modules.
  5. The C++ exception-handling mechanism was inspired partly by Ada, Clu, and ML.
  6. Other developments in the 1985 to 1995 time span – such as multiple inheritance, pure virtual functions, and namespaces – were primarily generalizations driven by experience with the use of C++ rather than ideas imported from other languages.

Source:The C++ Programming Language, Special Edition by Bjarne Stroustrup.

Linux: Using the 'find' command.

In Linux, often times you'll need to find files using patterns like '*.txt' or 'sys*.*' and do operations with the results. You can do that in several ways. A harder way will be writing a complicated script using the 'ls' and 'grep' commands in pipe. But the 'find' command is one of the easier ways. I'm using the terms 'easier' as I'm not sure of the 'easiest' way as I am not a Linux guru.. well yet.. ;)

The 'find' command is powerfull but if you're a begginer, you'll hardly understand the help or manual of it. I won't re-write the man page in some easy way here, rather I'll just give some examples so that you can quickly use it and understand the man page later on. So, here goes the examples:

1. Search all '.txt' files in the current directory, including its subdirectories:

find . -iname "*.txt"

2. Search all files with the name 'pre_*.txt' (example: pre_01.txt, pre_abcd.txt, etc) in the 'src/dir', including its subdirectories:

find src/dir -iname "pre_*.txt"

3. Search all '.txt' files in the current directory, including its subdirectories, and copy/move them to another directory:

find . -iname "*.txt" -exec cp {} /dest/dir \;
find . -iname "*.txt" -exec mv {} /dest/dir \;

Note: don't forget the '\;' in the end, it won't work otherwise.

4. Find all .htm files in the current directory, including its subdirectories, and compress them into a gzip file naming 'output.tar.gz', maintaining the directory structure that they were found in:

find . -iname "*.htm" > temp.txt
tar -czT temp.txt -f output.tar.gz

I hope this post will be helpful to you sometime.