What does Vo stands for? [closed] - oop

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I found this abbreviation in many projects it is a folder referring to database models in an active record context
but What does it mean exactly ?

VO normally stands for Value Object.
In Domain Driven Development (DDD), value objects represent one or more pieces of information, but do not contain an identity. For instance, an Address object containing street address, city, state, and zip would be considered a value object.
This site can provide more info: http://devlicio.us/blogs/casey/archive/2009/02/13/ddd-entities-and-value-objects.aspx

VO stands for Value Object. The difference from normal objects is that value objects' only purpose is to store values in a convenient way. In short that means that a value object just contains a bunch of properties and no methods.

Related

Difference between Singleton and SRP(Single Responsibility Principle) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Difference between Singleton and SRP(Single Responsibility Principle)Can you explain the difference in plain language with examples?
If an object is a person, singleton means that there is only one person of a given type in the world. You cannot find there are another person of the same type in the world.
Single Responsibility Principle (SRP) means that a person only focus on and can only do one thing. So even if you are the only the person of a given type in the world (i.e. singleton) , if you can do many things that are not related to each other , you are not SRP enough.
So you can see they are different concepts which do not related to each other. Singleton is about the quantity of certain kind of object. SRP is about what things can an object do.

Naming list of "status" [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Oh dear, the time has come for me to iterate through a list of 'status' objects. When I have a list of objects I like to name it the plural form of the name of the objects it contains unless the objects are data types like strings: for example, a list of 'dog' objects would be 'dogs'.
What do you call a list of 'status' objects? Most dictionaries seem to say the plural is the same as the singular, 'status', but that won't work as there would be a naming conflict.
Singular: status
Plural: statuses
Dictionary definitions are less important than if someone will understand the code you've written, in a year's time or ten year's time. Everyone will understand that. Like Richie commented, move on with your life, you're gonna have bigger problems to solve.

Active Record: Why it adds things like "save"? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Why a Product object, for example, has a method called Save?
It seems to me that it is wrong for a Product saving yourself in the database.
A product should not only know only about their own responsibility?
Did I not understand the purpose of AR or the problem is not in my interpretation?
$product = new Product();
$product->name = 'sample post';
$product->price = 10;
$product->save();
The general principle of Active Record is that an instance of an object is a single row in the data store and the object is wholly responsible for the persistence of itself.
The object has a single responsibility and that is manage the persistence of itself.
Martin Fowler says it best:
An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.
An object carries both data and behavior. Much of this data is persistent and needs to be stored in a database. Active Record uses the most obvious approach, putting data access logic in the domain object. This way all people know how to read and write their data to and from the database.

Using NSArray<MyProtocol> and NSDictionaty<MyProtocol> [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I faced with two declaration NSArray<MyProtocol> and NSDictionary<MyProtocol>. I didn't find correct explanation of it and how work correct with it.
I think this may be related to a clever macro that did the rounds recently (possibly this one, there are a lot of similar projects on GitHub).
The values stored by NSArray and NSDictionary are of type id. This basically means that the type of the objects being stored is untyped. The problem with this is a that you loose type safety. The macro in question attempted to address this problem by creating a protocol that is applied to the array/dictionary so that the returned objects have a more specific type than id.
In Xcode you can find where <MyProtocol> is being declared by cmd+clicking on it <MyProtocol>.
Personally I would avoid using such macros. They are solving a problem, but the solution is not in keeping with the Objective-C ethos. I would solve this problem by one or more of the following:
ensuring the collection has a descriptive instance/variable name
creating another class that wraps the collection.

Meaning of granularity in OOP [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I was reading about the flyweight design pattern on this page.
I was not able to understand the meaning of the "granularity" in the context of programming languages or the design pattern.
Can anyone please explain, an example would be great.
Granularity is a level of details. Granular objects are those, which are at low level detail in your program. Consider:
trees in game landscape
characters in document
seats in cinema
power points in cad application
Usually you have many granular objects in application. If you will create separate object for each tree/character/seat/power-point it could be very memory-consuming. Thats the problem which is solved by Flyweight pattern.