Articles written by Parakh Singhal

Object oriented Thinking

The title and subject of this blog post is a tribute to the pioneering course that I am attending at Coursera: An Introduction to Mathematical Thinking. The course is basically a transition course helping students coming from a high school mathematics background transition to university mathematics. So far I have attended two lectures and I must say the course is what I needed when I was still in school and planning my career. Such transition courses, the motive of which is not teaching the hardcore pure subject, or even the applied form of the subject, are the need of the hour, be it any field of science or academia for that matter. These not only help the prospective candidates prime up to what lies ahead, but also helps them evaluate if they are genuinely interested in the subject matter. The reason accurately put up by Prof. Keith Devlin is “For all the time schools devote to the teaching on mathematics, very little (is any) is spent trying to convey just what the subject is about. Instead, the focus is on learning and applying various procedures to solve math problems. That’s a bit like explaining soccer by saying it is executing a series of maneuvers to get the ball into the goal. Both accurately describe various key features, but they miss the “what” and the “why” of the big picture.”

The same reasoning can be extending to computer programming using the Object Oriented paradigm. Of all the learning, students and developers starting in the field of computer programming using modern object oriented languages do, almost all of it is comprised of learning the semantics of the language, and hardly, if any related to thinking in terms of objects. They then wonder about the various constructs available to them in a programming language, and how to use them but are unable to get a clear answer. The situation worsens by the fact that they are supposed to learn about the various supporting frameworks like .NET Framework for doing general programming, Windows Communication Framework (WCF) for creating services, Windows Presentation Framework (WPF) for making presentation layer, ASP.NET etc. apart from the technologies like SQL for data access etc. On top of that developers are always under the constant pressure to develop and deliver the applications in the shortest time possible, leading to a diluted learning experience all along the way. Some of the effects of this diluted experience are:

1. Having a theoretical understanding of advanced constructs offered by an object oriented language like C# or Java, but not a practical understanding as to where they can be used.

2. Trouble understanding the source code of well-constructed, well documented software.

3. The developer ends up creating code, that is hard to maintain.

When these developers come on to more responsible positions, they are not able to effectively lead and mentor the incumbent developers under them.

I believe that technical writers should also take upon the responsibility of including a short section on object oriented thinking before touching upon the technical semantics of object oriented language.

Majority of the developers get their first experience of computer programming in an object oriented language while they are in school. Due to questionable quality of teacher(s) available, they end up learning to use the language in a procedural manner, thus not learning the true nature of the object oriented paradigm. Recently, I was having a discussion with a colleague about a domain model and the kinds of design patterns that we could use to structure things, and he made a thought provoking remark, about how things differ in the Java and .NET world. He made the remark that a Java developer thinks in terms of objects, because of the way Java is taught and maturity of the developers in the Java world, while in .NET arena most of the developers think in terms of screens and the resulting code that can then support those screens. Most of the .NET developers transitioned from the VB6 (a non-object oriented language) and continued software development in more or less the same way in object oriented languages supported by the .NET Framework. Microsoft worked to make the transition easier by emphasizing on VB.NET (an easier language for someone coming from VB6 background) and developing technologies like ASP.NET Web forms which were event based and could be used without a strong understanding of object oriented concepts. Please bear in mind that I am not saying that Web forms are bad, it is just that they are easily misused (I myself am a Web forms developer). It is only recently that Microsoft has started releasing documentation centering around practices which emphasize organized object oriented development, rather than the traditional selling point of Rapid Application Development. Still I feel there is a dearth of simple examples in MSDN that educates the developers on how to develop applications in an object oriented manner. Still a lot of documentation only tangentially touches upon the foundational object oriented concepts. A lot of examples assume a very simple domain model work with the assumption of having a very direct correlation between the data and the object model, resulting in usage of Entity Framework in virtually every example. This further makes the learning from examples a bit harder than it ought to be.

Anyways, I hope for the best and believe that all .NET developers (me included) will learn about the basics of object oriented paradigm in the manner intended. I myself learnt about the languages and frameworks first and later on learnt about the true nature of Object Oriented paradigm and how to use the constructs of an object oriented language (C# in my case) effectively. I list some resources below that have helped me to learn about the object oriented paradigm and how to use the language constructs effectively.

1. Series on how to build layered web applications using Microsoft ASP.NET 2.0 by Imaar Spaanjars

2. Series on how to build n-layered web applications using Microsoft ASP.NET 3.5 by Imaar Spaanjars

3. Beginning C# 2008 Objects: From Concept to Code

4. The Object-Oriented Thought Process

In my next post I hope to touch upon a practical example of object oriented programming using Visual C# and using .NET Framework.