Thursday, March 6, 2008

Programming Languages which every programmer should know ?

Too often , we come across people who claims expertise in multiple programming languages. Some take pride in having competance in C,C++,Java,C#,Perl and others.
Being multi-lingual from a programming language sense is a good thing. Since each language has got thier own idiomatic way of programming , a typical developer will get exposed to vast variety of programming models thanks to this phenomemna.

What is the catch ? All of the above programming languages fall into same family of programming languages. They are imperative ( command or state ) oriented languages. These languages evaluates expression for it's value and statement for it's consequence ( change of state ). So, their expertise is limited to one programming language. It is a case of getting exposed to different syntaxes. This fact is unknown to these mutlilingual programmers.

The languages can be broadly classified into three families

a) Imperative programming languages
C,C#,C++,Java,Perl,Visual Basic etc
b) Functional Programming languages
Lisp , Scheme , F# , Occaml etc.
c) Logic programming languages
Prolog and DataLog

we can make a living without learning anything about Functional programming and Logic programming languages. But , to become a complete programmer , one should be familiar with other programming paradigms too.

Try to learn Scheme programming language. It will change the way u look @ programming. More information about scheme can be gleaned from

http://en.wikipedia.org/wiki/Scheme_(programming_language)

The Scheme is the programming language which programming is introduced to MIT undergraduates. The famous book Structure and Interpretation of Computer programs was written from this course note. The full text can be read online from http://mitpress.mit.edu/sicp/

if u want a much gentle introduction to Scheme , try out How to Design Programs @
http://www.htdp.org/ . A free compiler and IDE which can be used to learn Scheme
can be downloaded from http://www.drscheme.org/

There are excellent books on Prolog available in the market. My personal preference is for Art of Prolog By Ehud Shapiro. The GNU foundation's GPL prolog compiler is a good interactive environment for learning prolog. The software can be downloaded from http://www.gprolog.org/

Wednesday, March 5, 2008

Data Structures - Some meta knowledge worth having

A sound knowledge of Data structures and Algorithms is necessary to have a good career in software development. At least , there was a time when this belief was very much in the mainstream. With the advent of Standard data structure libraries and Open source libraries, people are able to write applications without hearing about the term Data structures.

The natural question one can ask now is ..."we have got collection classes in java , C# and C++ [STL,it's container]. why one should know about data structures ?". The question is a valid one. if your into application software development , one can be perfectly happy with vector , map and other classes available with these libraries. But, there are cases where we might have to create hybrid data structures to solve a problem @ hand.

The first classical data structure , we come across is some thing called a Linked List. This is also called Linked Linear List.There was a time when most programming languages had a restriction that the number of array elements in a language has to be declared at the compile time. Then creation of a Linked list was the only option available for the developer to have a dynamically sizable data structure. The Linked list data structure has got variations like Double linked list , Circular Linked list etc. The wiki entry for the Linked list cann be found

http://en.wikipedia.org/wiki/Linked_list



The next most investigated data structure is a tree. A tree is a data structure which has got a left node and a right node. The left node will always contain a value which is lexicographically smaller than the node and the right will have a bigger value than the current node. Tree is a recursive data structure. we can consider each node a sub tree. The traversal algorithm for a tree can be written very easily using recursion. Most standard data structure books show u how to insert , search and traverse trees. Some of them leave delete as an excersise to the reader. The tree can quickly degenerate into a list , if it gets only value which is greater or small than the root node. Then researchers brought in tree balancing heuristics to the table. There are trees like AVL , Red black trees which does a good
job rebalancing the tree once we have inserted the elements. The MAP collection classes in most languages are implemented using Red black trees. Once we have got an intuitive appreciation of trees , one can sneak in. The wiki entry for Tree can be located @

http://en.wikipedia.org/wiki/Tree_%28data_structure%29



The other data structure which are of great importance are STACKS and QUEUES. STACK is some time called Push down stack. The stack is LIFO (Last in first out ) model.
STACK is a data structure commonly used for evaluating expressions , remebering the traversal path in a tree or graph etc. Recursive routines which implicitly uses processor stack can be converted into an iterative one by a software stack (data structure). Queues are data structures where we read data from the front and write the data in the rear. Queues are also called Circular Queues.
The wiki page for Queue and stack is located @
http://en.wikipedia.org/wiki/Stack_(data_structure)
http://en.wikipedia.org/wiki/Queue_(data_structure)


The title of king of data structures will probably go to the GRAPH data structure. A literature which will take a person's life time to read has been written about it. We are concerned mostly about the algorithmic graph theory. How graphs can be realized on a computer to efficiently process it will be our primary concern. Tree is a specialized case of a Graph where there are no cycles in the graph. So, GRAPH can be considered as a super structure.

http://en.wikipedia.org/wiki/Graph_(data_structure)

The knowledge of List , Tree , Stack,Queue and Graph with it's associated algorithms will make u a better programmer. Armed with this knowlege , u can choose the collection class for the occasion with confidence.

There are some domain specific data structures like QuadTree ( Computational Geometry ), Octree ( Color reduction Algorithms ) , BSP ( Binary space partition tree - for visibility ordering ), Winged Edge Data structures ( Solid modelling ) , R-trees ( for spatial layout ) and others , which one can tackle armed with the knowledge of the above classical data structures.

Why did i create this blog ?

While having a conversation with one of my colleague , he brought to my notice an email post which implies that all the progress our country ( INDIA ) has made is in the area of back office software development. When i began to ponder about it , there is some sense in what has been hinted in the mail. With the advent of virtual machine platforms like Java and .NET , the majority of software development organization began to focus on Enterprise Business applications , shunning areas like engineering software development , systems software and applications which are having great algorithmic content.
While we are having center of excellences like IIT, RECs and other top grade engineering colleges , over all, software professional on the street is surprisingly ignorant about many a topics which is considered to compose the core of any computer science curriculum. The mathematical sophistication of average software professional is very low compared to what should have been considered average. The fact of the matter is 95% of the applications are centred around Relational Databases and most of the programmers are only comfortable or accustomed with Database applications. At least 50% of them , spend their time fixing UI anomalies associated with web applications. This has helped our country to progress a lot in terms of economy and empowered thousands on the way. Every graduate worth his salt is employed now by a software development company , BPO or some ITES firm. In terms of numbers , INDIA will be a force to reckon with for at least some time to come. What has fueled this growth ? It's defenetily the Cost Advantage. Because of 20% hike in expenses , our country might loose our advantage to countries which can offer better price points.
We should not blame the enterprueners for this state of affairs. Because of them, india could cash on to this service industry boom. How do we maintain our competance when we cannot compete @ the price points ? The only way out is to improve our competance in core technichal computing , engineering software arena and algorithmic software development.

The natural question which might arise in any one's mind is "who the heck are u to comment on this ?". Rather than explaining what i am , let us bother about what i have to say !.