0 added
0 removed
Original
2026-01-01
Modified
2026-02-21
1
<p>Programmers always write software for a specific field. For example, accounting software relies on accounting rules, and a website for watching TV shows relies on TV industry concepts such as seasons or episodes. The same goes for other fields: booking flights and hotels, finding tours, buying and selling cars.</p>
1
<p>Programmers always write software for a specific field. For example, accounting software relies on accounting rules, and a website for watching TV shows relies on TV industry concepts such as seasons or episodes. The same goes for other fields: booking flights and hotels, finding tours, buying and selling cars.</p>
2
<p>Understanding the domain for which you're writing a program is just as important as being able to program. Fields can be complex, like accounting or engineering manufacturing. You do not need to know it thoroughly, but a general understanding is still required.</p>
2
<p>Understanding the domain for which you're writing a program is just as important as being able to program. Fields can be complex, like accounting or engineering manufacturing. You do not need to know it thoroughly, but a general understanding is still required.</p>
3
<p>Let's look at Hexlet since you know its key concepts - courses, lessons, professions, tests, code reviews, quizzes, course participants, and projects. There are two hundred<strong>entities</strong>- concepts in the code on Hexlet.</p>
3
<p>Let's look at Hexlet since you know its key concepts - courses, lessons, professions, tests, code reviews, quizzes, course participants, and projects. There are two hundred<strong>entities</strong>- concepts in the code on Hexlet.</p>
4
<p>Entities are often in relationships with one another:</p>
4
<p>Entities are often in relationships with one another:</p>
5
<ul><li>Professions consist of courses</li>
5
<ul><li>Professions consist of courses</li>
6
<li>Courses consist of lessons</li>
6
<li>Courses consist of lessons</li>
7
<li>Lessons consist of theory blocks, quizzes, and exercises</li>
7
<li>Lessons consist of theory blocks, quizzes, and exercises</li>
8
<li>Quizzes aggregate questions</li>
8
<li>Quizzes aggregate questions</li>
9
<li>Questions obtain answers</li>
9
<li>Questions obtain answers</li>
10
</ul><p>These connections have specific names:</p>
10
</ul><p>These connections have specific names:</p>
11
<ul><li><strong>One-to-many</strong>or<strong>o2m</strong>- one lesson can have one course, but one course contains many lessons</li>
11
<ul><li><strong>One-to-many</strong>or<strong>o2m</strong>- one lesson can have one course, but one course contains many lessons</li>
12
<li><strong>Many-to-many</strong>or<strong>m2m</strong>- many users can take one course, and one user can take many courses</li>
12
<li><strong>Many-to-many</strong>or<strong>m2m</strong>- many users can take one course, and one user can take many courses</li>
13
<li><strong>One-to-one</strong>or<strong>o2o</strong>- it is how users and experts connect on Hexlet</li>
13
<li><strong>One-to-one</strong>or<strong>o2o</strong>- it is how users and experts connect on Hexlet</li>
14
</ul><p>In reality, everything is still a little more complicated because the same entity may look completely different from the point of view of various systems. The users are two separate things from the point of view of accountants and mentors.</p>
14
</ul><p>In reality, everything is still a little more complicated because the same entity may look completely different from the point of view of various systems. The users are two separate things from the point of view of accountants and mentors.</p>
15
<p>The descriptions of the objects belonging to the domain under consideration and their connections are<strong>domain ontology</strong>.</p>
15
<p>The descriptions of the objects belonging to the domain under consideration and their connections are<strong>domain ontology</strong>.</p>
16
<p>The ontology is well-known by experts in the relevant field - for example, accountants, professors, and lawyers. They often present it intuitively and informally, so we can communicate with them to build a formal ontology.</p>
16
<p>The ontology is well-known by experts in the relevant field - for example, accountants, professors, and lawyers. They often present it intuitively and informally, so we can communicate with them to build a formal ontology.</p>
17
<p>This process occurs throughout the development of the project and beyond separate stages. In creating the ontology, we identify specific terms and agree:</p>
17
<p>This process occurs throughout the development of the project and beyond separate stages. In creating the ontology, we identify specific terms and agree:</p>
18
<ul><li>What they mean</li>
18
<ul><li>What they mean</li>
19
<li>How they are related</li>
19
<li>How they are related</li>
20
</ul><p>We can form the data model using the ER model in high-level conceptual database design. The architecture for future applications starts to appear at this stage.</p>
20
</ul><p>We can form the data model using the ER model in high-level conceptual database design. The architecture for future applications starts to appear at this stage.</p>
21
<p>It is not always possible to unambiguously say what connection exists between two entities. We can think ahead and immediately create more complex cases - for example, m2m rather than o2m, which affects the complexity of the code.</p>
21
<p>It is not always possible to unambiguously say what connection exists between two entities. We can think ahead and immediately create more complex cases - for example, m2m rather than o2m, which affects the complexity of the code.</p>
22
<p>More complex connectivity means more code lines and higher development and maintenance costs. The complexity of the connections can be described as follows, in order of complexity: o2o, o2m, m2m. Someone can make mistakes when choosing a connector, which indicates a lack of understanding of the topic.</p>
22
<p>More complex connectivity means more code lines and higher development and maintenance costs. The complexity of the connections can be described as follows, in order of complexity: o2o, o2m, m2m. Someone can make mistakes when choosing a connector, which indicates a lack of understanding of the topic.</p>
23
<p>Let us give you an example. Suppose we implement a user and a foreign passport association in the system:</p>
23
<p>Let us give you an example. Suppose we implement a user and a foreign passport association in the system:</p>
24
<ul><li>Intuitively, these concepts have a one-to-one relationship: a user can have a foreign passport</li>
24
<ul><li>Intuitively, these concepts have a one-to-one relationship: a user can have a foreign passport</li>
25
<li>But you can change the passport if it gets lost or expires</li>
25
<li>But you can change the passport if it gets lost or expires</li>
26
<li>In addition, some countries allow you to have more than one foreign passport</li>
26
<li>In addition, some countries allow you to have more than one foreign passport</li>
27
</ul><p>On the other hand, the real world is always more complex and more complete than any model. Programmers create a universal and comprehensive model of a particular domain and try to understand the needs of a business, identify only significant parts of the field under consideration, and transfer them to the code.</p>
27
</ul><p>On the other hand, the real world is always more complex and more complete than any model. Programmers create a universal and comprehensive model of a particular domain and try to understand the needs of a business, identify only significant parts of the field under consideration, and transfer them to the code.</p>
28
<p>How entities appear in code varies between languages:</p>
28
<p>How entities appear in code varies between languages:</p>
29
<ul><li>Some define types using abstract data types, interfaces, or classes</li>
29
<ul><li>Some define types using abstract data types, interfaces, or classes</li>
30
<li>Others define structures</li>
30
<li>Others define structures</li>
31
<li>Others don't provide options except for dictionaries and associative arrays</li>
31
<li>Others don't provide options except for dictionaries and associative arrays</li>
32
</ul><p>From the next lesson, we'll start studying various subject areas and build suitable data models:</p>
32
</ul><p>From the next lesson, we'll start studying various subject areas and build suitable data models:</p>
33
<p>The most significant topic will emerge when we begin to study OOP and ORM. You can have a general idea of subject areas, entities, and relationships. Remember to read the information in the links provided - the more questions you have at this stage, the better.</p>
33
<p>The most significant topic will emerge when we begin to study OOP and ORM. You can have a general idea of subject areas, entities, and relationships. Remember to read the information in the links provided - the more questions you have at this stage, the better.</p>