Suppose we have an Instance
class in a C++ program, which has a GUID/UUID, name, parents, children, and other properties which can be saved to or loaded from an XML..
Tag : object-oriented
I’m a junior in my company, and one of the coding rules they have is:
“a constructor object must never fail” (i.e., never throw). So what if I give them an invalid parameter? Then, the object should be constructed anyway and there should be another way to check if the object is valid, like an isValid()
m..
I looking to learn better use of OOP principles/patterns so I decided to start implementing at least the basics of a GB emulator (technical part is widely covered on diff s..
I’m a junior in my company, and one of the coding rules they have is:
“a constructor object must never fail” (i.e., never throw). So what if I give them an invalid parameter? Then, the object should be constructed anyway and there should be another way to check if the object is valid, like an isValid()
m..
I’m a junior in my company, and one of the rule coding rule they have is: “a constructor object must never fail” (i.e. never throw). So what if I give them a invalid parameter? Then, the object should be constructed anyway and there should be another way to check if the object is valid, like an isValid()
m..
If you have a class representing your applicative config..
So a ‘fundamental’ OOP principle is being able to control the access to various methods and fields from other parts of the program by making them public or private. The reason is so that you cannot access an internal item or some..
I’m working on a desktop application that stores data in a complicated object graph. It has many read-only operations that need to do expensive transformations on parts of it, for example to display some graphical elements, or calculate things. For performance, I want to avoid repeating those transformations if the data hasn’t changed. Changes that affect the result can happen in many different objects, including ones that are linked in other ways besides composition, such as ID numbers and string names. Many of these transformations use data from overlapping sets of ob..
I’m in the process of writing a library in Python, and I’ve run into a design problem concerning the use of polymor..
I am working on C++ code that maintains several enum types. Say 3 to 4 enum types each with at least 4 different values. Plus the code maintains several boolean variables. The code is multi threaded and across different threads, it uses the state indicated by these enum variables and boolean values to drive code flow. This led to foll..