Thursday, October 04, 2007

Breaking Winds Of Software Development

It is horrible. I am concerned about what are we going to do with software development from what I got to see during last week.

Look I will be frank. I am a mediocre programmer. Further programming doesn't stir anything inside me, once upon a time it used to do, but not now.

But even then one is immensely annoyed at the all around display of clueless behaviour which results in bad problem solving. Here follows broad instructions.

1. Problem Setting: Problems are intended to test skill of programmer to provide solution for real life scenario. Now it does make the sense to formulate the problem in a way so that robustness, flexibility, scalability, extensibility etc could be tested. However being general is different from being vague. Ultimately a problem is clear in its intent therefore it is possible to arrive at solution without assuming conditions which are grossly extraneous to the intended problem space. Vagueness give rise to unsatisfactory solutions which give bad feeling to the trainees. It also tells that the problem setter overestimates his intelligence and also is clueless in reality.

Be clear about your intentions while setting problem.

2. Problem Solving: We do know about plugin whore, but there is more of whoreness than we can possibly imagine, yes there is such a thing as being a pattern whore. The first step to solve problem, is to understand what the statement is all about. Which means to understand the requirements and constraints. To start pillaging the patterns without even having understanding based on a superficial reading is not the solving. Surely if members of gang of four were to encounter such a display of debauchery they would commit sepukku in horror.

Understand the problem statement.

3. Solution Discussion: Taking pleasure by inconveniencing others is human nature, but it is no excuse to be a moron. Specifically when you interrogate a solution for extensibility, flexibility or scalability, the extent of interrogation is limited by the domain which is specified implicitly or explicitly by the problem statement. For example if the problem statement is about devising a training scheduler for employees, don't analyze solution by attempting to applying it to other HR functions, it may or may not work, I mean what next ! Criticizing Jagadguru for not fitting monkeys with wings ?

Control your feelings.

# Bonus Wisdom

A. OOPS : Objected oriented programming (OOPs) is not about using the features that enable OOPs. It is about approach to problem solving. OOPs solves the problem by attempting to abstract the data and operations performed on data in terms of objects and their interactions with each other and the execution environment. This differs from procedural programming
which is about arriving at solution by strictly concentrating on steps through which solution could be arrived at.

Example: This is not OOPs

int x1,x2,y1,y2;

//Do initialization

int x3,y3;

x3 = x1 + x2;
y3 = y1 + y2;


Neither is this


int a[],b[];

//Do initialization

int c[];

c[1] = a[1] + b[1];
c[2] = a[2] + b[2];


Or even this !

class Int
{
public:
int i;
};

Int x1,x2,y1,y2;

//Do initialization

Int x3,y3;

x3.i = x1.i + x2.i;
y3.i = y1.i + y2.i;


This is OOPs

class point
{
public:
point add(point b);

protected:
int x;
int y;
};


point p1,p2;

//Do initialization

point p3 = p1.add(p2);

And for heaven's sake collection classes are not really OOPs !

9 comments:

Anonymous said...

Sad but true. I have been interviewing guys for the past 2-3 years and in my opinion there is more emphasis on form than content recently. Being one of the faceless thousands who work for the big companies robs you of the pleasure/experience of solving something end-to-end, however trivial it be. Guys usually have a larger idea of the product/service they work on, but when you drill down to specifics, they usually flounder. Just the other day I asked a guy to guess what could be insdide the hawkeye system. He said the batsman's position at the time of the delivery is an important parameter to take into account to predict the trajectory of the ball. I cant fathom how.. may be he is super smart that he takes into account the atmospheric distortions around the batsman to predict the ball movement.

doubtinggaurav said...

May be he was not familiar with the what hawkeye does. Even though I am not familiar with the system as I dont watch cricket, shouldn't the relevant parameters be speed, spin and position of seam ??

In The Shadows said...

Gaurav,

Why would collection classes not qualify as OOPs ?? They do give you an abstraction of a container of objects, dont they ?

In fact, I think there could not be a better example of OOPs in action, than collection classes.

The collection classes and Math package of Java were designed by Joshua Bloch (read his excellent book on Java tips) . Is it the case that the collection classes are so well programmed that you dont feel like OOP has been enforced ? I think when you say that collection classes are not really OOPs, you are giving immense credit to the designer of the collection classes (WRT Java)

Generally, programmers whose learning days are about 5 years ago, learnt OOPs after procedural programming, and many of them continue to approach problems procedurally for quite some time.

It takes time to break the practice. You really need to be a good procedural programmer to come out of it. In the sense that, the whole purpose of procedural programming is to break down the program into functions/subroutines which may be called from more than one points in the code. That knack... That knack of breaking down the problem is important in OOPs.

In The Shadows said...

WRT My last paragraph in my previous comment..

If I think about it, I may be approaching it in a roundabout way.
I still do at my workplace !! After some time, one starts using OOP directly.

Well, I blame my university ;-) I learnt OOP after PP.

doubtinggaurav said...

Shadows,

I was not clear enough what I meant was merely using collection classes doesn't mean that you are using OOPs, to qualify for OOPs the whole problems should be modeled in terms of objects and its behaviour, and as much as possible data and implementation should be encapsulated with only interface exposed. Finally I would prefer that object can be mapped to some entity or concept in the problem domain itself.

Reg PP vs. OOPS. I guess you mean we are taught C prior to C++. This is true. However I believe OOPs is easier to learn as it corresponds to how human perceive the real world in terms of object and its behaviour. The problem that I see is people do not go systematically about solving problems.

Just a matter of taste I guess.

Anonymous said...

He did know about hawkeye. I mean what it is used for and all that. That was my preceeding question. Even I dont know the correct answer but I know that a batsman's position is immaterial, because you are trying to predict the course the ball would have taken if the batsman were not there. Speed, spin and seam position are no doubt, relevant, but in that case you are looking at computing the entire course of the ball. Easier approach would be to predict the x,y,z of the ball at time tn by taking into account the x,y,z values at times t1, t2...tn. Based on how wrong your predicted xyz at tn are compared to the measured xyz at tn, you have to revise the formula to accomodate the error to predict t(n+1). In short, if you had learnt communications engineering, it is like an adaptive filter.

Regarding your container classes example, I see most people using toolboxes/APIs as is without even bothering to look what the toolbox does. To cite another example from my personal experience, a guy said that his project involved computing exchange rates for various currencies and updating the clients (he was from an investment banking firm, a software engineer though) and hedge fund managers. I was curious to know how the exchange rates are computed and he explained everything from acquiring the data to data presentation but kept the exchange rate algorithm as a black box. He had no clue what it contained.

Ritwik said...

Sriram,

1) Am not too sure about Hawkeye but I think it is a simple projection into 3-d space by taking two points (snapshots of the ball's motion) at diffrent times and using the time differece.

2) Don't blame the I-bank software guy. If he knew the algorithm to used to calculate exchange rates, he would have been in I-bank trading strategy and been an exper in stochastic finance, instead of being an IT guy. The only IT guys who who know any REAL algorithmic stuff are the ones who code for the computers that run proprietary rading algorithms. These jobs are usualy career jobs, and the knowledge is proprietary and secretive.

Ritwik said...

In fact, to be more precise, exchange rates are determined on a macro level by central banks of governments, and the exact process is one of the most closely guarded official secrets - cenral bank givernors often joke that they may be shot dead if they ever reveal this info.

Exchange rate determination in the short term (over a day or a week of trading) is determined by market demand and supply (for floating exchange rates, not fixed ones) and the algorithm of 'exchange rate determination' that the IT guys was speaking of must have been the exchange rate AT which it is beneficial to buy/sell for the client. The algo, like I said, would involve advanced stochastic finance concepts, and moreover, there wouldn't be any one algo. For different markets and different currencies, the algos are different and are determined/known by the trading and strategy team.

doubtinggaurav said...

Sriram

Your explanation seems more plausible, I guess it would be difficult to measure spin speed etc even with multiple cameras.

Regarding container class while you said is correct my point was more technical collection classes are just supposed to contain the data and somehow I don't think they are the best examples of OOPs rather I take them as example of ADT (Abstract Data Types)