Tonight I discovered the joy of package-scoped variables in Java. You see, I have been hearing a lot about inversion of control and dependency injection--good things for the most part. I understood it, but hadn't given it the college try yet.
So I did tonight. I was recoding the Tagfriendly UI/client that I worked on earlier in the week. Something about the coupling between the client and the UI was really bothering me, so I decided to give it another try. This was one of those programming moments where I had a clear vision early on of an approaching train wreck. Experience shown me that when this happens, it is usually best to take some time off and come back with a fresh mind. So I did.
Trying to use clean MVC in java is hard, but I thought I would try the "UI delegates everything" approach and let the UI be a UI only (brave new concept, I know). But then I decided that maybe it would be good for the delicate to have access to all kinds of the guts of the UI driving it. I had never tried view/controller this way before.
It seems to be working well. I put the GUI together in less than half the time it took me the first time around. The code is cleaner and shorter. Coupling has gone up, but in this case I think it is ok.
20 August 2005
Package Joy
Posted by Gary Dusbabek at 21:08
Labels: technology
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment