Questions tagged [god-object]

God object is an object that knows too much or does too much. The god object is an example of an anti-pattern.

A God object is an object that knows too much or does too much. The God object is an example of an .

From Wiktionary: (programming, object-oriented) a poorly designed object that does more than one thing. (In other words, it is an object that violates the single responsibility principle of SOLID.)

Wiktionary: https://en.wiktionary.org/wiki/God_object

28 questions
4
votes
1 answer

How can I take advantage of IObservable/IObserver to get rid of my "god object"?

In a system I'm currently working on, I have many components which are defined as interfaces and base classes. Each part of the system has some specific points where they interact with other parts of the system. For example, the data readying…
user1228
4
votes
1 answer

Is the Monolithic God object in Javascript a performance concern?

The way it is: I have recently joined a webapp project which maintains, as a matter of standard, one single globally-available (ie, itself a property of window) object which contains, as properties or recursive sub-properties, all the functions and…
3
votes
1 answer

Util == God object?

I use Selenium Webdriver a lot, and there are a lot of "utility" methods I've written to make it easier for me to use. I put these classes in a WebDriverUtil class, and now that file is over 1,200 lines long. Every method in WebDriverUtil attempts…
michaelsnowden
  • 6,031
  • 2
  • 38
  • 83
2
votes
3 answers

What to do to prevent God Object?

I know that it is poor programming and architecture when you have a class object that is only to be used in one place. But I've also been warned about creating an object that is all powerful and that can do too much. So how do I break this down?…
Adam Beck
  • 1,271
  • 2
  • 14
  • 25
2
votes
1 answer

God object replacement

I now trying to get rid of god objects from my server code. At first of my server design, I decided to do World, and const containers objects as singleton. But my server is multithreaded, and singletons there aren't good solution. So I managed it…
user3126089
  • 83
  • 1
  • 7
2
votes
1 answer

How to avoid this addition to our god object

Our web application allows users to upload files. We have two god objects in our web application: User object (3000+ lines) File object (3000+ lines) Common usage at the moment is: $file = File::getByID($_GET['file_id']); $user =…
paul
  • 731
  • 2
  • 9
  • 13
1
vote
1 answer

Validator class that validates by several simple criterias - is this God-object?

I have a Java class Validator. It validates some file. Here it is in pseudo code: public class Validator { Collection validationMessages; class ValidationMessage { } enum MessageType { } public…
Oleksii Volynskyi
  • 1,317
  • 1
  • 8
  • 5
1
vote
2 answers

God object or where to keep subsystems references

I have many subsystems of my game. They can use each other. Earlier I was initializing and storing subsystems references into static Game object instead of making singleton. Now I see that Game has too many references to other classes and looks…
Vlad
  • 3,001
  • 1
  • 22
  • 52
1
vote
1 answer

2D Game Development "God class"

I am developing a 2D game in C++ using SFML API, but I am having an issue with class design. I think that I am disobeying the SRP (Single Responsibility Principle) because I have one main class called "Game" that should handle the window. It…
Brukmoon
  • 189
  • 10
0
votes
0 answers

How to get rid of God object if it's calculates majority of functions

How can I split this class into several simpler ones, using the principle of single responsibility? There is this awful class: # engine for game logic import HB_classLib as cllib from card_mech import * from pygame import Color, display import…
VladSkarn
  • 1
  • 1
0
votes
1 answer

Is there a pattern for propagating configuration state down an object graph?

I'm trying to avoid creating a monster class, and I noticed a not-so-good pattern and was curious if anyone had any insight into this problem. Problem A is complex. To avoid the "god object", some of the logic is pushed out into B and C. A now…
0
votes
1 answer

Get rid of god object of QMainWindow

I am making an application with three libraries ITK VTK and Qt. Since I want all functionality in the event loop and connection of signals and slots so I defined all functionality under QMainWindow definition. Now mainwindow object became bulky and…
QT-ITK-VTK-Help
  • 548
  • 2
  • 6
  • 19
0
votes
1 answer

how is game saving implemented so that the developer can avoid creating a god class/object?

Yesterday when I was playing a video game a question suddenly comes to me, how is game save mechanism implemented? Mostly, a save requires all data of the game. In this case, doesn't the programmer have to make a god object that has reference to…
Fermat's Little Student
  • 5,549
  • 7
  • 49
  • 70
1
2