From C++ to Android

I’ve been programming in C and C++ for the last years and I am willing to admit that it is the language I know best. For some time now I was wondering whether C++ is the future and if it was a good idea to progress in my developer’s career using this language. As many readers will know, C++ gives you great adaptability, but the development time is painfully long. Not that I have not developed in other languages. I did. My first experience with Python was absolutely overwhelming, I felt in love with it right after writing Hello World! Yet writing the first applications in Android’s Java is a experience I would like to share with you.

C++ Headache

If you are thinking that I’ve been living under a rock for not realizing the difference between C++ and other languages, you could be right. I’ve spend lots and lots of time learning C. There are so many possible ways to misuse the standard (and many developers happily do so) that I am really wondering that I’ve not kicked the language into its digital nuts and walked away. For months now I’ve not used another language (besides Python) to force myself using the only and legendary one. And it has helped, I now have the required confidence to call myself a C developer. One therefore easily forgets, that stuff can be done the easy way as well. Any C source written by different people uses different routines and misuses them in their own unique way. What followed, due to my lack of happiness C++ was offering me, is that I started cheating on it with mobile development. When it comes to usability and prototyping… Android is a Wonder Land to me. C++ surely does have libraries (and not only STL and BOOST), but those custom written are a pain. I’ve never seen a company intern C++ framework (the ones one usually uses) that would be likable. This is absolutely different with Android. You get in, watch a few tutorials and there you go! Ready to launch! I’ve been following the excellent tutorial on the Android web and was able to deploy my first app within one evening. Teaching Andoroid In the last weeks I was writing a pet application (and still am) to make my life at SSI Schäffer easier. The best way to learn a new technology seems to be solving a problems that bugs you and people around. In the post [-in writing-] I offered some insights into the motivation behind my pet signal processing app. And spending just a few evenings digging into the nuts & bolts of Android has been very rewarding. The amount of XML configuration is pretty high. And I must admit that I did not expect that. The good thing is that I am not an enemy of XML, which makes my development cycle with Android a bit better. There seems to be a tendency to move away from XML, therefore using it to define the UI was rather confusing. Since I started with Version 4.2 Jelly Bean the tablet support was already a well known part. I’ve been using a custom C++ framework for mobile clients that kinda adapts itself to the screen size. I should rather say: you hope that the universe is made of three display types ;). And guess what. It’s not! As for Android, I changed a few settings in the layout file and my app was ready to be shipped to tablets. It would take me days in C++.

It is a good rule of thumb to learn one language every half a year and one should not wonder that Java comes first. My goal as a programmer is and forever will be, to ship applications. C++ makes this insanely hard. I will rather write a whole post about stuff that bugs me (ifdefed includes included) than bloat this one. Yet after seeing the outside world, getting back to the daily routine is hard. I keep staring into newly written  C++ code and can’t stop to wonder, why somebody still uses circular buffers (in order to return a pointer to a local variable) and not the most basic object C++ has. Namely strings….

I believe that C++ is still viable for writing applications. Not only applications that have been around since the Triassic, but applications that developed from the scratch this very moment. Not that I have seen many… Making me focus on how to develop clearly distracts me from the what. And I want to stay focused on the problem. Solving it, is what is what makes me happy in the evening. Not unresolved externals. 

Every.single.word written in this post was written using a C++ browser. Let the flame begin!


If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.

Facebooktwittergoogle_plusredditpinterestlinkedin