0
votes
3answers
145 views

Better creating a class with static methods or a object? [closed]

I have a class,, and it has 2 methods. I will use those methods just once , but i would like to know (in term of memory )would it be better to create a object(just once) and use the methods or make ...
1
vote
5answers
145 views

Clarification about Polymorphism / Inheritance

I am trying to better my understanding of polymorphism. Say I have a base class called baseClass with one method called foo() and I have three derived classes called derived1 , derived2 and derived3 ...
2
votes
4answers
603 views

Returning multiple values in Javascript

Often I am writing a function that returns multiple values, such as a pair of coordinates: function get_coords() { return ???; } If I was using a language like Python, I would use a tuple: ...
1
vote
1answer
364 views

Analogy of a class being a cookie cutter and objects being cookies

I came across the analogy of the class being a cookie cutter and the cookies being objects while reading Code Complete. I fail to see why this analogy was drawn.How is it related to the concept of ...
22
votes
5answers
2k views

How do I prove or disprove “god” objects are wrong?

Problem Summary: Long story short, I inherited a code base and a development team I am not allowed to replace and the use of God Objects is a big issue. Going forward, I want to have us re-factor ...
16
votes
5answers
1k views

Why am I seeing so many instantiable classes without state?

I'm seeing a lot of instantiable classes in the C++ and Java world that don't have any state. I really can't figure out why people do that, they could just use a namespace with free functions in C++, ...
7
votes
4answers
335 views

Is there a standard, formal name for an object or class that behaves as if it is a given object?

I have an app in Django that expects to get a record with the fields email, first_name, and last_name. However, sometimes I want to be able to send it something that isn't actually a record but ...
7
votes
6answers
3k views

Is it called class or object instance?

I have a wording / precision question. Sometimes I write "object instance" sometimes "class instance". Isn't it that an object is always an instance of a class? Therefore "object instance" is not the ...