1

Topic: [SRP]

Let there is some class MyData which submits data data domain (for example: the Report, the Maze, the Game board...) Accordingly it gives through the methods given to outer objects (for example the report data, maze structure, a position of the player, a board cell etc.) the Question in that where to place a method of creation of the object of class MyData: * in class MyData * in other class, for example MyDataCreator If in class MyData, whether that breaks it principle SRP? If other class, whether that imports it excessive complexity?

2

Re: [SRP]

Hello, nikda, you wrote: N> Let there is some class MyData which submits data data domain (for example: the Report, the Maze, the Game board...) N> Accordingly it gives through the methods given to outer objects (for example the report data, maze structure, a position of the player, a board cell etc.) N> the Question in that where to place a method of creation of the object of class MyData: N> * in class MyData N> * in other class, for example MyDataCreator N> If in class MyData, whether that breaks it principle SRP? If this method is trivial, does not break, if is nontrivial, breaks. N> if other class, whether that imports it excessive complexity? If this method is not necessary, imports, if is necessary, does not import.

3

Re: [SRP]

Hello, nikda, you wrote: N> Let there is some class MyData which submits data data domain (for example: the Report, the Maze, the Game board...) N> Accordingly it gives through the methods given to outer objects (for example the report data, maze structure, a position of the player, a board cell etc.) So MyData should store only the data in their pure type, and reports and other should be generated in view. N> the Question in that where to place a method of creation of the object of class MyData: N> * in class MyData Template pattern N> * in other class, for example MyDataCreator Factory pattern N> If in class MyData, whether that breaks it principle SRP? No. N> if other class, whether that imports it excessive complexity? Depends from. Factory do if there are many different entities which you want to produce but produce any abstraction or  hiding implementation details.

4

Re: [SRP]

Hello, nikda, you wrote: N> Let there is some class MyData which submits data data domain (for example: the Report, the Maze, the Game board...) N> Accordingly it gives through the methods given to outer objects (for example the report data, maze structure, a position of the player, a board cell etc.) N> the Question in that where to place a method of creation of the object of class MyData: N> * in class MyData N> * in other class, for example MyDataCreator N> If in class MyData, whether that breaks it principle SRP? Is not present does not break. With this  and the designer of a class breaks SRP a class. N> if other class, whether that imports it excessive complexity? Imports, superfluous places-files where it is necessary to look. All is better concerning to MyData to hold in . A file or a class.

5

Re: [SRP]

Hello, nikda, you wrote: N> Let there is some class MyData which submits data data domain (for example: the Report, the Maze, the Game board...) N> Accordingly it gives through the methods given to outer objects (for example the report data, maze structure, a position of the player, a board cell etc.) Through methods express behavior, if it simply data access we deal with a normal data structure. N> a question in that where to place a method of creation of the object of class MyData: N> * in class MyData N> * in other class, for example MyDataCreator If this "the creation method" is engaged in stupid selection of storage under object he does not need to be created, it already is: the operator new. N> If in class MyData, whether that breaks it principle SRP? Does not break. N> if other class, whether that imports it excessive complexity? Introduces.

6

Re: [SRP]

7

Re: [SRP]

https://ru.wikipedia.org/wiki/GRASP the Class should create copies of those classes which it can: to Contain or aggregate; to Write down; to Use; to Initialize, having the necessary data. Here the Author (): Kreg Larman Publishing house: Williams Tsena: 533. Application UML 2.0 and designing templates - world famous issuing with which help it is possible to start "to think objects" and to penetrate into the essence of the object-oriented analysis and designing. Being based on two previous issuings, about GRASP it is more written, but too it is compact enough and, in difference from another all a known abbreviation, it  can be applied as recipes "how to do" and not just as signs of, it is not necessary how to do. More shortly, taking an opportunity I recommend.

8

Re: [SRP]

Hello, VTT, you wrote: VTT> Hello, nikda, you wrote: N>> Let there is some class MyData which submits data data domain (for example: the Report, the Maze, the Game board...) N>> Accordingly it gives through the methods given to outer objects (for example the report data, maze structure, a position of the player, a board cell etc.) N>> the Question in that where to place a method of creation of the object of class MyData: N>> * in class MyData N>> * in other class, for example MyDataCreator N>> If in class MyData, whether that breaks it principle SRP? VTT> If this method is trivial, does not break, if is nontrivial, breaks. N>> if other class, whether that imports it excessive complexity? VTT> if this method is not necessary, imports, if is necessary, does not import. Data storage and provision what that of the partial information from  already violation SRP. In an ideal should be - POCO  storing the data and to it one more  with functions which accept  as parameter and return from it the necessary information