3 Replies - 402 Views - Last Post: 07 February 2013 - 09:53 AM Rate Topic: -----

#1 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Is this CMS approach ok?

Posted 06 February 2013 - 01:34 PM

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

Is This A Good Question/Topic? 0
  • +

Replies To: Is this CMS approach ok?

#2 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Re: Is this CMS approach ok?

Posted 06 February 2013 - 11:14 PM

Has no one got any input? A simple yes/no, maybe an small explanation as to why and a suggestion on how to do it would more than suffice.
Was This Post Helpful? 0
  • +
  • -

#3 AdaHacker  Icon User is offline

  • Resident Curmudgeon

Reputation: 452
  • View blog
  • Posts: 811
  • Joined: 17-June 08

Re: Is this CMS approach ok?

Posted 07 February 2013 - 09:40 AM

Yes, that's fine - nothing ridiculous about it. What' you're describing is essentially a basic version of the Active Record pattern. It's a fairly basic data access pattern, but fine for a school project.
Was This Post Helpful? 1
  • +
  • -

#4 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Re: Is this CMS approach ok?

Posted 07 February 2013 - 09:53 AM

View PostAdaHacker, on 07 February 2013 - 09:40 AM, said:

Yes, that's fine - nothing ridiculous about it. What' you're describing is essentially a basic version of the Active Record pattern. It's a fairly basic data access pattern, but fine for a school project.


Thanks for the reply :) I'll give that link a read, and look into other data access patterns for my own amusement.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1