Pages

Thursday, October 30, 2008

Levels of programming, based on design principles.

Just a small writeup based on the programming design style, that I commonly come across with various programmers.
To give some context, let's take an example of creating an object called car (automobile).

Level 0 programmers are those who think, writing more common code is better and generalize them in to static methods that take numerous parameters.

public static void CreateACar(Engine engine, Color color)
{
//rest of the code here;
};

The problem is if the car needs to be created with a new property like sedan/coupe, then a new parameter needs to be added and this keeps growing. If the arguments grow then they add a structure to encompass all these arguments and pass them.

The next level of programmers are those who treat each of attribute of the object as it's property and create a class like the below:

class Car : IAuto
{
private Color color;
private Engine engine;

public Engine Engine
{
get
{
return this.engine;
}
set
{
this.engine = value;
}
}


Public IAuto CreateACar()
{
//rest of the code;
}
}

The above code works great, even if there are new parameters to be added. It is as simple as adding new properties and verifying them before creating the car. But some assumptions have to be made, say this car runs on a "road" and the car creation assumes the road to be some type (could be Enum) and ties the object to it. What if the road's condition changes and a car that code run while creation cannot run all the time on the road. Some cases/scenarios while creating the car is missing and it does not cover all the situations. This is what happens when the object is strongly tied and has lot of properties.

The next level of programmers are for making functionalities atomic with individual classes and then tying them together based on the scenarios or rules. The rules defines what goes in creating the car object.

say it could be class Road, class Car, Interface IAuto etc.

Looks like more classes that has smaller functionality. Yes, exactly these are all small dumb classes and are atomic. But when combined with the rules and scenarios that change time and again, they come in handy as they are very flexible and requires less change.

Take the .NET library, it exactly fits the last design model discussed, more dumb classes combined together giving a great flexibility and power for creating more applications.

This is a followup of my initial design post - http://globalhandler.blogspot.com/2007/05/software-design-goals-and-philosophies.html

Wednesday, October 15, 2008

Brain Threa(t/d)s - could be read as threads and threats!

This post is about controlling the brain to send neural waves to perform a desired action. This is not something new, but here are some unwinding topics.

Thought control headsets are used in virtual worlds for gaming. These headsets pick the brain signals and transform them in to actions.
Now let's see how can the same be put in to use in a real world.

There are numerous tests going on to identify, how the actions derived from the brain signals could be applied to the real world. In a virtual the environment is controlled, which means the actions are just simulation that is perceived by the users. Hence there is no real damage in the case of a ill action being performed. But in a real world the game is different things are real and the actions carried over will have real impacts. The human brain is known for its humongous parallelism. So how does this parallelism help or affect the actions in a real system?

So what would happen, If anyone can get on to such a brain controlling system operating (in a real world) and perform the intended actions?

To give it a shot with a better example,say if some one wants to control car driving using the brain signals.
Well, there must be a system to take care of the mind vs body reactions (heart rates etc) and then apply the actions. Based on the actual brain signal the system can decide whether or not to perform the action, to control the ill effects. In any case you would need a controller for controlling the brain signals.

So this brings the question, Is the human brain not yet mature or over mature?
Does that also mean the human brain's thought(s) are indomitable?. I could just think of techniques like meditation that would help one to focus on the brain control and help achieve what is just intended in a situation throwing the rest away. Conclusion here is, taking the risk to perform the above experiment needs to start with in some controlled environment.

To illustrate the power of the human brain and it's parallelism, here are some facts:

http://www.merkle.com/brainLimits.html
http://www.dailytech.com/Visual+Circuits+Harness+the+Power+of+the+Human+Brain/article12478.htm
http://www.transhumanist.com/volume1/moravec.htm
http://www.livescience.com/mind/
http://news.bbc.co.uk/1/hi/technology/7254078.stm

Wednesday, October 08, 2008

Soon to be born, with communicator

It will be no surprise to see communicator chip(s) injections. These injections will be used to embed the communicator chip(s) to the human bodies. And everyone will be a cyborg. No later will the new born babies be injected with these chips along with their regular vaccinations.

This embedded chip will bring in features to talk freely in any language (there will be real time translation), no extra hardware for making calls. You just have to think, it dials to the satellite and connects to another human/chip. No more hassle of service plans from different providers.

Just thinking on what more could be added here...?