How to write code the OOP way

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Apr 27, 2019 5:56 am

Tue May 28, 2019 1:57 am

As far as I know I redirect all requests to an entry point, something like a and then this gets redirected to a desired sub-page (if needed). I know the theory of the OOP quite well (like all the syntax elements and how they work) and I know that I would create one file per class (not a necessity but a good way to go).

As related to the above:
a) Where to I actually write code, I mean I create objects from classes, but where does it take place like in Linux filesystem (like I would have and I would code there). Where does it go in the OOP way?
b) Do all conditional statements and loops go into objects (I mean, I write this code inside them). I know that I put $_POST and probably other superglobals in objects, so just wondering if my goal would be to have like 100% of the code inside of objects or if there would be cases where I just add it in a procedural way. Just have max amount of code inside of objects or not necessarily? If it is inside and outside (outside being procedural in the mix) what are the rules of this?


PS. And also thanks for the previous info. I know that more advanced things would be better but these are the things that I need to figure out still (self-edu, a year and a half so far).

Post Reply