I have begun putting together an application to build using ColdBox and ColdSpring. I am doing this to demonstrate how I have been doing this to solicit feedback from the experts to see if I am making any huge or stupid mistakes and to show some new comers to OO how to build an Application using OO principles and tools. I am hoping that my learning experience and blogging can help others learn these concepts too.
As I said before, I do not consider myself an expert in Object-Orient programming or in ColdBox/ColdSpring, but I feel I know enough to demonstrate these things at a basic level. I am counting on the true experts to keep me honest.
The application I have decided to build is a simple To-Do Organizer. This application will be used to:
- Create To-Do Lists
- Create To-Do Items in To-Do lists
- Give other basic functionality to lists and items (Update, Delete, etc)
- Save everything to a database
So, to begin this project, I am creating a UML diagram to determine the basic structure of the application. This is my first attempt at UML on a "real" project, as opposed to just dabbling. In researching the project I realized that there are several ways to model it. I looked at examples, like Brian Kotek's, here, and I looked at a discussion in the comments section of a post on Charlie Griefer's blog. And I had long discussions will Charlie Griefer and Paul Marcotte on the subject. Thanks to both of you for taking the time.
In all of the diagrams below I tried to use similar techniques to what Brian Kotek did in his diagram posted here.
This is what I came up with:
My first diagram is almost completely copied from Brian's. The main difference is that I did not include a factory and I did include DAOs. I thought about using Transfer in this project, but I do not want to for a few reasons:
- Transfer solves a problem. If we begin using Transfer before the beginners realize what that problem is, then they have not learned much.
- Adding a factory can complicate things because that is more things to understand and more functions to know. Transfer simplifies development, but I think it could complicate learning
- For myself. I started using Transfer before I fully understood how to do many of the thing Transfer does for me. So it would be a learning experience for me too.
My second diagram is influenced by feedback from others and from reading. While my first diagram does not completely have 5:1 Syndrome, it does have a lot of objects. So it was suggested I get rid of the DAOs and create a more powerful gateway. Since Todo Lists and Todo Items are so tightly integrated, and items cannot live without lists, it makes sense to have a single, powerful gateway that handles both.
My final Diagram does include a Factory. I thought I would include this just for fun and exercise. Like I said, I think that using any kind of factory for this small project might be over-whelming or confusing, plus I think it is important for me, and other novices, to learn to do this without Transfer. We are still going to use ColdSpring, regardless of which implementation we choose.
So, I have these three models. Right now, I am leaning more toward using model 2. I think it is a more simplistic design that still has the features we are looking for in a learning application. I would love to get some input or suggestions on this.
FYI, I do not think any of these models are complete. I am sure I am missing methods that we will need, or that I have something modeled incorrectly. So please feel free to point out my mistakes as well. I want to learn from this too. After we chose which model to go with, I will work on fleshing it out and getting all of the methods that we need.