Are there scenarios where using objects is unproductive?

Are there scenarios where using objects is unproductive?


Through out the projects I’ve done for FCC, I haven’t had a need to create objects. So I started googling when and when not to create objects and all the results are on how to create an object.

Are there scenarios where creating and using objects become unproductive? If I only create one object throughout the entire code, should I still define and instantiate an object? Because it seems the purpose of objects were meant to create multiple objects of the same type.


By creating objects, do you mean using the new operator?

var newInstance = new MyObject();

That’s not terribly common. The only time I ever use it is when it’s required by some API, and I don’t think I’ve ever written a single object using that syntax. However, if you mean something like

function myReusableCode(parameter) {
  var closureScope = parameter;
  return {
    printAThing: function() {
      return closureScope;

I do that all day and all night. Reusable code isn’t always required of your projects, strictly speaking. It’s not something you would always want to use, especially if it’s small and you’ll only use it once. But code encapsulation also separates out functionality in a way that makes it easier for other programmers to work with you, and can make your code more descriptive (which makes it easier to work with yourself). It’s important to not turn everything into a reusable object, but knowing the whats, hows, and whys are a part of being a good programmer.

That’s my $00.02, anyways. There are plenty of great programmers who hate object oriented design for reasons that I don’t disagree with. Ultimately, there is no easy answer, though I think all web developers should branch out into more classically oriented languages like Java, Objective-C, Ruby, or Python to get a better idea of how these concepts fit together, because it’s not obvious if all you know is JavaScript.