Skip to main content
Tweeted twitter.com/#!/StackProgrammer/status/386012062423719936
added 62 characters in body
Source Link
Alice
  • 211
  • 1
  • 2
  • 7

Is it bad coding practice/design to make a class which will only be instantiated once?

I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a better description) since they are somewhat related, but they can just be global variables and global functions.

(Btw, I am using JavaScript, AngularJS, Express, MongoDB.)

Is it bad coding practice/design to make a class which will only be instantiated once?

I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a better description) since they are somewhat related, but they can just be global variables and global functions.

Is it bad coding practice/design to make a class which will only be instantiated once?

I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a better description) since they are somewhat related, but they can just be global variables and global functions.

(Btw, I am using JavaScript, AngularJS, Express, MongoDB.)

edited tags
Link
Alice
  • 211
  • 1
  • 2
  • 7
Source Link
Alice
  • 211
  • 1
  • 2
  • 7

Is it a bad idea to create a class which will only have one instance?

Is it bad coding practice/design to make a class which will only be instantiated once?

I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a better description) since they are somewhat related, but they can just be global variables and global functions.