DDD: 개념을 명시적으로 검증하는 규약

10136 단어 확인

처음 코드

 1     class       1
 2     {
 3         public void   (Guid employeeId, DateTime startDate, DateTime endDate)
 4         {
 5             var      =              (employeeId);
 6             var      = (endDate - startDate).Days;
 7 
 8             if (     >     )
 9             {
10                 //      
11             }
12 
13             //            
14         }
15 
16         private int              (Guid employeeId)
17         {
18             return 10;
19         }
20     }

한층 더 재구성하다

 1 class       2
 2     {
 3         public void   (Guid employeeId, DateTime startDate, DateTime endDate)
 4         {
 5             if (!          (employeeId, startDate, endDate))
 6             {
 7                 //      
 8             }
 9 
10             //            
11         }
12 
13         private bool           (Guid employeeId, DateTime startDate, DateTime endDate)
14         {
15             var      =              (employeeId);
16             var      = (endDate - startDate).Days;
17 
18             return      <=     ;
19         }
20 
21         private int              (Guid employeeId)
22         {
23             return 10;
24         }
25     }

계속 재구성

 1     class       3
 2     {
 3         public void   (         )
 4         {
 5             if (!  .    ())
 6             {
 7                 //      
 8             }
 9 
10             //            
11         }
12     }
13 
14     class       
15     {
16         private Guid employeeId;
17         private DateTime startDate;
18         private DateTime endDate;
19 
20         public       (Guid employeeId, DateTime startDate, DateTime endDate)
21         {
22             this.employeeId = employeeId;
23             this.startDate = startDate;
24             this.endDate = endDate;
25         }
26 
27         public bool     ()
28         {
29             var      =              (employeeId);
30             var      = (endDate - startDate).Days;
31 
32             return      <=     ;
33         }
34 
35         private int              (Guid employeeId)
36         {
37             return 10;
38         }
39     }

좋은 웹페이지 즐겨찾기