ext_133593 ([identity profile] bedivere.livejournal.com) wrote in [personal profile] funeralcrasher 2006-07-28 03:02 pm (UTC)

I dunno what language you're working in; but, the general OOP approach is not do have an object called ListStudents (thats a behavior really), but rather to have a Student class, which has all the fields from the table. Then you have some kind of data access class (say StudentDAO, for example, DAO=data access object), which has a method called getAllStudents (or whatever you wanna call it). That class then retreives the data from the DB and returns a list of Student Objects. Then, from where ever you wanna retreive the students in your app/program, you instantiate an instance of StudentDAO, and call StudentDAO.getAllStudents(). Then you can loop through the list of Student objects, and get out all the properties you need for display in HTML or anything else. All of that probably seems a bit much to do something so simple, but it makes for good OO design. I hope that made some sort of sense, I haven't had my coffee yet :)

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting