Book Read : The Practice of Programming

I read a book. Complete. End to End.
It is in my morning travel time, thanks to the 17 kilometers I need to travel everyday one side, increasing my carbon footprint(or is it natural gas?), that I have started to devote time to reading.

I have access to a library that boasts of some timeless titles.

I can quote just one part from the book that I really liked.It refers to the ways of Debugging-Explain your code to someone else.
It states:
“One university computer center kept a teddy bear near the help desk. Students with mysterious bugs were required to explain them to the bear before they could speak to a human counselor.”

These precious gems are already jotted down by someone who likes this book here.

What I would want to put across here is the quote which the authors have chosen to convey the essence of each chapters:

Chapter 1 : Style

It is an old observation that the best writers sometimes disregard the rules of the rhetoric. When they do so, however, the reader will usually find in the sentence some compensating merit, attained at the cof violation. Unless he is certain of doing as well, he will probably do best to follow the rules.

-William Strunk and E. B. White, The Elements of Style.

Chapter 2: Algorithms and Data Structures

In the end, only familiarity with the tools and techniques of the field will provide the right solution for a particular problem, and only a certain amount of experience will provide consistently professional results.

-Raymond Fielding, The Technique of Special Effects Cinematography.

Chapter 3: Design and Implementation

Show me your flowcharts and conceal your tables, and I shall continue to be mystified.
Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious

-Frederick P. Brooks, Jr., The Mythical Man Month.

Chapter 4: Interface

Before I built a wall I’d ask to know
What I was walling in or walling out,
And to whom I was like to give offense.
Something there is that doesn’t love a wall,
That wants it down.

-Robert Frost, Mending Wall.

Chapter 5: Debugging

b. A defect or fault in a machine, plan, or the like. orig. U.S.
1889 Pall Mall Gaz. 11 Mar. 1/1 Mr. Edison, I was informed, had been up for the two previous nights discovering ‘a bug’ i his photograph–an expression for solving a difficulty, and implying that some imaginary insect has secreted itself inside and is causing all the trouble.

Oxford English Dictionary, 2nd Edition.

Chapter 6: Testing

In ordinary computational practice by hand or by desk machines, it is the custom to check every step of the computation and, when as error s found, to localize it by backward process starting from the first point where the error is noted.

-Norbert Wiener, Cybernetics.

Chapter 7: Performance

His promises were, as he then as, mighty;
But his performance, as he is now, nothing.

Shakespeare, King Henry VIII.

Chapter 8: Portability

Finally standardization, like convention, can be another manifestation of the strong order. But unlike convention it has been accepted in Modern architecture as an enriching product of our technology, yet dreaded for its potential domination and brutality.

-Robert Venturi, Complexity and Contradiction in Architecture.

Chapter 9: Notation.

Perhaps of all the creations of man language is the most astonishing.

-Giles Lytton Strachey, Words and Poetry.

No doubt, the book needs to be read again atleast twice to imbibe by its sayings.
A similar java specific list can be found from Effective Java.

This is something to get used to and keep with oneself always.

The New Service Layer Architecture.

I have been associated with 3 major softwares that were developed for corporates and large businesses. In each of them, I had seen somewhat common layered architecture where either a facade layer exists for the flow or did not.One of the three architectures had a dedicated facade layer on top of the service/business flows. Incidently it was the only application that was designed for the web.

That could be the reason where the architect might have envisioned mashups of business objects that might be requested from the client side.This decision seemed to be motivated by the controlled requests coming from the web vs the uncontrolled calls on a desktop application.But then, the speed with which the desktop applications have also started gaining back popularity since the past couple of years, it might not be incorrect to assume that the architecture of a web and a desktop application should overlap.The desktop applications are becoming more and more responsive and with an expert user the desktop application demand more challenging screens as compared to web applications.

It is with these understandings I propose the following layered architecture:
The core difference lies in the way the business service calls are divided into two sub layers namely:
1/Facade layer.:: Responsible for mashed-up/secondary business object screens.
2/Business Service layer.:: Responsible for manipulation of core business objects screens.

The process layer calls can go directly to the service layer and also can talk to the facade layer also.

For example, consider the problem domain of bicycles, where we are writing an application for selling of bicycles.

For the initial iteration, the service layer would be enough to cater to the needs of operations like getting a quote of bicycle from different sources, getting different color models, different frame sizes etc.

Later on the application owner might want to move to custom built bicycles where the complete bicycle is not the single object that is passed across the process and service layers, as wheels, frames,handle-bars,seat-posts all start bringing in different compositions for the custom build bicycle.
In this scenario, the facade would be a great place to assemble different parts of the bicycle bind them together and return to the process as the complete bicycle object.
Even later on when the bicycle sub parts are further broken down like the wheel composition can give multiple options to choose from, this structure can be extended further.

Some might argue that the facade layer can exist at the same level as the service layer. Quite true, but over a period of time when the service layer gets fat with lots and lots of business specific code being written, the objects that go in and out of this layer becomes unclear, as to the core set of objects around which the whole application revolves. This loss of focus from the core objects of functionality can result in a loss of a perspective in writing new code/flow for the application, the consequences of which can be differently dangerous in varied scenarios.

To conclude,I like this layout because:

1/ It keeps a unique object being passed across layers.

2/Multiple Do’s and Do not Do’s from design perspective get constrained for the developer.

3/Gives greater and cleaner objectivity to the flow of the objects in the complete application.The service layer can be controlled as one that caters to core business and the one that is responsible for supported objects.

4/Easy refactoring capabilities and pluggable architecture.

Is it fair to partition the service layer on primary objects?Does it limit the growth of the application(and business itself)?

What do you think?

The agile India Scenario

The extreme programming wave initiated by Kent Beck et al in 1999 and since then the mature world programmers have embraced that change. A lot many clones started from that movement like agile itself, and the much widespread like scrum and lean.
Although these methodologies(or approaches?) had existed since long time, I remember reading somewhere that motorola had these practices in place since the 1960’s.

Flash-forward to India, I do not know who or when was the first project here was done with the wisdom of sound agile practices? But since I stepped into the professional way of writing software(means I was paid for what ever I did or did not), I was fortunate to see a genuine mix of these practices from the very start.Moving on to different software vendors, I notice that India per say is yet to embrace agile in spirit.

I do not travel at all, but looking around the small sample of professionals(incl self claimed agilist’s) I am dis-heartened to say the least, when I see my self surrounded by a lot of certified SCrUM(pun intended).
No doubt it has made its mark and helped realize XP too, ever since I got to know about XP, I had(still do) predicted the end of the software manager(with MBA) as a career.
The point that I want to make across is that these managers have misused the insights from agile practices to abuse the Indian developer. I have seen(and heard) *only* Indian managers who have been doing this to their Indian counterparts.
I dare say if they are given a mix of developers from different geographies, they would not do the mistake of exploiting more work in lesser time.
That is like a blind person blessed with more powers.

That being the problem around how do I( or we?) as the Indian developer in the clutches of the Manager (with MBA) cope with it?

Ahh! Its a complex mix out there.There are managers without MBA also.
Need to get back to the drawing board and start afresh!

Overloading in C…..? ..Its possible…..

hi everyone..

since we started studying C language, we have been taught that method overloading is not possible in everyone, even I believed that..
But yesterday I learnt that it is including a header file named STDARG.H.

This header file lets you create variadic functions.i.e. functions with variable arguments.
To perform method overloading, you just have to include this header file and declare a function which you intent to “overload” or provide variable inputs.

return type function-name( datatype1 arg1, datatype2 arg2,…);

Note:- the last 3 dots in the list(…), this is the one which tells the compiler that it would be taking variable arguments. It is mandatory to include these 3 dots(…) else your function would not accept variable inputs.

You can make a function which accepts same typed arguments or different.

The procedure to be followed is as follows:
1. you need to declare a variable “va_list” for iterating through the variable list.
2. then use macros like “va_start” – to start iterating through the variable list va_list.This macro takes two arguments. First the variable with type va_list and second is the name of the last argument given in the list. In the syntax given above , it would be arg2.
3. va_arg- to retrieve an argument from the list. In this macro you need to provide two arguments. First bariable of type va_list and second is the datatype of the next argument to be fetched.
4. finally, va_end macro- to find the end to the variable list.

Its really fun to work with this feature of C and perform a function which was said not to be possible in C.

This was just a jist about the header file and its macros.

Happy C Programming..!!!