First of all, I would like to say that I understand concepts of Object-Oriented Programing and read about most of the design patterns. What i lack is the skill to combine these things into complete project architecture. Let's say i have these entities(Sample code is in c#):
class Student
{
public int ID{get;set;}
public string FirstName{get;set;}
public string LastName{get;set;}
....
....
}
class Course
{
public int ID{get;set;}
public string Name{get;set;}
...
...
}
- Where do i put my DB modification code. Do i write methods "Load,"Save","Delete" inside the "Student" class or do I create another "StudentDB"?
- When i have methods that select list of student where to put them, inside new class "StudentsList".If i create "StudentList" is it a static class with methods like "StudentsByFirstName","StudentsByLasName" etc?
- Where to keep track of student courses - list property inside "Student" class or create new class "StudentCourses"?
- When class has many properties and i want to return some of them what to do?Have some classes like "Student Short", "Student Full"? When i need to return only partially filled objects ( only few fields read form DB, not whole object ) is it a good practise?
Any books or tutorial that you think might help are welcome
Aucun commentaire:
Enregistrer un commentaire