Saturday, February 28, 2015

Object Orientated Programming


Digging a bit down to the history of Object Oriented languages, I found a phrase that summed it up: 'It's all about the network!'. As Internet grew, OOP grew alongside. While going through the history of rise of OOP, I came across something that I think is useful to share it here. Java was the earliest of the languages based on Object Orientation, and the fact that it led to be so successful was that it could change how a HTML webpage worked drastically. With the oncoming of Java applets, we could now move from a static (and a boring) webpage to a dynamic webpage with tons of added functionality.

Now, the big question still remains open, 'What is Object Oriented Programming?'. Before OOP, the codes were basically a long chunk of a single-piece code. You could add functions but the whole logic and data was bundled as one which was less modular and flexible to work with. In an object oriented program, you can have multiple self-contained objects which could each work as mini-programs coupled with each other to serve at the bigger picture. Each object can have its own data and logic, which may sound confusing at first. But, actually this let's you to simply work over objects as you do in the real life. (It's a Lamborghini, and it's a BMW. Both are cars, yet different objects)

OO is an idea that used the concept of Classes and Objects, just as we use them in day-to-day lives. Classes give you the blueprint or description of anything that actually does not exist. They define attributes and behavior. For a class mobile, its attributes maybe its size, OS, brand and many more whereas its behaviors could be it's functioning to provide a call, capturing images via a camera etc. Commonly, attributes are referred as properties and behavior as methods. Objects bring out the abstract idea into existence. You can create multiple objects from one blueprint (class), and map or connect different objects to fulfill your needs.

OOP lays a better architectural platform to work over which reduces our chances to mess up where to put the required data and logic associated with it. Moreover, it gives you chance to bypass many things not being used, and makes it easier for the developer to go through correcting his more so-called 'disciplined' code.


Friday, February 20, 2015

Finally, it's Recursion.



While browsing through the internet, I came across this image, and thought it's worth a mention here! Calling the function inside it's own definition, did seem weird to me at the start. They concept seems understandable, but I would need some more practice formulating the idea into code.

As we went through some of the tracing exercises, it helped me out to analyze the working behind the code. It was exciting to break down the code and realize how it splits into smaller bunch of problems and goes on doing so until it reaches to a certain result. There were multiple examples in the lab exercise which really helped to get grasp of tracing different kids of function. After going through them, it wasn't really hard to notice that, that each function involves some-sort of a pattern and an edge case. We need to encode that pattern and merge it up with edge case to make our function properly.

It is definitely a clever idea and  I hope in the next few classes, I can more ably understand the deadly-recursion. 

Saturday, February 7, 2015

Inheritance joins my CS family


Interesting. This is what CSC148 seems after a solid base by CSC108. The course CSC148, technically, maybe just the next step, of its younger sibling, but the matter-of-fact is, it's a steep leap. A leap which provides you the perfect platform to explore, and code.

The first four weeks have gone in a jiffy, yet have been full of some-next level concrete basics for starters like us. Inheritance being the prime focus, was tackled calmly. The concept behind inheritance has been to bring the programming world as close as possible to the dimensions of the real world. It's not a concept we 'need' to understand, we have lived in a world segmented by 'Classes and its Objects', we now just extend our arms to break the bridge between an objectified world to humanly-defined objectified computer science. Sounds so complicated, but makes our lives so easy. Being humans, you can passionately code when you can analyze the real-time scenario, and understanding it by the concept of inheritance makes it lot easier and amazing.

I liked the way Prof. Heap explained us the relationships between the classes and the objects, especially via his example of the shapes. It was easy and clear-enough to get an idea of the concept. Moreover, I really liked the well-framed lab exercises as they helped practically visualize what's been taught in the class. Discussing through the tiny details and sketching down the Pseudo-code with my group members for the Assignment 1 was itself a great joy. Starting from scratch, and getting along a few hundreds of lines of code, isn't a common site for us (Times are changing). I'm looking forward, rather excited about what's to fall in our laps especially with the famous-Recursion-topic coming soon!