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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.