Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Where to assemble code and launch it

 
Ranch Hand
Posts: 289
2
  • Mark post as helpful
  • send pies
  • 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: 25969
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
thanks paul
 
Water! People swim in water! Even tiny ads swim in water:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic