Page 1 of 1
Class modeling: CRC cards, UML, what?
Posted: Wed May 31, 2006 7:00 pm
by bdlang
Hey all, looking for a better method to design large integrated classes. My background is (in a nutshell) BASIC->C->PHP->Java, so essentially I cut my teeth on alot of procedural code and am now waist deep in OOP design. Up to this point I've done alot of reusable functions, some class design. My normal method is to scratch some ideas out and build a skeleton class, work from that until I have a final revision, test, test, test.
So, does anyone work seriously with CRC, UML, etc?
Posted: Wed May 31, 2006 8:14 pm
by Buddha443556
I'm not sure I'm ever very
serious however I use CRC occasionally.
I use CRC because:
- It's simple. No software needed. A pencil, an eraser and some paper is all that's needed ... maybe a big table if I don't feel like crawling around the floor.
- Fits my size projects. I'm a solo-developer, project can't be too large or I may starve to death before I get paid.
- Keeps me from going details nuts. Oh ... not about the OOD but the pretty little pictures. I sometime seem to be some sort of frustrated artist. I get this urge to run down to Kinkos and print the diagrams big enough for framing. Using software for such a task sort of shifts my focus in that way.
I think whatever method you use should fit your needs and your situation.
Re: Class modeling: CRC cards, UML, what?
Posted: Wed May 31, 2006 8:34 pm
by Christopher
bdlang wrote:Hey all, looking for a better method to design large integrated classes.
Build small independent classes instead.
bdlang wrote:My background is (in a nutshell) BASIC->C->PHP->Java, so essentially I cut my teeth on alot of procedural code and am now waist deep in OOP design. Up to this point I've done alot of reusable functions, some class design. My normal method is to scratch some ideas out and build a skeleton class, work from that until I have a final revision, test, test, test.
So, does anyone work seriously with CRC, UML, etc?
Sounds familiar

I think CRC cards and a little UML is pretty handy in the design phase. If you are a (formerly) procedural guy like a lot of us, then you may want to look at Test Driven Development. It is the only way I found to break me of my old habits ... but it requires some discipline.
Re: Class modeling: CRC cards, UML, what?
Posted: Wed May 31, 2006 9:39 pm
by Roja
arborint wrote:Build small independent classes instead.
Arborint is 100% on the money.
For me, paper is a horrid distraction. I sit down and think through the overall vision of a project. I usually picture a large cloud, made of different sections of color. I mentally spin around the multi-color cloud, and start verbally describing the sections. "Here is the database access cloud", "Here is the way logins will be handled", and so on.
Once I've described most of the cloud, I can usually "feel" one that isn't fitting in right. Something is ugly, out of place, not well designed.. The hip term for it right now is "bad code smells". That section I zero in on, and start thinking about what it "should" be doing.
Then I look at the code, and nine times out of ten, its not doing what I think it should be doing. Where I go from there depends on whether its OOP code or legacy code. If its OOP, I start breaking it up into smaller classes and objects, refactoring as I go, writing tests for areas that aren't tested.
If its procedural, I look for ways to simplify, make the functions more 'correct', and make it do what it should be doing.
How do you eat an elephant?
One bite at a time.
Re: Class modeling: CRC cards, UML, what?
Posted: Wed May 31, 2006 11:32 pm
by bdlang
arborint wrote:bdlang wrote:Hey all, looking for a better method to design large integrated classes.
Build small independent classes instead.
Regardless of whether it was meant in a joking manner, I got a good laugh out of that one.
Precisely. I meant to say 'large group of integrated classes', as in an application made up mostly of classes, ala Java vs. a nasty hybrid of classes and procedural code which seems to be my nemesis.
Re: Class modeling: CRC cards, UML, what?
Posted: Thu Jun 01, 2006 1:58 am
by Christopher
bdlang wrote:Regardless of whether it was meant in a joking manner, I got a good laugh out of that one.
Precisely. I meant to say 'large group of integrated classes', as in an application made up mostly of classes, ala Java vs. a nasty hybrid of classes and procedural code which seems to be my nemesis.
No joke. I would take a well designed, modular procedural code with clear dependencies over sloppy OO code any day. Good design is always the bottom line -- and good design comes from three main sources: experience, learning from the best thinkers of our day, and peer review. If you can get those then cards and diagrams become more of a communication and documentation tool than anything else.
Posted: Mon Jun 05, 2006 1:00 pm
by alvinphp
I use UML a lot. It then becomes my cheat sheet so I don't have to remember everything in my brain. For me it is invaluable and I could never program without it for any medium to large project. I get a lot of bang for the buck as it does not take long to write some basic UML docs.