Computer programming is what I do for my daily bread & butter. though a few friends have genuine(?) doubts that I work as a paid writer for Mouthshut;).
Now a techie writing about programming. jargons. 2-5 lettered acronyms like TCP/IP, HTTP, OOP. wait I will try to keep it simple so that even the most non-technical reader can get something out of it [especially if you are considering software as a career. despite the down turn:( ]
Programming is like writing recipes.
Now you start preparing your favorite dish.Let us start
1) List of Ingredients
Onions, Tomatoes. [ Types. Classes in Object Oriented Programming]
2) Select the real instances of these ingredients that are destined to enter black-holes . I mean tummies
Onion on1, on2;
Tomato tom1;
This is called Defining the variables of type [ or instances of objects in Object Oriented Programming ]
3) Prepare the ingredients so that they can be used in your recipe
on1= 25 pieces
on2= 24 pieces
This is called Initializing the variables
4) Mix the prepared ingredients in different ways
Garlic-ginger-paste= blend( 1 inch x ginger, 8 cloves x garlic)
These are called Operations(x. commonly written as *), Statements(whole line), blend() is called a Function. Ginger & Garlic are inputs to blend() Function. Garlic-ginger-paste is the output
5) Start the actual preparations
DO.(Fry onions) WHILE NOT GOLDEN BROWN
- Doing things over & over till some desired outputs got is called LOOPING
FOR 3 to 4 mins stir-gently for every minute
- Doing things a fixed number of times in small steps is called LOOPING THROUGH AN INDEX. stir_gently doesnt actually produce any immediate visible output. but does something. It is called a PROCEDURE
[Functions that do some work & return visible results. Procedures that do work but without visible results. together are called MODULES. and the process of defining them is called MODULARIZATION more politically in-correctly known asDivide and rule]
6) Some last touches here & there.
IF food_is_to_hot_n_spicy THEN
=> preparation= preparation+ Water
=> IF still_spicy THEN
=> preparation= preparation+ tamarind
====> IF still_spicy THEN
========> preparation= preparation+ sugar
====> ELSE
===> DO serve_the_dish
[ Note: ==> is to prevent MS formatting from going crazy:(]
These simple logical steps are called CONDITIONAL BRANCHING [ in the secret language developed to keep our well paid jobs:)]
7) Testing it on Hubby/Wifey dear or whoever is your favourite unsuspecting guinea pig.
This is called SOFTWARE TESTING in software parlance. Now if your victim holds his/her stomach in pain, or runs to you-know-where. it is called BUG REPORTING. Try a few more changes & present it again. this is called developing the NEXT VERSION
8) If recipe is good put it on paper.
In software-se it is called DOCUMENTATION. Tid-bits scribbled here & there to help next time are called COMMENTS. But programmers being ahem. excellent Sanjeev kapoor type cooks, we never like to write down these recipes or else write them in Elvish, Vulcan or some such outlandish language. so that they cannot be used by other mortals [ after all we too have an a*s to save;)]
This type of step by step programming is called SEQUENTIAL PROGRAMMING or PROCEDURAL PROGRAMMING
[ computer languages C, COBOL, FORTRAN belong to this category]
When your cooking becomes a disaster?
This type of cooking [programming] is good for preparing simple dishes for a few guests. but if you have a 100 guests or preparing an exotic 5 course cuisine. more likely than not you will have a disaster in hand [ Softwarese: Handling Complexity]
So you go to a hotel [outsourcing] or get food from outside [ third-party software, OOB(out of box) software]
Or you can use some magic. OK let me give you the magic word without much Ado. It is ABRACADABRA.[ called VIRTUAL POINTER TABLE or v-table in softwarese]
Now say ABRACADABRA [ just believe in it totally;)] and give orders to your ingredients [ softwarese: dispatch messages to object]
ABRACADABRA get-chopped ==> Tomatoes
ABRACADABRA get-sliced ==> Onions
And. voila Onions slice themselves, tomatoes get chopped on their own. scenes from100001: We work no more:)
But behind all this Hogwarts show. there is a FX [special effects] department at work [ softwarese: COMPILER] which converts these magical incantations into a reality.
This is the latest(?) fad in programming called Object-Oriented Programming [OOP]
[ C+, Java, C# languages belong to this group]
Now if tomatoes knew how to chop themselves, onions to slice themselves. they could be used in any recipe without requiring any work on our part or knowledge of how to use them [REUSABILITY]. as long as we know the right incantation
But as cooks we neednt know how these things work & do we care:) [ ENCAPSULATION, INFORMATION HIDING ]
Now taking this further someone developed CHOP-VEGETABLES mantra. the moment you recite it all vegetables chop themselves. carrots, capsicum, beans. whatever the only condition being it should be some vegetable . and not your boss [ INHERITANCE, POLYMORPHISM ]
Funny thing being despite the hype. the actual work is still done behind the scenes step-by-step [ PROCEDURAL]genies calledObjects which are gifted by Elves [ senior programmers ]
Now dont we wish. sigh. cooking were as easier. And yes. you are right. Object Oriented Programmers are often calledWizards for knowing & guarding so many secret magical hymns.
So now you know how to program. You just need to know how to write a few recipes & learn some magic tricks. and you are all set to conquer the IT World.
Programming Miscellanea
If there are lots of guests & lots to cook. you can ask your spouse, siblings or friends to help. and things move faster [ MULTI-THREADING ]. but rememberToo many cooks spoil the broth
Now you are fighting for TV remote with your Bro/Sis. now your Pop or most likely Mom will decide who gets to watch the TV [ THREAD SYNCHRONIZATION, SEMAPHORES, MUTEXES ]. so that at least one TV program gets watched in full.
But too many kids [ Threads, mutexes] . even Mom [ OPERATING SYSTEM] will be exasperated trying to schedule TV viewing [ RACING, STARVING etc;)]. so followWe two. ours two. [ KISS=Keep it Simple Stupid]
After preparing a gooey curry. you garnish it wish Cilantro, spring onions, Pudhina(mint) leaves etc. etc. [ GRAPHICAL USER INTERFACE= GUI ]
Your codes awaited. Please Hack. I mean leave comments