Jump to content

question about my programming method.


asmon

Recommended Posts

I have the index.php page and 2 classes

index.php, display.class.php, actions.class.php

 

each function in the display class is the page content while the actions class are the POST actions.

therefore in the index.php i have a switch for displaying each page

 

if (isset($_POST['submit1']))
    actions_class::submit1();
else if (isset($_POST['submit2']))
    actions_class::submit2();

switch ($_GET['view']) {
    case 'register':
        display_class::register();
        break;
    case 'users':
        display_class:users();
        break;
}

 

is there something bad about programming this way?

i like it because it's easy to understand and maintain

Link to comment
https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/
Share on other sites

yah, but i was reading one article and it said something about big classes or using classes for things they are not meant for

which is what i am doing here

and i'm just wondering if there's something wrong about it.

 

Sounds like a very strange article, can you post a link to it ?

 

A class should have ONE purpose, and ONE purpose only. Better to have 10 small classes than 1 big. Better maintainability and structure.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.