Simple Simon ([info]pieman) wrote,
@ 2007-10-18 21:11:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Such a switch
All day today I was dealing with code that was prepared by people who were not as senior and certainly did not have the time to consider what it was they were programming. This leads to a difficult situation for someone to come into later.

Frustrating is really the better word for it. You never know where to turn to next to fix a bug and you just keep throwing extra debugging into it.

In contrast I am now looking at some code from a very large, long term project from Snap days. It is downright relaxing to be trying to navigate this code. I have not *ever* been into this section of code before, but I can follow all that is going on and why.

Once again I am impressed by J's ability to consider error conditions and to deal with them appropriately. And, further convinced that Java is a better language that PHP for anything of any weight or long lasting value.

Anyway, the code snippet that saved my butt from certain and irrevocable roasting last week was this:

try {
/* lots of code to get a message thread from the database */
} catch (Exception any) {
thread = null;
}


Now, you wouldn't think that just randomly catching everything and dealing with it by returning 'null' would ever be truly appropriate. Shouldn't you try and figure out what is going on and *do* something about it. Not here. The returning of null if there was any issue means that the outside code fails gracefully and just does not display that thread. Like, say, when you have removed a bunch of user accounts in a cleanup and did not have appropriate code in place to make something more intelligent happen...something intelligent is already happening.

Where for most of the day things just failed. Sometimes in screen data dump, but usually more in a causing side effects as you go down sort of way. This was in playing with code that I have been working with off and on for the past two months.



(Post a new comment)


[info]sinnick
2007-10-22 04:55 pm UTC (link)
I thought you were a Ruby on Rails man now.

(Reply to this) (Thread)

I am, as always, a customer man
[info]pieman
2007-10-22 05:47 pm UTC (link)
I certainly think that Ruby (on Rails) may be a reasonable way to get from nothing to a working web app of some sophistication.

That doesn't mean that I am going to not do work that involves other languages.

I *do* think that for a larger application, with many developers, that Java is still a better technology base. Less freedom with typing rules is a good thing for distributed development.

(Reply to this) (Parent)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…