was just reading the main is a pain article and i get it, but was also wondering what happens when you have more than one class.
like if i had
a car, person and map classes for a program that did something. What would you name the launcher? in the cash register example in the article it was CashRegisterLauncher
but in a program like what im describing? with multiple classes?
also are the objects just all instantiated in the main launcher? Is it time i really started studying design patterns?
wayne brandon wrote:like if i had
a car, person and map classes for a program that did something. What would you name the launcher?
It's impossible to tell. Let's take another example: I have this application which maintains a database and it has (really) over 700 classes in it. So what did I name the launcher? Certainly knowing the names of those 700 classes doesn't help. In fact my application has a name, and that's the name of the class which launches it. You could use the same strategy. What's the name of your application? Or maybe, what does it do or what is it for?
also are the objects just all instantiated in the main launcher?
Not necessarily. Consider my 700-class application; it's not nearly as simple as instantiating instances of each of those classes up front. In reality they are instantiated at the time they are needed. Of course the initialization process does create instances of a lot of classes, but only those which are needed at start-up time. Same for your program. Think about what objects are needed when it starts.
Is it time i really started studying design patterns?
That wouldn't hurt. But just thinking about what your program is supposed to do would help. Yeah, I know there's a pile of code and a bunch of classes but a program is more than that. It's a thing which has a purpose for you, and it's necessary to think about it in those terms.
posted 9 months ago
Water! People swim in water! Even tiny ads swim in water: