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")("baz"); 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.

Tuesday, March 4, 2014

Penang Sungai Dua in One Shot

It is been a while that I have done photo shooting (personally, I won't call it photography because I am still lack of the professionalism). I still remember the days back in diploma study in Kuala Lumpur, I walk around taking shots with a Nikon Coolpix digital compact.

Nevertheless, recently I have purchased a digital SLR, which I reckon as a good investment for nicely done photoshooting, and perhaps to build my interests and skills in it :p

This is a preview of a shot of Sungai Dua in Penang Island. And perhaps this is a time to revive my DeviantArt account. I would appreciate if readers would view the image in DeviantArt. Thanks a bunch.

Once Upon A Night At Sungai Dua by temporary40 on deviantART

Friday, February 7, 2014

Scattering of Light and Earth's Shadow

Once I watched a video about the wonder of teaching physics, it amazes me how the simple matters in our life can be explained in physics.

Why does rainbow forms and why the sunset is red; are some questions that can be simply explained to children, but somehow, the underlying answer can be so much interesting.

Professor Walter Lewin in this lecture [link] talks about all these.

But this is not the matter I would like to talk about.

I was fortunate to board a plane that flew during the hours of sunset. The experience was amazing.

Scattering of light

The picture above shows the phenomenon of light scattering. Light which comes from the sun is white. And whenever it hit a particle, the light will scatter. The chances of scattering are dependent on the wave length. Blue light has the highest chance. Therefore, this is reason we have blue sky.

The section in the middle of the picture has white-reddish color. This is because, the sun is very low in the horizon, and because the amount of air is massive, all the blue lights have been scattered off. Thus, we have red sunset.

Earth's shadow
This is also another phenomenon caused by the Earth being round. Parts of Earth casts shadow on itself, creating this wonderful image.