• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Where to assemble code and launch it

 
Ranch Hand
Posts: 289
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys

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?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
wayne brandon
Ranch Hand
Posts: 289
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks paul
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic