sábado, 29 de septiembre de 2007

Poor Alan turing

Today, poor software is blamed on Alan Turing's programming model.

Can we liberate from Turing? (In the same fashion as "Can we liberate from Von Newman?")

Actually Alan was trying to demostrate mathematically that using simple tricks like a tape in which you can write characters in it, you can compute any mathematical function. Period. That's it.

Your bugs in your system are yours, not Alan's. Alan was not promoting that you used just one tape and just one head to read and write it, which would be the equivalent of just one RAM and just one processor.

This guy even have a black list of people you should not read in order to get reliable software.

I agree with him, but I think this deserves an explanation.

First, i would not black list people because they make a mistake. It woudl be as blacklisting developers because they introduce a bug. That would be ridiculous.

Also, Louis Savain also makes a mistake: he says we software developers can't for sure test our designs and our code. Of course we can! We can do prototypes and we can use JUnit, respectively!

Prices

Have you ever wondered why managers make tons of money and why individual programmers make so little?

I have a possible explanation to that: In any company there are more developers than managers. Of course this doesn't explain it, because there are also less janitors than developers and janitors make less.

Another possible explanation is that less people are willing to be janitors, therefore people who work as developers have to prove that they can code, so this would explain why janitors, having less mental capacity (or training), would have to accept less well paid jobs. But it doesn't make sense shen it comes to managers, since managers are probably the dumbest, the most demoralizing individuals who can't plan in the following 3 months. Most of the time they ask you to do the plans and then they simply shorten the schedule in half.

Also managers are the most prone to do copy and paste, adding really no insights neither in the business knowledge nor in the technical knowledge. They simply make people hate each other and compete, so that they can get all the benefits.

But why do they make more?

Maybe their inclination to lying, with a straight face, makes them more interesting to upper management.

What does managers' wage have to do with Poor Alan?

I have yet another theory of why managers make more.

Managers are the most damaging people in an organization. If they don't harm the company, they certainly can damage it.

And upper management knows this.

Therefore, managers have more bargaining power.

They typically know what to tell people in order to turn people against each other. I mean, they do it for a living, so they eventually know the tricks and with 3 or 4 words spelled in secrecy, they can turn the best firends in to the worst enemies.

And therefore they are brought to make people communicate and blend, but it would be unfortunate for them if people really blend together, since people must be fired when the project finishes, and therefore they have to outright lie to them telling people "there are so many projects" and stuff like that, while in reality "we just need you kid to fix this stuff and then good bye".

I've been working for more than 15 years, so I would say I've seen it all. What I have not seen though, is a manager that hires you telling you the truth: this is going to last just 6 months. No, they promess that their is an endless train of projects and you will work here for 100 years. Yeah, right!

jueves, 27 de septiembre de 2007

Each explorer windows in a separate process

"On NT, go to this key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer

and create a DWORD called DesktopProcess with a value of 1. This makes the desktop and Taskbar run in one process, and subsequent Explorer windows each run in its own process. This means that you can do your debugging with a single Explorer window, and when you close it, your DLL is automatically unloaded, avoiding any problems with the file being in use. You will need to log off and back on for these changes to take effect."

Nice!

Taken shamelessly from: http://www.codeproject.com/shell/shellextguide1.asp

By the way: COM, COM+, ATL COM, etc. seems to be moronic and painfully unnecessarily hard.

I mean, C is kind of moronic. C++ is like moronic++. COM is a totally different, a totally different programming model. While C++ was born as a better C and object oriented C, then it was "upgraded" to generic programming using STL (which is the equivalent of Java generics), but a very bad implementation, although I admit that it is way better than the original implementation using macros (#define).

COM is "component oriented programming". It says "object orientation is hard, therefore let us not try to use object orientation and use components instead". Components are simply objects that do not use inheritance and that have both runtime behavior and design behavior.

Why would we need runtime behavior and design behavior?

Objects in object orientation have only runtime behavior. In case you are designing a GUI, objects have to be put in a place and objects have to remember that when they are running. But objects are not running if you are coding the application.

At least they are not running in Java and C++, but they are running in Smalltalk, because Smalltalk has a different way to look at the world. Therefore in Smalltalk object oriented user interfaces use object orientation and it was like a charm.

But in our poor languages C++ and Java, developers came up with the moronic idea that we needed this thingys called components.

And holly cow!!! There is so much people totally numbed with the idea that "components" is the next big thing as if they were seeing the light of truth, but of course they can't explain why it is so great. They even mention the typical falacy ad hominen "if Microsoft, Sun and IBM like components, components must be good".

I find myself totally happy with the idea that people are wasting their lives while we people on the object orientation camp have totally mastered and fixed all the bugs and we live totally happy in object land, while all those loosers on the component camp are wasting their lives trying to make those trivial things and fail miserably. At first, around 1992, of course I thought we were going to change the world and we had to be on a cruzade to defeat the infidels. But the infidels are so strong and they waste so much money that we do, so there is no point on wasting any effort on defeating them. They are defeating themselves. Good!

Actually it is good that they spend so much time on irrelevant stuff. This way all that irrelevant people is out of the way for us to build the important stuff. And we can learn in 3 months enough to work as much as 10 years, actually I've been working for more than 15 years with what I learned on the first 3 months of object orientation.

And that's because object orientation is hard. And I don't know if that is good or bad, but at least if you take the time to learn, you will be able to work in the industry for probably the rest of your life without having to learn much (ok, languages change, frameworks change, but the original idea has never been surpassed).

Falling in love with the mechanism

It is typical of development projects that the developers usually fall in love with some particular implementation mechanisms and they repeat the same code over and over again.

When you look at the code all you see is the same patterns over and over again:

mechanism1
mechanism2
mechanism3
mechanism1
mechanism3
mechanism2
mechanism1
...

So in reality this developer has learned 2 or 3 tricks and applies them to no avail.

The only problem with this approach is that several days, months or even years later the developer learns that his tricks has a bug.

Either:

1. A programming bug,
2. A design bug (the design doesn't handle some important cases), or
3. An analysis bug (the requirements were not the correct requirements)

So we need to make some changes, but the code has been copied around in too many places and now making a change is too expensive... because we need to change the code in so many places and when we change the code in one place to fix a bug, we introduce 2 more bugs and we destroy what was originally working. Managers feel really frustrated when they find out this and they think it is better to hire more developers, since the amount of bugs is increasing instead of decreasing.

Inevitably developers think it is cheaper to rewrite the whole thing. Managers tend to think it is waste of time. Unfortunately both are correct.

Developers are correct because actually the mechanisms were buggy, so instead of fixing the same 10 lines of code during 3 months, you can simply rewrite the whole thing in 2 months using the improved mechanism.

Managers are correct because rewriting the same thing is only going to lead to missing cases being managed, they code will look correct but the code won't work as expected and we will wonder why did we rewrite the whole thing anyway. Something that took so much time to tweak, now it will be clean and simple, but it will not handle all the special cases. In order to handle the special cases, developers will have to tweak the code and therefore the code will become a mess anyway. If it is already a mess, it is for a reason, go with it.

So I'm saying both are correct and both are saying just the opposite. What gives?

If developers rewirte the whole system, they will throw away the old mechanism and write the new mechanism over and over again. They think the future will be better, and they are correct, but no mechanism is perfect. So eventually they will realize the new mechanism is also buggy, differently buggy, maybe a lot less buggy, but buggy anyway. so the correct answer is:

Developers have to write the intent, and the mechanism must be hidden inside a library (an abstraction layer), so that whenever something needs to be changed, it is changed at the library level (assuming the business intent was correctly explicited in the business code).

I will say it again in different ways:

1. Do not write mechanisms in your business code, but write only business intent.
2. Hide implementation details in libraries.
3. Create abstraction layers.
4. Write black boxes.