Comparison of Programming Platforms C++ vs. Java vs. C# vs. PHP Presentation By Anup Hariharan Nair Date: 23 December 2011 http://HiFiCoding.com/Prepared using :
Whats new ? Looks are everything Hardware accelerated graphics WPF on .NET, Java FX, Adobe FLEX. Dynamic Equation Dynamic language support in .NET 4, Java SE 7 and C++11(C++0X). Parallel Computing Mergers and Acquisitions Acquisition of Sun Microsystems and BEA by ORACLE
Major programming Platforms C++ (QT/BOOST/WT/C++0x) JAVA (ME,SE,EE) C# (MONO/.NET) PHP/PERL/PYTHON(LAMP)
C++ (QT/WT/Boost/C++11) Pros: The most widely used programming language. Works in almost any platform known to mankind. Fastest Platform. No other can compare it. Probably millions of libraries available for C++ on the internet. “There is a Library for that”. Every major computer companies in the world employ C++. Virtually all major applications like Google Earth, Adobe Photoshop, VMware, Skype etc… is written in C++.
C++ (QT/WT/Boost/C++11) Cons: Coding is a little complex. You have to take care of memory references on your own. GUI development and library references looks cryptic when compared to Java & C#.
C++ (QT/WT/Boost/C++11) Present trend: C++11 • New specification C++11(C++0x), is a true successor to the existing specification C++03. • Significant improvement over the existing C++ specification includes generic programming support and performance enhancements. Dynamic type Support using “auto” keyword. Need for an easy framework for developing hardware accelerated graphics based GUI. On 9th May 2011, it was announced that Qt 5 would be released in 2012. Main objective of Qt5 is to make better use of GPU, and accelerated graphics, with minimal complexity.
JAVA Platform (ME/SE/EE) Pros: Cross Platform. Managed Code environment using JVM. Business Applications development companies like SAP, Oracle, etc; have been long supporters of JAVA. One of the Simplest Languages.
JAVA Platform (ME/SE/EE) Cons: Performance. • Java makes use of interpreted byte code, and it also needs to load a ton of frameworks before it actually starts executing the main program. • JIT compiler is also of little help as it only compiles interpreted byte code to machine code on the fly and does not start until the program has been running for a while. • Compared to other languages like Perl or Ruby, Java is still fast.
JAVA Platform (ME/SE/EE) Client-Server Once a client/server application is started, only responsibility of the Application server is to respond to the HTTP requests and call compilers, interpreters and other HTTP modules as needed. So in this paradigm, Java is not slow and is the principal reason why Business Application developers like SAP and Oracle still trust JAVA. The notion that JAVA runs almost as fast as C++ is just not true (at least for now). Compiled C++ is possibly 10 times faster.
JAVA Platform (ME/SE/EE) Performance of JAVA when compared to .NET/MONO? Architecturally .NET and MONO are very similar to JAVA. .NET on windows is faster than JAVA. JAVA 1.6 memory usage is still more than 2 times when compared to .NET 4.0. Also the initialization and deletion operation of types is slower compared to .NET, which is the principle reason why .Net applications run faster than JAVA. In case of MONO, though memory initialization and deletion is nearly equal to JAVA, the memory usage is half, which surprisingly implies that even MONO can outperform JAVA.
C# on .NET Architecturally .NET is very much similar to JAVA, except that the core framework only runs on windows or other Microsoft supported platforms. However the .NET framework and Application Server (IIS) is not open. One will not have the flexibility to add custom modules as easily as in case of LAMP, JAVA, or MONO. Most consumers and developers find this monopolistic and are always cautious while choosing this framework.
C# on .NET Architectural criticisms “Web Forms vs. MVC”. Server based Web-Forms architecture speeds up the time required to create a Web Application by employing Server Controls and associating events to those controls. At execution, server controls are converted to the native HTML client controls. Major limitations of Server based Web-Forms Architecture: There is an overhead of compiling the Server controls and converting them back to the Client side controls. Certain logic is best applied when you have perfect control over the HTTP request.
C# on .NET Certain logic is best applied when you have perfect control over the HTTP request. Example - one wants to create number of HTML input types based on a condition. In the classic Form Get/Post model, we can simple apply a “for loop” and create the input controls in the mark-up page, but with server controls, we have code that as Server Script and identify how to associate the Post back event with the controls which is an inefficient programming model. The Client Side selection of elements using DOM or jQuery is horrible as you have to realize the name of processed input tags. The classic Form Get/Post model exists by default in .NET, but what people criticized was the inefficient research while proposing a programming architecture to developers.
C# on .NET But 80% of the time you don’t need that degree of control. Make no mistake; the industrial acceptance of Web-Forms was huge. Even Sun Microsystems (now Oracle) implemented JSF (Java Server Faces) specification to enable development in a Web Forms Architecture using Java. To counter the criticism, Microsoft also gave the option of MVC (Model View Controller) specification based ASP.NET development in .NET 3+. There was huge criticism in terms of how the implementation was done. With MVC 3+ Microsoft plans to remove all possible criticisms.
C# on .NET All and all, .NET is great platform for development as long as you and the customer have no issues with using a complete Microsoft Environment for entire application lifecycle. Performance as compared to C++ compiled application is still slower. But similar to the case of Java, .NET has the benefit of reduced coding complexity when compared to C++. The performance of a .NET application running on windows is faster compared to a similar Java application.
C# on MONO MONO is an open community platform; that brings the power of C# specification defined by ECMA and Microsoft to all POSIX platforms as well as Windows. When it was released, it only allowed for Console and Web application development. Since GDI based forms implementation would not work on other Operating systems, Desktop application development was not present in earlier versions of MONO.
C# on MONO However, recently the community created GTK# (GUI Took Kit Sharp) which is a C# implementation of GTK+ (in C++). So now, MONO developers are equally capable of creating Console, Desktop and Client-Server applications. Nowadays MONO is also capable of creating application that work on Android & iPhone; something .NET framework will never support.
C# on MONO Also, MONO removes the limitation of .NET of being a closed system. We can implement my own modules to the core framework or the application server like Apache. We can even make use of existing apache framework modules for my Client/Server application.
C# on MONO So the question is what’s wrong with this platform? Mono is relatively new. It is still not a credible platform to work on. There are number of situations where you will find your console application hung for no reason. Your ASP.NET page breaks and your code is not the culprit; it’s the framework which is at fault. It is an open source initiative from Novell Inc and has not completely matured yet.
C# on MONO However, it should be pointed out that MONO is ”surprisingly fast”. If you try to compare a Client-Server application developed in JAVA & an exact implementation in C# on MONO you will be surprised to find that MONO is fast. However until the time it becomes more mature & stable, it is strictly recommended not to develop application in C# on MONO.
PHP/Perl/Python (LAMP) Of the three P’s; PHP is the most widely used. LAMP is primarily employed for Client- Server (Web) development. Almost 70% of all open source applications are written in LAMP. Major giants like Yahoo, Twitter, Facebook etc; make use LAMP for developing most of their applications. LAMP is the most dominating platform for web (client/server) development, and there is a very good reason for that.
PHP/Perl/Python (LAMP) There are possibly 1000’s or more open source frameworks, which significantly simplify the overall development time. Also they are very highly featured. Though PHP code may look cryptic at first but it is really simple to code. Also there is a framework for every web development; you will end up coding very few lines of code.
PHP/Perl/Python (LAMP) Dynamic Language paradigm: It should be pointed out that PHP is dynamic programming language. Being a Dynamic language as compared to a Static language like C++, JAVA or C# has certain advantages when it comes to development of Database driven Applications in terms of the overall memory consumption. Compiler does most of the calculation of allocating the memory to Types based on its usage. It is so significant that Microsoft added “System. Dynamic” namespace in its .NET 4.0 to support Dynamic Type based specification for C#, VB.NET and other .NET supported languages. Oracle also added support for Dynamically Typed Language in Java 7 specification.
PHP/Perl/Python (LAMP) The reason why LAMP has been so successful over the years is the huge community of Open Source developers. There are thousands of free open source applications which suits almost any need. Applications like Joomla, Drupal for Content Management system, Wordpress for blog, etc. Not only that. Even after being an open platform it is stable as it is years in the making and there are millions of developers to support it. However, being an open platform, you will have to take care of security vulnerabilities.
PHP/Perl/Python (LAMP) All and all, this is the most matured platform for web (Client/Server) development. Every major technology in web development like URL routing, HTTP compressions, ETag caching etc; are first implemented on LAMP and later ported to other platforms like JAVA and .NET/MONO.