Archive for August, 2005

Another problem with TDD

I have definitely found one more problem with test-driven development: the creation and documentation of tests can be taken too far. I am now in my 3rd day of documenting my tests. I definitely agree that tests should be written before you start coding, however, these tests should be written in code and not in Word. I have 17+ pages of tests documented in a Word doc and not a single bit of code written.

The idea behind TDD is that the exercise of writing tests should be an exercise in design. It forces you to think through the inputs, the outputs, and the transformations that take place in between. In addition, it forces you to think through and apply your design. However, for me, this thinking, design part was done 4 days ago. All I am doing now is documenting all that thinking. This definitely feels like a waste of time. I could be writing JUnit tests write and documenting them instead of doing all the same work in Word.

Update: Okay, this is not an actual problem with TDD it is simply my frustration with a particular implementation of TDD. Where I work, we require all developers to create a test plan before they can actually create the tests. Since none of the developers have done TDD, this is actually working out quite well because it gives us a chance to review the ideas behind the tests before those tests get coded. However, it is still a tedious process.

Problems with Test-Driven Development

At work we are slowly discovering some of the problems with trying to do Test-Driven Development (TDD). On the surface, it seems like such an easy thing to do. Before you write any code, your create the unit tests to exercise the code. This not only gives you an excellent regression test suite, but it also forces you to think about the overall design and the inputs and outputs required by each method and class. By following this technique I know that my own designs and coding has improved. However, with all of that said, there are still problems:

  • How to properly teach TDD newbies how to properly go about creating their tests? For too many people on our team, they view tests as simply a way to exercise the code and do not see them as an exercise in design.
  • How do you do TDD with J2EE? I am sure that there are many ways of properly hooking JUnit tests up to work with deployed, managed code, but when you first start doing TDD, this can be a huge hurdle to overcome.
  • If developers do not understand Object-Oriented design and programming, how do you get them to implement proper unit tests? Or, if developers do not understand how to do design how are they suppose to work TDD into that design process?

Unfortunately I do not have any answers to the above questions. There are simply things that I have observed over the past month of trying to do TDD with a team of about 20 developers.

WordPress 1.5.2 Released

WordPress version 1.5.2 has been released:

We’re happy to announce that a new version of WordPress is now available for download. This set of improvements and security fixes is in line with our commitment to maintaining an extremely stable 1.5 series. In addition to fixing a number of bugs and adding requested enhancements for plugin authors, this release also addresses all of the security issues that have been circulating the past few days.

This is a very straight-forward upgrade, you just need to upload the new files over the old, but as always the Codex is the best resource on upgrading.

Dive into Python

For anyone looking to learn a new computer language—say python. The entire text of Dive into Python is available online for free.

It’s 6 o’clock already?!?

Ever have one of those days where, no matter how hard you try, you can never get any real work done? Well, I think I have been having those days for the past 3 weeks straight. And it doesn’t look like it is going to end until I leave my current job. Which thankfully is in just under three weeks. This is one of the main reasons that I have not been posting as much as I usually do. I simply do not have the time.

The real problem with this scenario is that I also do not get any work done. I currently have a design and a test plan (TDD) to create, get reviewed, and then code on my todo list. I have been working on this for the past week. Something that, if left alone, I could probably do in a couple of days. Ugh! Now don’t get me wrong, I like being busy, but this seems a little excessive. The root cause for this is the amount of meetings that I have to attend and the amount of questions that I have to answer each day.

I think I now understand what Agile Programming means by sustainable development. My current pace is not sustainable. It is also not agile. For everything that is coded, a full design—done in uml—must be implemented, including both class diagrams and sequence diagrams, along with a full test plan. Then, before you can begin coding, these documents must go through a review process. And they must be approved. Then, once they are approved, you can code your unit tests (this part I do agree with, i.e., the test-driven development part). I think the biggest problem that I have with this is just the speed, or lack thereof, inherint in this approach.

If I create a design and have it reviewed and then change that design, I must then resubmit it for review. True, we have found many problems with peoples designs by following this approach. However, it has also greatly slowed down the progress of true development. On the other hand, we are still trying to teach developers how to properly implement unit tests, so maybe the speed isn’t such a bad thing. Still, it is hardly something that can be sustained for any real length of time.

In addition, we have some people who are doing almost nothing and some people who are doing almost everything. This also does not help with sustainable development.

So, all I know so far is what sustainable development is not. Hopefully someday I can work somewhere where I can see what it is.

Dungeon Siege 2 Demo Released

Gas Powered Games and Microsoft have FINALLY released a demo for the upcoming Dungeon Siege 2. I downloaded last night and was able to try it out today. If you are going to attempt this feat, make sure you have a good solid connection, the demo is 1.4 gigs in size. That’s right, Gigs. This sucker is huge.

Although the game takes place in the same land as the original, this new release bears little resemblance to Dungeon Siege. No longer are you a hapless farmer thrust into the middle of evil events. This time you start off as a mercenary working for the wrong side. From this beginning, the adventure unfolds.

Once again, Gas Powered Games has created one of the most impressive games I have played. I am currently playing Guild Wars as well, and Dungeon Siege 2 beats it hands down. The best part of the game—no load screens. I have no idea how they do it, but this is still one of my favorite parts of the gaming experience with this game. In addition, the special abilities that characters develop throughout the game are amazing. However, learning how and when to use them takes sometime.

I can not wait for the final, full version to be released. It should prove to be every bit as addictive a time waster as the first one was. Heck, I am still playing the first one.

Where to put things

In a layered architecture, how do you know where to put your classes?

I am currently working on a nice little layered architecture at work that is comprised of about six layers. The problem we keep running into is where classes should be put. For example, we have a layer called Object Model that basically contains our domain model classes. To us, this makes sense. We also have a layer for persistence that contains Hibernate and all our DAO classes. The question is though, where do Hibernate mapping files go? They are an element of the persistence layer as they are only really used by Hibernate, but they are very tightly coupled to the objects that they represent which all exist in the object model layer. So an argument could be made that they belong in either layer.

This can be extended to include other examples as well. For testing, we use a class called HibernateTestUtil.java that configures Hibernate to work outside of JBoss. Since this class is only being used for testing, should it go in the test source directory? On the other hand, it has to be accessible to the main source files in order for them to work with Hibernate.

Do other people have this problem when trying to create layered architectures?

« Previous PageNext Page »