Quality

6 10 2009

Almost in any technology a developer use there are some “context” objects where you can put some values using methods like “context.setAttribute(key, value)”.

If I needed to qualify some developer’s work qaulity I would check if he clears up those attributes from the context when they are not needed anymore. I am sure 80% of developers do not bother with this.





A Door, a Ladder or Just a Hole?

25 02 2009

The subject I will describe few lines below is very simple from one point of view and at the same time it needs a lot of reflection to evaluate possible answers.
In software development EVERYTHING can be implemented in various ways. Somehow developers always choose one certain solution and implement it. How do they know if the solution chosen is the best one? Or let’s rephrase it, do they know that there were other possible ways to go? :p

I will describe one very simple case that can appear at almost any average project.
Suppose you have a CarDiller service which can return you a list of cars available for selling.
So somewhere there is a method CarDiller.getCars(): List

Everything works nice but some day your customer tells you “Listen to me, son, it would be nice if we have one more page on our site where we show only cars for girls. Can we do this?”.
Of course you will tell “Yes, we can”. I don’t doubt you can, do I? ))
The question is HOW will you do it.
At the very surface I already see 3 possible ways:

  1. A door:
    We extend backend method and it becomes CarDiller.getCars(girls: Boolean): List
    Then in one plays we call CarDillers.getCars(GIRLS) and in other place we call CarDiller.getCars(ALL)
  2. A ladder:
    We create one more backend service method: CarDiller.getCarsForGirls():List and use just it where needed
  3. Just a Hole
    We can do everything on the client. I mean filter cars that are good for girls from the bulk of all cars.

Maybe there are more ways but for now even these three are pretty enough.
I would like to hear some smart people in comments telling me pros/cons of each of 3 solutions. I am not an idiot and can write a lot about such pros/cons but maybe there are ways to determine in general which solution would be always BEST, no matter of particular details. Or there are no such abstract criterias?





Expandable universe

3 02 2009

Today after some debates with my developers over certain architectural questions I clearly noticed that there is a pretty analogy  between a software developing team and universe as it is perceived in cosmology.

The mainstream cosmology theory treats our universe as an expandable entity which is regulated by different forces: gravity, strong and weak nuclear forces, etc. The same theory can be easily put onto the project and the project team.

If there is no project manager or a team leader the project (where the Code is actually a Matter) will start expand, expand with some acceleration. This happens because developers are carrying agents of the repulsion force. The amount of repulsion force in an average developer is order greater than of gravity forces.

A good project manager or team leader is the atmost gravity center that makes all energy and matter rotating around himself along certain orbits. This makes the project glue together, it still expands but wothout acceleration and very slowly.

Physics gives me a lot of very good abstractions that can be applied in IT and in projects. When you see this – it starts looking very nice :)





One particularity of flex data binding

9 01 2009

Yesterday I’ve been reading bout data binding in Flex. There was a link to one blog where one dude described that you can save your brain from WTF exclamations and hardcore debugging if you know that data binding in Flex is a bit tricky in one case. Also he said that this “issue” is not outlined visibilly enough in Adobe Flex Documentation.

The issue is when you try to set a property of the source object to the value that is already assigned (i.e. you pass to the setter the same value again) Flex will not propagate binding and update all bound values. This is simple and seems like all flexers in my surrounding know this from the ancient times.

The most interesting thing is that this “issue” is described very clear in the Adobe Flex 3 Help. A citation from there:

The Flex compiler automatically generates an event named
propertyChange, of the type ProperyChangeEvent, for all public
properties so that the properties can be used as the
source of a data binding expression.
If the property value remains the same on a write,
Flex does not dispatch the event or update the property,
where not the same translates to the following test:
(oldValue !== value)

That means if a property contains a reference to
an object, and that reference is modified to reference
a different but equivalent object, the binding is triggered.
If the property is not modified, but
the object that it points to changes internally, the binding
is not triggered.





RefUcktoring

27 12 2008

I should have been in the mountains today and tomorrow and should have been having fun on my snowboard but this night when time came to get up and pack my things I felt that my throat is a bit ill and decided (it was not easy) to stay at home.

What one have to do when staying at home on weekend. I prefer learning, blogging and drawing :) This time I chosen to write about refactoring, more precisely about my approach to refactoring.
If you’ve been boiling for some time in IT soup you should know a lot of cases when you or your team needed to refactor some complex system. You are lucky if you have the man who built up the current version of the system to do the job but in a half of cases it will be just a dream. In such cases whoever will take the task should be able to:

  1. Analyze
  2. Plan
  3. Implement
  4. Test/Debug
  5. Fix/Finalize

If the person is not capable to perform any or few of the listed parts of the task – then your project is in trouble.

So, in my project the last week was very hot one since it was last week when we could increment functionality, the next few weeks period will be stabilization phase. And the customer wanted us to improve performace of one thing which required a major refactoring. Not to say that we didn’t knew earlier that the bloody thing should be refactored. We knew that but there were a lot of other tasks + speaking honestly noone wanted to do that job since the guy who initially implemented the complex module (he did this well taking into consideration requirements at that time) was no more in the crew.

But like it always happens the customer insisted and there were no choices but to roll up the sleaves and quickly do the job. I estimated it roughly to 5 man/days.

My programming experience is not that much but I had few times before to lead some difficult refactoring as a manager. And each time I applied the same tehnique which always proves to be good:

  1. Analyze
  2. Plan
  3. Implement
  4. Test/Debug
  5. Fix/Finalize

For points 1 and 2 you need anything where you can draw some simple diagrams. I use a kind of mind-mapping diagram where I try to desribe at the first level basic tasks definitions, then as the branches everything I know about the problem (but only needed things) and points where I need to research, then on the next levels concrete tasks that I need to implement to get the thing done. This is a very good materialization of the analizys process. All tasks that I need to implement I mark in a red font to have them sharply visible. It looks like this:
Metrics Data Loading Refactoring

I always keep there only needed info, names of the classes, code snippets, etc.
When I feel the analysis is completed I start the point 3: implementation going from top to the bottom of the diagram. When a particular red leaf is done I mark it with green background. I do some small tests after each step and when all is green I start testing and fixing small things that always definitely shows around.

I completed the task in 12 hours almost without any breaks, even missed my lunch. It was interesting and it works :)
What I actually implemented is incremental loading of data and its caching. Now I know how any abstract caching is done technically. Think this will be useful in future. Big thanks to Max Hryniv who’s code teaches me a lot.
Also I’m not sure that this technique is suitable for everyone. I saw a lot of times when guys skip steps 1 and 2 and start right from the step 3. But almost always it results in UNDERestimation and troubles.





16 10 2008

I was about to write some piece of bullshit into my blog. Was watching a movie and there one funny guy told a thing “blogging is all about to keep a continuous narration”. Hell knows if that was right though or completely crappy but I am definitely almost absolutely sure that it’s not a good idea to write something down when it is a midnight and your brain is kinda tired and wants to say you “bye bye” :)
So… I decided to check if there are some smart things in blogs of the people I know (not that much, really, I mean not that much people I know having blogs and posting something there) and found out that Pavel has written a thing. Whoever can agree or disagree with the theory a dude referenced there by Pavel evolves but it shouldn’t take such a deep philosophical-kind digging to see that software-craftsperson is better then just a good developer or good DBA, or good PM.

Pavel’s post made me think about why do some people need to back there thought upon the identical thoughts of other people who are for some reasons are known by the greater auditory. Proper thought comes from experience and don’t need any “approval” of others.

Also there was a picture describing a “standard team”. I’ve never seen a standard team.. really never, such as it is described on that picture. I think such standard teams are all dead long time ago and if someone tries to revive one it will fade to gray :) Real teams now are agile and consists to some extent of software craftsmens. At least it proves itself that if you have only pure “jave developers” or pure “htmlers” in your team then your chances to get into troubles are higher then if you have people with multidisciplinar knowledge. Also having such people doesn’t guarantee you will succeed instead of failing and delivering sucks.

One more thing that one can see on that painting is that in team of software craftsmen you can’t be just a specialist, you need to add a VALUE to the team, otherwise it will be boring for you with them and they will be bored with you.

So, let’s learn and specialize, then learn and generalize, and then once again learn and become jacks-of-all-trades. And the fact that Pavel named his post “Softare Craftsmen” tells me that he is not a man of theory, he is man of practice, and working with him I really think he is. Thanks for the reference :)

I see that a lot of people are viewing sometimes my blog (can’t see exactly who you are ;) ) and only some leave me a comment (girls, don’t be shy, I’m still single and can have a dates ;) ). That’s normal, most of people are shy or unable of producing a simple few sentences that are linked together and meaningful )) Just whoever watching this and trying to get some piece of a thought – read that article of Pavel and then read the article of the guy referenced there. It’s how it works, the blogging I mean, the network.

Almost forgot… I should name somehow the post… it can’t be without name I suppose. Or can? I will try to submit it without a name. Let’s try :)





Artificial Intelligence

8 07 2008

A very short post. Since I’m @work and have really a little time for posting.

A lot of people are continuously discussing and trying to make some forecasts on when exactly (always very soon) the humanity will get a priceless gift: Artificial Intelligence that will be able to think instead of us, to work instead of us, bla bla bla.

And that is all not needed. We already have this AI. Some of people surrounding us are not Intelligent, they are artificially intelligent. Truly, they are like robots who can’t distinguish “a” from “b”.

When I see a developer who has 2 contradicting tasks assigned to him and he is not even suspecting that something is wrong and doing those tasks one by one … then is he an Intelligent or Artificially Intelligent?

That’s all for now. Bye.








Follow

Get every new post delivered to your Inbox.