Skip to content

Programming Language Level (2)

by Adam on February 23rd, 2005

Well I promised that this time I would discuss C, C++ and Java. I have had experience with all of them for various reasons and in different depths. I will discuss each in the order from least familiar to most. I enjoy using all languages at this level because there is a lot of libraries and tools you can take advantage of but at the same time there is still lot of algorithmic complexity that you are able to work with. I love programming simply because I enjoy a challenge and this level of language offers that challenge. Higher levels tend to do hide things and you loose that sense of accomplishment when programming.

C++ is the language with which I am least familiar. You might ask how that can be since I have said multiple times that I know C so well. The reason I place it here is because I learned Java in class while attending the University of Waterloo and the knowledge has stuck with me. With C++ I have not spent a great deal of time playing with STL and objects / classes / inheritance / generics / etc. When ever it comes to a project that I could potentially use C++ for I would instead go with C since I am more efficient with it. However, I understand Object Oriented Programming but that is not the issue, syntax and language eccentricities are the real knowledge of a language. I mean I could probably type up a class stub off the top of my head … lets try.

class Testing
{
private:
int a, b, c;
float x,y,z;
public:
Testing();
~Testing();
void method(float v[3]);
}

Testing::Testing() {};
Testing::~Testing() {};
void Testing::method (float v[3]);
Listing 1: C++ Pseudo Code

I’m sure it wouldn’t compile but anyway the point is that I am least familiar with C++. Moving on, C++ is a great language that is used almost industry wide. Every application developer should have it on their resume if they expect to be hired. It is perfect for a group programming effort; OOP design allows for teams to work on different components (objects) of the application at the same time. Encapsulation and specification allow for easy updating of objects in functionality and performance without needing to change other parts of the application. This may be one of the reasons I don’t tend to use it. Too much time is spent on the design and OOP concepts and for a one person operation like mine it is wasted time. For all the benefit of object orientation you only loose approximately 5-15% in performance over C code. So to summarize, learn this language and learn it well.

Java is another object oriented language that is now widely used as a teaching language for low year university students. This is both a pro and a con but I won’t get into that as you can easily search out the reasons using google. Java is a great language for rapid application development (RAD) you can template a GUI in no time and use it to show clients. However when you get down to the nitty gritty its cross-platform nature really hinders it from an applications standpoint. It does not where near as good a job as C++ when on a specific operating system only. Java die hards will always come back with “Java 2 is now as fast as C++” but my complaint is that you get unsatisfying look and feel as well as a detached from the OS feeling. You can always tell the Java application vs a regular one. However if you goal is to create an applet for a website or some application that needs to run on many different platforms generally Java is the best option. I can personally attest that the Java GUI packages don’t look good on UNIX based systems, fonts are weird by default and it looks very Motif-like. This can probably be fixed but why would I spend the time digging into Java. Again to summarize, this language is good for template’s (where VB won’t do) and works great for applets.

C, finally my favorite language. The C language is widely used in both academic and research fields. It is fast, portable (sort of) and known by many people. Most libraries are written in either C or C++ but my favorites, OpenGL and GLUT, are done in C. This language is simple to learn and difficult to master with a great deal of control and flexibility available to be used. Linux and windows both are based on C (I think this is true of Windows) and so the language integrates perfectly into it and has available to it all the low level functionality of the OS. Thread, processes, files, streams, library calls, etc. Of course all this is available to other languages too but not as clean and one-to-one as C. To try to explain what I mean I will mention the Linux kernel programming course I am taking right now. We found that C functions for files map one-to-one with kernel level functions. (ie read() -> sys_read() open() -> sys_open() etc.) C’s difficulty to master is one of my favorite things about it. When a friend asks about a certain pointer operation or command and I can explain it, it makes me happy. However, C like all others has its problems. Currently the latest standard C99 is poorly supported industry wide. Everyone seems to have their own version of C89 with additions running instead. So far the closest I have found is GCC which has the important additions completed, just use the switch -std=c99. C has very poor string handling and regular expression libraries. Perl has the market essentially cornered on string manipulation and regular expression integration and C just can’t compare. Doing simple things from a user perspective is not always simple in code. Take for example sockets and TCP/IP communication. In C this takes a lot of code and threading to do properly which is not nice and easy.

Learn C++ for your resume, avoid Java if you can and have some fun programming with C. Don’t forget to download GLUT and try some OpenGL coding it will change your life.

From → Uncategorized

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS