OU blog

Personal Blogs

neil

dependency

Visible to anyone in the world
Edited by Neil Anderson, Friday, 2 Dec 2011, 19:10

At some point in any project you are going to begin hacking; Objects are beginning to know a wee bit too much about each other, we are playing pass-the-parcel with said-same and we keep having to re-visit them to add, "positively the last method".

In short you are starting to create an Italian staple: spaghetti. And you are probably adding a piquant sauce to your error.

It doesn't matter how carefully you planned, it doesn't matter how well it looked when you drew the diagrams, it doesn't matter about your elegant proficiency with the CASE tools. You will stuff up—you'll start balling string [lower-case] into a weevil's-nest of knots. 

At this point you need to step back and plan again.

The problem is that the we think that 'our thing' is working. This is a snare, a deceit and a trap of our arrogance. Working in what sense? That it's passing the unit tests? Or that your end-users can use it [when did we care about them?], or, worse, that you can use it. Bad code is bad code. Accept that you are going to write wrong; learn to feel when you're doing that.

We don't start out to write crappy code, but write it we shall and will, and if we don't grok the moment[s] when we start to do it we will always do so. Coders need a reset: we should know when we when need a re-think of our initial mal-assumption. For such moments will come. In their droves.

My personal test is that if I change a Class and it burns the tree in a place I didn't expect it's time for serious thought.

Actually that's not my only test, there are many [if I'm starting to chain too much I get worried; my reason for disliking JQuery , but there are loads if you look] You have to develop your your own Zen in this matter.

Yup, I'm there with my Solitaire thingee.

 

Permalink Add your comment
Share post

Comments

New comment

I usually end up with too many friends.
neil

New comment

That's a good way of putting it! wink

I'm at the stage where I know that if I forge ahead without thought I'm going to do something that's going to be a nightmare to fix later.

I think that I'm going to try to put all the Model instances into the controller and use getters/setters there. [The View Observes the Model so that part should be easy. Although I've been troubled by memories of WeatherFrogs! wink]

arb

neil

Phillip John White

New comment

Neil,

Perhaps it might help to read up on the Law of Demeter.

Phil

neil

New comment

@Phil

got you.

I might have something to say, soon. But I expect not, this stuff we paly at...

;-> neo