Monday, April 27, 2009

Computer-aided equals awesome

My endorsement of CASE tools: a result of my experiences this past week and a half using it. I actually went in neck deep, and used them in a real project: my java assignment.

Visual Paradigm

Did a crappy little use case diagram, and then a really spiffy class diagram, coming back to it and modifying it many, many times until I felt that I had gotten down every single method and attribute that was necessary; as well as of course defining and redefining the relationships between the different classes.

 

See a previous post on my discovery of giving the relationships role names and visibility, in addition to multiplicity.


 

Then what I did was go back and forth modding the class diagram a little, and, generating the Java code, and, fixing up little bugs in the code. After going through many iterations of that, I had a massive amount of code already generated for me by VPUML.

 

Although I probably spent almost as long fiddling around with VPUML and tweaking the class diagram in order to get the generated code as I could have if I had done what I would do normally, which is to start coding off that bat - I felt that that time was a lot better spent, because I had two tangible products of my labour: the class diagram plus the code (instead of just the code).

 

In addition to that, I felt that the kind of code that VPUML generated was pretty much what I wouldn't consider the "real" code. It was defining the attributes, and their getter's, setter's, and the add and remove operations for the arrays (for roles where the multiplicity was > 1). Spending time just coding all of that would have taken as long as I had spent fiddling around in VPUML - but it would be for all the wrong reasons:

  • making spelling mistakes and taking ages to find them
  • realising the program didn't work because I left out some function, which was actually obvious, but was at the back of my mind, and in the process of coding everything else, was somehow forgotten
  • realising what I had spent the last hour or so coding didn't do exactly what I had intended, and so have to recode that all over

As well as avoiding all that, I had a class diagram to boot, which actually did come in very handy as a reference, to look at when unsure about the architecture of the application and its classes.

NetBeans

After that, what I did was spend a good solid chunk of time just coding and coding. But I wasn't coding the annoying parts, I felt as if I only needed to code the logical parts of the program. The little bits here and there that you need to implement the "business rules".

 

Then came interface design – we have to design a GUI to operate the program. Coding that is near impossible when you decide to have more than maybe 5 components on your screen. So I decided to switch from JCreator to NetBeans. In NetBeans, you can just drag and drop them from a palette. The event listeners are all generated automatically. When you change the name of a component, the references to it in the source code are changed as well. I also found the integration of NetBeans with Javadocs a really handy feature - to be able to look up the parameters of any function as you are typing the code.

It's not cheating

I'd like to borrow that line from MS’. I have actually finished this major assignment which is supposed to span the entire semester (due week 13), in just one and a half weeks from starting on it. Thanks a lot of course to VP UML & NetBeans, which really accelerated the development process by leaps and bounds.

 

Most of the guys in uni, that I have told about my progress, had this reaction:

Impressed --> Puzzled --> "That's cheating!"


 

No it isn't. My take on CASE tools is that if it is something a computer can do, it is waste of time and effort making a human do it (doubly so if that human is me).

Also, isn't the ultimate purpose of what you do and learn in your IT degree in uni, to prepare you for what you do when you graduate and get a job in IT? I don't see myself bothering with all that initial legwork while I am working - in fact I think it's a lot smarter, and better for the clients that I would be working for as well, just to focus on coding the logical bits. The business rules; the stuff that comprises the functions required by the client whom you are building the application for.

 

In fact I am very happy that this unit introduced me to the concept of using a CASE tool – after trialling it once, I don’t think I’ll look back.

No comments:

Post a Comment