Posted on 2014-09-09
I am creating a small cms and am transitioning away from the older style to OOP. OOP is a little cumbersome and all of the tutorials and articles i have read offer conflicting information.
Currently, i am using PDO to access my database so i am using a mixture of OOP and the old style. However, i am not sure how to take it to the next level.
from my understanding, I perceive that creating a class is like defining an intangible object such as a pdf. Additionally, OOP offers an easier way to view and edit your codes.
From here i am perplexed as im not sure what code i would want to keep together, why or how. Would i create a smaller class and then use extends on it. would i wrap my new PDO code into a larger database code which could perform queries and fetch results in addition to connecting to the database.
I also read that it is wise to keep your viewable code (the code that populates users views) and the executable code (core codes) separate and apart. It is not advisable to include html code in core codes. Once again in a cms most of the code evolves around getting, updating and inserting data. The viewable code is much more common than the so called executable codes. (im not sure if this is a best practice or what).
I have been watching some of the lynda videos but find them confusing as they do not deal with real implementations.
I have also been slowly reading a e-book which one of the members here advised me to read.
Any light on the scenario is welcomed and appreciated