1.11M Members

I'm Not Sure What it's Called

 
0
 

I call it "Compartmentalization", that is, taking a long .php file and breaking it down into smaller components; Seperate .php files.

This will keep everything tidier, cleaner, more organized, reusable and I believe, more secure.

Example (Not my code - Maybe not a perfect example of this idea, but for illustration sake):

<?php

$server = "";
$dbuser = "";
$dbpass = "";
$database = "";

?>

What is this called?

Can anyone direct me to an online resource detailing this? Best practices. I need to do this and I need to do it correctly.

Thank you in advance!
Matthew

 
1
 

It's a modular approach. However, perhaps since you are redesigning anyway, you can try an Object Oriented approach.

 
0
 

I just viewed your link on the OO approach. Very nice and educational.

I am trying to envision how this would work with my project. Not sure yet.

Although I am having some issues with the coding, the project is not as large on the back-end as people may assume. I will be storing much data, but the actual processing is simple.

One of my main concerns is security (A topic for a later time).

I will have to keep in mind your fine example of the keycard/lock. How does this relate to this project? (Rhetorical)

I believe this approach may be good when handling the registration of new Users, a process more complex than people think. Plus, I'm building my own, advanced Captcha system, so the OO approach may work there great. Also, I'm designing a security-bot; More on that in the future.

Thank you for your help!
Matthew

 
1
 

If you do not want to go OOP just yet, you can divide your code into logical functions and separate them into include files. Basically that's the first step, whether you use functions or classes.

Isn't it about time forums rewarded their contributors?

Earn rewards points for helping others. Gain kudos. Cash out. Get better answers yourself.

It's as simple as contributing editorial or replying to discussions labeled or OP Kudos

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article