asmon Posted August 4, 2009 Share Posted August 4, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/ Share on other sites More sharing options...
Highlander Posted August 9, 2009 Share Posted August 9, 2009 Are you trying to use OO design? Because that piece of code is just like regular functional coding. But you are thinking correct when you separate form code from view code. Quote Link to comment https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/#findComment-893947 Share on other sites More sharing options...
Daniel0 Posted August 9, 2009 Share Posted August 9, 2009 Because that piece of code is just like regular functional coding. No, it's procedural. Functional programming is a much different paradigm. Quote Link to comment https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/#findComment-893990 Share on other sites More sharing options...
Highlander Posted August 9, 2009 Share Posted August 9, 2009 Because that piece of code is just like regular functional coding. No, it's procedural. Functional programming is a much different paradigm. Yea, my bad. Wrong word Quote Link to comment https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/#findComment-894033 Share on other sites More sharing options...
asmon Posted August 9, 2009 Author Share Posted August 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/#findComment-894211 Share on other sites More sharing options...
Highlander Posted August 9, 2009 Share Posted August 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/168820-question-about-my-programming-method/#findComment-894236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.