My Route to HTML 5 Via C++
I have spent the last couple of weeks working on a very ambitious C++ program. The program is a software model of a mechanical engineering system. I have never undertaken a more challenging or more rewarding computer programming project. As I spent hour after hour poring over the code, I began to realize why everyone is making such a fuss about HTML 5. The dream of HTML 5 is to make truly universal applications. I truly love C++, it is one of the world’s most flexible and powerful programming languages. However, this power and flexibility comes at a cost: complexity. I will always be a C++ programmer, but after seeing the power of HTML 5 combined with GNU/Linux and other free software, I have now become a believer.
When I write C++ code, I use a very powerful Integrated Development Environment known as Code::Blocks. I compile my Code::Blocks C++ code using GNU’s gcc compiler. The beauty of my system is that I can compile C++ code easily for GNU/Linux OR Windows. (I don’t own a Mac, so I’ve never really had the opportunity to try to compile my code for Mac). The wonderful thing about computer programming is this: the more that you learn, the more that you wonder just what else is possible. As I began to write great C++ programs, I began to investigate HTML 5, and I learned that it may offer easier ways of doing some things that I now do in C++. For example, the current C++ program that I am working on is called Tank Problem. It is a mechanical system with 2 pumps (pumps p0 and p1) and three tanks (tanks t0, t1, and t2). My goal was to write a C++ program that would demonstrate the faster method of filling tank t2: using just tank t0 OR using both tanks t0 and t1. Intuitively, I knew that the two tank method should be faster, but I did not know by how much. I successfully wrote the C++ console application, and it did give me the answer: the single tank method took about 5850 minutes, while the dual tank method took about 5790 minutes. My next desire is to make a GUI version of the application, one that will show all of the system operations: valves being opened, pumps being turned on, and tanks being filled. However, this desire introduced a whole new set of questions:
- Which GUI Library would I use?
- How would I represent changing numbers and visual tank levels graphically on a picture of a tank?
- How would I render system messages and things like valves opening and closing.
I have never programmed a GUI application YET, so these are challenges that I will eventually overcome. Renowned saxophonist David Sanborn once said something that I found very interesting: he said that no matter how much you know, you are never truly a master, you are ALWAYS a student. There is always something that you don’t know, and often, the people who can give you that information know less than you do overall about the particular topic. I believe that the key to success is to stay humble, and to always keep an open mind. As I began to learn more about HTML 5’s canvas feature, I realized that HTML offered an alternative way to creating a GUI version of Tank Problem. (The HTML 5 canvas element allows one to easily draw 2D elements such as graphs. When I read this, I immediately thought about graphing and numerically displaying my updated tank levels real-time on top of a picture of the tank). I began to learn how much I did not know!
Since the syntax of C++ and HTML 5 are so similar, I could probably convert my existing C++ code over to HTML 5 in a day or so. Here is the beauty of HTML 5: it was built from the ground up with graphics in mind! When I realized all of this, the light bulb really went off in my head. C++, Perl, Php, Python, C, HTML 5, and all of the other programming languages complement each other. Skills learned in one language transfer to the other ones. That is why I have found that it is so important for me to continue getting better at C++, even as I forge ahead in the new discipline of HTML 5. Mastering one will makes stronger in the others.
C++ Versus HTML 5
Considering the last segment, “versus” is probably the wrong word to use. If one knows English AND Mandarin Chinese, he or she does not think of one of the languages opposing the other. To the contrary, knowing BOTH languages makes the person’s mind more adroit, flexible, diverse, and responsive. So the true master programmer can easily switch between varieties of programming languages. My goal when I started programming in C++ a few years ago was to become the best C++ programmer in the world. What I now realize is that this is not the way life works. Each bit of information that you learn makes it a little bit easier to learn the next bit. Each piece of information that you learn also makes you hungrier for MORE information. So as you learn more and more, it is impossible for you to ignore something new. Just hearing the words “HTML 5” made me curious to learn what it was all about. It also made me realize that I was crippling myself by only limiting my desired mastery to C++. I realized that the real world requires you to be flexible and able to solve problems using a variety of methods. I realized that C++ is the right tool for some jobs, but other jobs might be done more quickly and more efficiently using other tools.
Here is one difficulty that I ran into while writing the C++ Tank Problem application: coding a complex console application in C++ requires a lot of logical thinking, and attention to detail. Once the console version of the application is completed, debugged, and compiled, one still has to decide how to make a GUI version of it. There is no standard GUI library for C++. One can choose from Qt, GTK, WxWidgets, or a host of other graphics libraries. The promise of HTML 5 is to develop a standardized language which a programmer can use to create rich GUI applications that will run in any web browser. However, the painting is clearly visible on the wall: I believe that HTML 5 apps will eventually run outside of a traditional browser. I predict that many of what we now know as the desktop applications will eventually be written in HTML 5. Does this mean that traditional programming languages like C and C++ are dead? Absolutely not! I think that we will see a convergence where traditional languages are influenced by HTML 5. I see absolutely no reason why a standards body could not come up with a standard GUI library for C++. My final conclusion on this matter is that one should master making GUI apps in a traditional programming language such as C++, but also keep an open mind to learning how to do so in HTML 5 as well.
Why is HTML 5 gaining such traction in the GNU/Linux community?
To me, I think that the great interest in HTML 5 stems from the alleged technical shortcomings of Flash and the current version of HTML, which were famously spelled out by the late Apple CEO Steve Jobs. Flash did a great job of providing a unified web video platform, but allegedly poor performance on issues such as mobile device battery life and memory usage began to plague Flash. Microsoft offered Silverlight, but Silverlight ignored GNU/Linux users. The free software variant of Silverlight, Moonlight, was too far behind the latest Silverlight releases to be a serious option for the GNU/Linux community. Silverlight floundered, so much so that even Microsoft appears to have abandoned it in favor of HTML 5.
I believe that HTML 5 is gaining so much traction in the GNU/Linux community because it was created with the fundamental tenets of free software in mind: 
- Adherence to accepted and open standards.
- Platform independence.
- Full access to program source code.
- A disdain for proprietary plug-ins.
- Lack of central control by a single commercial entity.
In other words, it was very clear that when Opera first proposed HTML 5, their vision was a revised and updated HTML language that freed both users and developers from the onus of coercive influence and control by any entity. No software vendor could force you to download plug-ins to watch your favorite video. The bottom line is that HTML 5 has arrived. A recent study showed that 34 of the world’s most popular websites are already using it. 
HTML5. (2011, December 12). In Wikipedia, The Free Encyclopedia. Retrieved 22:00, December 12, 2011, from http://en.wikipedia.org/w/index.php?title=HTML5&oldid=465435877
 “Percentage of Web sites Using HTML5″. binvisions. http://www.binvisions.com/articles/how-many-percentage-web-sites-using-html5. Retrieved 21 October 2011.