Pages

Sunday, October 12, 2014

A notion on C++ programming language

C++ is a programming language. It is very obvious to many people who are working in this field. Like many languages, they are used to write the assembly instruction that are executed to run many functions or applications.

What is different amongst programming languages are the feature that the language can provide. Like for example, C is a structural programming while C++ is object oriented. For example C++ is native, while C# has the strong bond to the .Net framework.

I do recently get to touch the C++ language in a more extensive way compared to previous years. As I touch more, the more I do not understand about the language and the usage model of the language. Bear in mind the rest of the scribbling here are more of a personal opinion and findings.

Yes, C++ is a tool where you had the less chance of stepping on your own foot. When when it happened, it explodes. Take for example to use of pointers. C++ is one of the language where you have to handle memory management in a careful way. Unlike C#, which is a managed language, C++'s memory handling are 100% dependent on the coder. One pointer get out of hand/leaked, it really jeopardize the whole software.

However, the advances in C++ really do take care about this problem. But in the language itself but rather the implementation of libraries. Take for example shared pointer, auto pointer, unique pointer, etc; they are not part of the C++ standard library. This rather gives a different perception on the C++ language.

And when you think you are familiar with the syntax of C++, then come some weird syntax when you read other people's code. One of the recent code I found amaze is from boost::program_options.

foo.bar().("foo")("bar")("baz");

...is totally a valid syntax. Never in my life I do encounter this syntax; concatenating parenthesis?

 Which now brings the topic of boost. I may not get exposed to many library out there, but boost is one of the libraries that bring a lot of my attention to it. For one, many of boost libraries get into the standard library, which make this one of the interesting factor.

Not only boost provides the functionality, it really revolutionize the C++ language. As the founder of C++ language says, C++ is a multi-paradigm language which supports objects, polymorphism and generic programming; boost brings this concept to use and brings it to another level of programming language.

For one, using the library is easy, but understanding the library usage syntactically would be a challenge. Like once I heard, boost is a library that lives on template magic and it is hard to use.

Another boost library that is noteworthy is Spirit. This library uses the operator overloading extensively to create a domain embedded specific language. In short, they create their own programming language from the C++ programming language. The programming language they created is used as a parser generator. In short, a coding that parses code.

In the end of the day, understanding C++ squeezes the mind. Not only it is multi-paradigm, they way the language usage can be extended to do so much more. And why I have the need to know? Who knows why.


No comments: