Feeds:
Posts
Comments

basic oo concepts

Is Java pure OO? Not exactly, since primitives are not implemented as objects. Smalltalk for example, is purely OO.

  • Abstraction:

- Extract all the common attributes and behaviour for a given set of classes and move them one level up and that will be your first level of abstraction.

- And so on.

  • Polymorphism:

Means different shapes. Yes, we have all heard that one before. We’ve also seen the example of Circle, Triangle and Square inheriting from Shape and overriding the draw() method often enough. However it all became quite clear to me only when I saw it like this:

A Triangle inherits from Shape and implements Drawable.

Triangle figure = new Triangle();
Object obj = figure;
Shape shape = figure;
Drawable drawable = figure;

Now notice that the same darned object, figure, can behave as a Shape, a Triangle, an Object or even a Drawable, all depending on the type of the reference variable. Impressive, huh?

(Also see: runtime and compile time polymorphism)

  • Inheritance:

- This one is quite simple. An IS-A relationship.

- Inherit non-private attributes and methods of a super class

  • Encapsulation:

- Grouping together of common functionality.

- Hiding of internal algorithms. Car.moveForward() will move the car forward. How the car implements moving forward is nobody else’s darned business.

- Only revealing the interfaces required to interact with it.

- Data protection, usually through getters and setters that will prevent data corruption.

- Prudent encapsulation = robust design = easy refactoring.

  • Composition:

- HAS-A relationship. Objects built or composed from other objects. Simple concept but with profound design implications.

If you haven’t already bought an iPod or are considering buying one, I would suggest you give the Creative Zen W Vision some serious consideration.

  • Much wider screen
  • Supports many file formats. You don’t have to convert everything you own to .mp4
  • Has FM radio and a voice recorder

Still going ahead/stuck with an iPod? Be prepared to spend a lot of time doing file format conversions. And go for the model with the most storage. Believe me, you’ll run out of space before you know it.

Convert Music:

  • AltoMP3Gold converts most common and some not so common audio formats to .MP3. Downside: Shareware. Only converts 3 files at a time in the free version.

Convert Video:

  1. Use PocketDivXEncoder to convert most video formats to .AVI.
  2. Then use 3GP_Converter or VideoraiPodConverter to convert the .AVI files to .MP4 for the iPod.

The good thing about these two tools is that they are portable and do not need to be installed on to a machine. Therefore, it’s a good idea to carry them around in your iPod so you can use them on the go.

Convert DVDs:

  1. Use DVD Decrypter to extract .VOB files. This tool is particularly useful if you want to retain subtitles.
  2. Follow steps 1 and 2 above with the .VOB files.

The above tools are mainly for Windows. Now that I have switched over to Linux, (Ubuntu Feisty Fawn on a 64 bit AMD Turion laptop) I’m looking into viable Linux solutions. Suggestions?

insider humour

A long time ago, I’d come across (in Reader’s Digest, I think) these :

Two atoms are sitting at a bar. One is looking really downcast.
“I think I have lost an electron”.
“Are you sure?”
“I’m positive.”

A neutron walks into a bar, asks for a stiff one, swigs it down in one gulp and asks the bartender “How much?”
Bartender: “For you, no charge.”

And I remember thinking to myself “How incredibly clever!”

Now, I’m a programmer and hang out with similarly feathered birds most of the time but I had yet to come across arcane quips from within the developer community.

No, Dilbert doesn’t really qualify. I’m thinking something absolutely nerdy and demanding knowledge of esoteric programming principles.

And then one day, at a seminar someone mentioned this cartoon he’d read:

C++ programmer to Java programmer, looking around the latter’s messy apartment: “This is what happens when you don’t clear out your own garbage.”

Suddenly, I’m encouraged. I’ll be looking out. Watch this space.

« Newer Posts