Sunday, November 01, 2009

Preface



This post is part of my ongoing effort to familiarize the readers with the commonalities & variabilities of C++/Java/C# programming languages. A tentative outline of this series can be found at Contents.
I am a programming freak. I love to play with programming languages and don't mind to learn new one if it has potential to bring value to my team. My first program was is Pascal which I wrote as part of undergraduate course. Programming was an utterly complex task at that time, so I didn't like it. I learnt C language in close succession and fell in quick love. I started to enjoy programming and try new things out. I was convinced that C could solve any programming tasks in the universe. It is correctly termed as middle-level language due to its duel supports for higher level features and lower level capabilities (even inline assembly support).

My experience in professional life is quite different. Client requirements are more important than developer's interests. Software is developed at a long period of time with a vision to run it much longer period. The importance for maintainability and reusability drastically increases with the complexity of the task. I had to learn the principles of object orientation for that and C++ was my natural choice. Since then it is my most preferred language.

Things were not always smooth with C++ in the industry. It has abundance of features that cause very often confusion to the developers. Many features are immensely excessive than a developer can remember at particular point of time. If you decide OO for your project, why do you need C-style procedural programming? If you don't need to manipulate the hardware directly, why do you need assembly compilation at all? The direct resource management adds to the woe. Your employer will always try to task will less costs. Even if a project costs less, the next project will be tried to be completed with lesser costs. Visual Basic (VB) adds new capabilities to build programs in minutes. It makes the program development simpler and faster. So I had to try that out in my company. Unfortunately, when program becomes large and you need to do complex staff, then VB becomes almost uncontrollable and even impossible to implement lower level features.

Java has radically changed the landscape of software development since its introduction in 1995 by Sun Microsystems with the slogan ”Write Once, Run Everywhere”. Java is a pure Object Oriented Language derived from C++. Many ambiguities of C++ were removed. It has simplified memory management through automatic Garbage Collection (GC). The language is accompanied by a large collection of class libraries. Involvement of large software companies and presence of a strong developer community around the world result in a massive explosion of systems based on this technology. It has won the support of many enterprises around the world thanks to its superior security model and platform independence. Sun has released the Java Development Kit (JDK) as free software under GNU General Public License (GPL), and thus further increasing its acceptability to the enterprises and developer communities. There is a large stack of software frameworks from Sun, open source community, and commercial vendors for distributed web development. The development is driven by Java Platform Enterprise Edition (Java EE) which is built on a set of widely accepted technologies, speciļ¬cations and standards for the distributed system development like Servlets, Java Server Pages (JSP), Java Server Faces (JSF), Enterprise Java Beans (EJB) which are further supplemented by several developer friendly and community driven frameworks e.g. Struts, Spring, Hibernate etc. The Apache Tomcat and Sun Java System Web Server are two free and open source web servers used very often for the web application deployment.

The penetration of Java language specially in the application server sector and its increased popularity have influenced Microsoft to develop its own suite of similar framework. Consequently, it released .Net Framework in 2001. Due to its muscle in the PC industry, it was immediately clear that the framework would push forward and take a strong place in the future. The .Net framework is a programming infrastructure to build, deploy, and run applications primarily on Microsoft Windows Operation systems. Similar to Java, programs which are targeted to .NET platform run on a managed environment, theoretically providing platform independence for the programs, once a .NET runtime is available for the target operating system. In addition, .NET Framework has cross-language support that provides a mechanism to share .NET components developed in different languages allowing collaborative development of a system by developers expertise in different programming languages. Though the .NET runtime and SDK are free, the costs of windows operating systems on which such programs are built and run make it less attractive for many programmers. Like Java, it is also derived from C++ with some restrictions and enhancements to the base language.

I have got a lot of opportunities to work on quite a number of software technologies thanks to the diversity of development fields that all my companies had. This enabled me worked with these three languages simultaneously. I like to share my experiences with the Internet communities that helped me over the years in experimenting new staff, problem solving, and coming up with ideas. It is often required for a computer student or programmer to read, understand and write programs in one or the others of these languages. As they are derived from a common root, the syntax and programming structures are very much similar. Programmer having some knowledge in one language is able to get into the other very easily. I have used the term commonalities to refer to the common aspects of the languages. Variabilities, in contrast, refer to the differences among the languages. For example, all the languages have int data type. int data type in C++ is platform dependent which is 2 bytes (16-bit) in length in 16-bit operating system and 4 bytes (32-bit) in 64-bit OS. On the other hand, int in C# is 8 bytes long.

Learning programming languages can never be accomplished without exercises. In this set of posts, a simple hexadecimal reader (Binary Reader) will be developed step-by-step in all these languages. In each section, language features belonging to some category (e.g. keywords, data types, statements) will be introduced. We will explain the usage difference of the language elements. Special elements for specific language will also be listed or explained. Some of the features relevant to our case study will be used in the code. Each language is further supplemented by some extra tools and conventions offered often by 3rd parties to ease the development, documents, build or deployment operations. We will also mention them in their proper places.


We will start with simple syntactical differences of these languages, and then move to Graphical User Interface (GUI), multi-threading programming, database development, web programming. If I can hold my energy, will dive into large scale complex enterprise development. We will not go deep into every technology, rather indicate the tools and technologies available for each type of development. In the next post, I will show how the compilation and runtime processes of these languages differ.



9 comments:

  1. Yet Another Language Comparison. This post looks promising. Waiting for the upcoming posts. Can you please include some code with the writing?

    ReplyDelete
  2. Yet Another Language Comparison. This blog looks promising. Waiting for the upcoming posts. Can you accompany some code with the writing?

    ReplyDelete
  3. Great post! Very neat and clean. Want more from you.

    ReplyDelete
  4. This is a comprehensive discussion on the three languages. Though I don't agree with all your opinions, but the post is very useful. It seems you came bit lately to the Java world and bit early to the C# world. Since MS technology is very frequently buggy, you have waited before diving into the .Net technology. Let's see the next posts.

    ReplyDelete
  5. Why did you not include C in your comparison list if though it's very frequently referenced in your writing? I think the usage of C++ sometimes differs with C more than that with Java or C#

    ReplyDelete
  6. Can you please change the background color of the first paragraph or at least back color of the Contents link?

    ReplyDelete
  7. @Tatiana
    Thanks for your comment. As written in the post, there will be enough source code with the future posts.

    ReplyDelete
  8. Technologies in professional career mostly depend on your employer. If you are a die hard supporter of some particular technology, you can switch to other company or open your own startup. But still there is not guarantee that your new employer will not switch to other technology which you hate.

    ReplyDelete
  9. Mainul Bhai, Great!!
    Do you have any plan to publish a book? You may think it!

    Best wishes,
    Rony

    ReplyDelete