I'm making a CMS for my computing project and I am thinking of ways that I can go about coding it. I came up with the idea of each section having its own class and communicating with the database through objects. For example, this cms will need to save, for example, projects, photos and members. I would create a class for each one of these, so for project it would have the properties id, name and info and the methods getId(), getName(), setName(), getInfo(), setInfo() and updateDatabase().
On instantiation of a new object you would pass an id to the construct (optional) and it would check to make sure this ID exists, if it does it would pull all the information out of the database about this project and store them in its properties. These properties can then be retrieved using a get method if needed.
When you use a set method, obviously this will change the properties of the object rather than change the database, then you use the updateDatabase() method. When you use this method it checks to see if the current project exists, if it does then it will update the database with the new values, if it does not exist it will create a new record.
Is this an acceptable way to go about this or am I being ridiculous? I like how it feels, it feels organised, neat and not too complicated. I also want to fit in a bit of OOP into my project as the examiners won't be expecting anyone to use programming methods as 'advanced' these (This is at A level, tests you take at 18 before University in England).
Thanks in advance for any input.
~Jamal
On instantiation of a new object you would pass an id to the construct (optional) and it would check to make sure this ID exists, if it does it would pull all the information out of the database about this project and store them in its properties. These properties can then be retrieved using a get method if needed.
When you use a set method, obviously this will change the properties of the object rather than change the database, then you use the updateDatabase() method. When you use this method it checks to see if the current project exists, if it does then it will update the database with the new values, if it does not exist it will create a new record.
Is this an acceptable way to go about this or am I being ridiculous? I like how it feels, it feels organised, neat and not too complicated. I also want to fit in a bit of OOP into my project as the examiners won't be expecting anyone to use programming methods as 'advanced' these (This is at A level, tests you take at 18 before University in England).
Thanks in advance for any input.
~Jamal