Feeds:
Posts
Comments

Code Rush!

Code Rush is basically a documentary about a group of engineers who are trying hard to release the Netscape browser (Mozilla) at a time when Netscape was trying hard to save itself by making the source code open to the developer community. It’s an excellent video. I love it!

The video is for about 55 minutes or so. It shows how the team almost literally lived in their cubicles, how every single hour mattered for them to release the browser and the source code and later shows the merger of Netscape and AOL and the disappointment of this team. Everyone in this team, well almost everyone, moved out of Netscape.
One of the key stars of this video is Jamie Zawinski. Not one of my personal favorites, among the Hackers I idolize, but I admire the man a lot for what he was during his time at Netscape. He is one of the all time bests among hackers! After Netscape was bought over by AOL, Jamie moved on to own his own nightclub, named DNA Lounge! Peter Norvig, in his essay Teach Yourself Programming in Ten Years, appreciates Jamie:

“One of the best programmers I ever hired had only a High School degree; he’s produced a lot of great software, has his own news group, and made enough in stock options to buy his own nightclub.”

The video is really good and in my opinion, it’s a must watch!

But I agree one of the biggest mistakes a company can make is to unnecessarily re-write the entire source code. Probably Netscape did this too. A lot of code, rich in functionality, can and should be refactored and not entirely thrown out of the window and re-written from scratch, unless refactoring works out to be more expensive than re-writing! There should be a well-evaluated, solid reason why one would decide to re-write the entire source code! Most people prefer to re-write code because; reading code is much harder than writing code! It’s probably similar to the human psychology, that we can understand our handwriting better than anyone else’s. I will write more on this later!

A quiet workplace is a boon for a developer. Most people ignore the simple fact that nothing great can ever be achieved without the power of focus….or I’d rather say, without time periods of prolonged focus. Hackers refer to this state of mind as “The Zone”.

It helps a great developer to hold the program in his/her head as they work through doing great work. If you’re in this “zone”, your mind is fully focused on the code at hand. You remember all the variable names, the reasons why each loop exists there, the functional flow…everything! Cultivating the ability to get into this zone is of paramount importance in order to do great work. As Paul Graham puts it very elegantly:

A good programmer working intensively on his own code can hold it in his mind the way a mathematician holds a problem he’s working on. Mathematicians don’t answer questions by working them out on paper the way schoolchildren are taught to. They do more in their heads: they try to understand a problem space well enough that they can walk around it the way you can walk around the memory of the house you grew up in. At its best programming is the same. You hold the whole program in your head, and you can manipulate it at will.

So, a quiet workplace definitely is very helpful. If a developer is completely in this zone, and one single distraction happens, that pulls his attention off even for 2 mins, it might take him even more than 20 minutes to get back into the zone. A constantly distracted mind can only think of “just-ok” code or even worse, bad & ugly code! Most importantly, the context of work needs to be reloaded onto the active mental workspace…ALL OVER AGAIN! Five such distractions in a day has taken off, or rather destroyed, 1 full hour of highly productive work! That’s why most great developers prefer to work late evenings/early mornings or even on weekends to get critical work done with good quality code. Why? Because there are far lesser distractions!

But we have to practice this “getting into the zone” almost every day to get better at it. The more we practice, the longer periods we can remain in the zone, which will make us more and more productive. Higher the productivity is… and greater the work satisfaction we will have!

StackOverFlow

Recently I came across this website called StackOverflow. It’s basically a fantastic arena where you get to post technical questions and expect to receive answers from some really good developers out there. In short, I found this as a great online space for technical discussions and loved this idea of some of the greatest developers coming together for some sensibly good technical discussion. This is by programmers and for programmers! Perfect feast for the code hungry! :-D

Many a times developers look for answers for some hard core technical problems they would be faced with. Googling out is fine, but most of the time we end up with scattered information and spending a lot of time narrowing down to the pages which can probably give us some useful information/answers. StackOverflow provides a single and very convenient platform for such technical discussions.

All you need is either a AOL/Google/Yahoo ID (any OpenID will work). You don’t even need to register to participate in discussions. You will just need to login and start participating…that’s all there is to it!

If you ever hear someone saying these words, you can be sure about one thing…that person has almost never done/tried to do a great & satisfying job in his life. We often hear people saying these words when something “seems” to have gone wrong with the code. Let’s be realistic…every great developer takes his work personally…which is why he/she is a great developer in the first place! Talent is critically important…but so also is passion towards work. Like Aristotle says:

Pleasure in the job puts perfection in the work.

People spend their vast majority of their times at work, in their cubicles, being away from their family and their hobbies and so forth. People do not suddenly turn into some sort of technical machines the moment they step inside the office & turn back into humans only when they leave office! You bet people take their works personally. If they don’t, then they are either on the look-out for another job or they are working just for money. Such people are rarely productive for long time periods. They can/would burst in caffeine-backed work and get out some good amount of work done but these will mostly be for short periods of times. On an average, their overall productivity would be quite low. Is that something that we need to be surprised about? I don’t think so, honestly.

A good developer takes his work seriously, takes pride in every job well-done, worries about the effects/side-effects his/her code might cause, work towards improving their skills so that they can get more productive. Think about it. Can you do all these without taking your work “personally”? I seriously doubt it! If you have a different opinion about this then please share them with me.

Take a look at the lyrics from this song from Billy Joel…

Slow down, you crazy child
you’re so ambitious for a juvenile
But then if you’re so smart, tell me
Why are you still so afraid?

Where’s the fire, what’s the hurry about?
You’d better cool it off before you burn it out
You’ve got so much to do and
Only so many hours in a day

But you know that when the truth is told..
That you can get what you want or you get old
You’re gonna kick off before you even
Get halfway through
When will you realize, Vienna waits for you?

Slow down, you’re doing fine
You can’t be everything you want to be
Before your time
Although it’s so romantic on the borderline tonight
Tonight,…
Too bad but it’s the life you lead
you’re so ahead of yourself that you forgot what you need
Though you can see when you’re wrong, you know
You can’t always see when you’re right. you’re right

You’ve got your passion, you’ve got your pride
but don’t you know that only fools are satisfied?
Dream on, but don’t imagine they’ll all come true
When will you realize, Vienna waits for you?

Slow down, you crazy child
and take the phone off the hook and disappear for awhile
it’s all right, you can afford to lose a day or two
When will you realize,..Vienna waits for you?
And you know that when the truth is told
that you can get what you want or you can just get old
You’re gonna kick off before you even get half through
Why don’t you realize,. Vienna waits for you
When will you realize, Vienna waits for you?

Oh Boy…we seldom find such profound words of wisdom spoken so well!!! I loved the lyrics!!

After reading this blog about using multiple monitors, I finally created such a setup at my workplace. I now have a Dell 17” LCD monitor and the monitor of my Dell Latitude D620 laptop. I must admit…it really helps! I have installed UltraMon for giving me finer level control over this multiple monitor setup. I liked the features that UltraMon gives.

After using this set-up of 2 monitors for the last 3 days, I understand the importance of having multiple monitors. The viewing space just increases to a good extent. It’s as simple as that. The more you can see the more content you can load onto your mind and analyze.

Not only does this multiple-monitor setup give you the ability to view more content at a time, you can also “group” windows onto separate screens. For example, the larger screen can have only your IDE, DB tool window, and your application and the other (smaller) window can have your Outlook, Winamp, Bug tracking tool and all such “less frequently” accessed stuff. So that, you can get to focus on your code and not be distracted by a humongous number of windows open in your task bar!

Ability to see a lot of content certainly helps you in your effort to “hold” a lot of data in your mind’s “RAM” area. This is very important for being able to do productive work. There are some important steps that can help you towards this but…having a larger monitor-space definitely helps! These have been explained really well by Paul Graham in one of his essays.

So…multiple monitors are great to use and they are really useful!!

24 Season 7!

I recently finished watching the entire set of 24 episodes of 24 – Season 7! The ONLY single thing that I can say about this serial is that…IT ROCKS! There is not a single dull or boring moment right from the first minute of the episodes right till the last minute!

I actually like Season 4 the best. The way the planning was structured was simply marvelous! And of course, the technology used is fantastic (though I have my own doubts about how much of those colorful software and screens they show are real! :-D ). There is a lot of common sense displayed in the dialogues and sudden turn of events are simply too well designed to have any flaws…while you are watching it that is! But after you are done with the entire set of 24 episodes, you can obviously point out the loop holes in the story line :-D

But, overall, the entire series of 24, all seasons, are simply TOO awesome and I simply enjoyed every single minute as I was watching them! Can’t wait to see Jack Bauer back in action again in Season 8!!

There is so much of knowledge in this world. Almost infinite?…and many of us would secretly eel…frightening? Ofcourse, anyone could probably be scared by the amount of vast knowledge that exists in this world. But to be good (or for that matter, even great), we need to know only a tiny bit of this whole chunk! Because, no matter how much we know, there is still almost infinite knowledge left out unknown to us.

I recently read this blog and was just trying to figure out how many of these books I have with me! :-D Lol! I work on J2EE so I can conviniently skip out all of the C# and .NET books. The rest of them are real classics. I am especially a super-fan of the book Code Complete by Steve McConnel! I’m thoroughly convinced that this book is simply a must read for every single developer!

It’s very important to know how much and what we should pay our attention to. We constantly need to keep working on sharpening our skills (something I will take up again later) and at the same time, we will have to be clear on what path we are moving ahead. Trying to know everything that we come across and reading for the heck of reading will just take us nowhere for sure. Being focussed and moving ahead with non-stop relentless learning is what we need to become great. This is certainly hard work. But the point is, if you love the field, you will enjoy every bit of the effort you will put in!

Dr.Richard Hamming, in his magnificient lecture titled “You and your research” has spoken beautifully about the need and benefits of gaining knowledge and more importantly, working relentlessly:

“Knowledge and productivity are like compound interest”. Given two people of approximately the same ability and one person who works ten percent more than the other, the latter will more than twice outproduce the former. The more you know, the more you learn; the more you learn, the more you can do; the more you can do, the more the opportunity – it is very much like compound interest. I don’t want to give you a rate, but it is a very high rate. Given two people with exactly the same ability, the one person who manages day in and day out to get in one more hour of thinking will be tremendously more productive over a lifetime.

Without dedication towards our work, without loving Computer Science, without really having a passion for technical stuff, if we merely remain in this field “because it pays more money”, then we are wasting our lives. Computers are much more than just machines. Steve Jobs describes computers as “Bicycles for the mind“. I love that thought! We should evolve into working with dedication and focus as much of our mental resources as possible into this “cycling” within our minds!

I am very pleased with the I18n support that Java provides by default! Except for a few server side configuration changes, there is very little we have to do to get this support and get our applications running with the capability to handle requests from any geographical location! However, we should make sure we don’t have ugly code that assumes English character set alone, somewhat as below:

public boolean validateUserName ( String userName )
{
String validNameSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char[] nameArray = name.toCharArray();
for( int i=0; i < nameArray.length; i++ )
{
if( validNameSet.indexOf(nameArray[i]) < 0 )
return false;
}
return true;
}

Looks bad? You bet it is! The moment some character like áron is passed to this method, this will fail though the name is a valid one!

The following are what we need to keep in mind while trying to port an enterprise application to be compatible with UTF (Unicode Transformation Format):

(I’m speaking with Websphere and Weblogic in mind)

1) First of all, while designing the application, avoid all code that might assume that English alone will be used. That means, we will have to avoid all possible ugly code as I’ve mentioned above.

2) Whenever you need to use String validations, as in name validations and such, use Patterns and Regular Expressions. I find the following pattern range to be good enough to handle most of the foreign languages

[\u0030-\u0039\u0041-\u005a\u0061-\u007a\u002d\u005f\\s\\u0022\u0027\u00b4\u00c0-\u00ff\u0131-\u0132\u0152\u0178\u4e00-\ud7a3]

Use this range as your regular expression pattern and do your String validations. If accessed very frequently, this pattern matching can add a performance cost to your system but that’s a price you will have to pay for having I18n support for your application, unless you have a different solution designed.

3) Write your custom filter class. This class should just set the character encoding for your incoming requests and forward the filter chain and nothing else.

4) Configure the custom filter you write to handle all the requests. This is done in the deployment descriptor. You basically use the and the tags for this purpose.

5) Include the following property in your server start-up script(for Weblogic)/JVM generic args (for Websphere):

-Dfile.encoding=UTF-8

Assuming the rest of your application has no hard-coded patterns as the above code example, these changes should get your application ready for handling requests across most of the locales.

In fact, you can find a good amount of details about this here…and if you would like to know in detail about the usage of regular expressions with UTF-8, you can refer to this post.

Its very sad to see that the scientific world has lost a truly great mind last week. Rajeev Motwani was found dead in the swimming pool of his home. I looked at the publications he has made and felt highly motivated!

I have begun to greatly admire such personalities who have the core of their lives based on science. I liked the way his life life has been reflected on in a blog post by Mr.Shivanand.

May his soul rest in peace!

Older Posts »