Concept of class, entity and objects

6

I'm reading about classes in C #, and an excerpt left me a bit confused.

I know that classes are C # objects, and can be used in many ways.

My question is in the following sentence:

"A class can have both the attributes and methods of a system entity"

Would the class itself be considered an entity of the system or not? If so, I believe the above phrase would have to be different.

When we talk about entities, can we refer only to the class or to any object?

    
asked by anonymous 08.05.2017 / 20:20

1 answer

13
  

I know that classes are C # objects, and can be used in many ways.

Class is not an object . Class is a template to follow, object uses this template to structure.

Think about development time and runtime. Class is defined in the first, the object in the second. Class only exists in your code, object only exists when the application is running. It's a simplification, but it's easy to understand.

Comparing with database, the structure defined for a table is the class, each row of that table is the object.

  

Would the class itself be considered an entity of the system or not? If so, I believe the above phrase would have to be different.

Yes, a class is a system entity model. I do not see why it should be any different. From an architectural standpoint, the class is a model that represents an entity. Architecture only exists on paper, the embodiment of it is that it will generate objects. Objects function as entities. Example: The class says how a client's data should be organized, but a client will actually exist only on objects.

Just like tables in DBs are entities, classes are entities in modeling. Separate the real data model from your mind.

Just be careful because in C # what it reads attribute, understand how fields, or even properties, since the term is used for something else .

  

When we talk about entities, can we refer only to the class or to any object?

The entity itself is the object. The class is a type of an entity, or in other words, it is an object class. Class comes from classification, comes from generalization of a group of objects with the same characteristics. The class is an abstraction of the entity. When we are talking about abstraction, we use the term entity.

Think of a map. We point to such a city. We are pointing to an abstraction that represents the city on that screen, but it is not the city. The city is an entity. On the map we treat that representation as if it were an entity. The term can be used in both contexts.

A philosophical note

Just note that technically the application object is not the entity either, we just use the term like this to make it easier. The entity itself exists only in the real world. So a customer is the customer, it's a person or a company. The object in your application functions as a representative picture. For its application the real world does not exist. Tron exists only in fiction.

    
08.05.2017 / 20:32