SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 47 of 47
  1. #26
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haha, that is a pretty funny quote..."spaghetti code"...
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us

  2. #27
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting article. He is a Lisp guy though and as such part of the continually influential minority. The predominant languages today, as in yesteryear, flow from the workmanlike designs of Algol and C. But those other languages have always been nipping at the edges. Will the future be any different.
    Christopher

  3. #28
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DougBTX
    define('DEFAULT_CONTROLLER', -1);
    what's wrong with that anyway ?

  4. #29
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken
    what's wrong with that anyway ?
    Why does everything suddenly have to come in all capitals if it is procedural code? I thought it was "well, it is procedural, therefore bad, therefore we should make it as ugly as possible". If you don't have my aversion for DOING THINGS IN ALL CAPS FOR NO REASON then the code probably looks alright

    Douglas
    Hello World

  5. #30
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh ... that's just convension ... define() looks like the C statement by the same name (witch isn't exactly the same, since a define() in php is actually a constant, while in C it's a preprocessor-statement)

  6. #31
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I ususally do my defines all uppercase as well.
    Christopher

  7. #32
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    define('AGREE'true); 
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  8. #33
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
      define('CODING_STYLE_LIKE_THIS''true');
      
      
    $variables_like_this 'true';
      
      class 
    Names {
      
          public 
    $_true;
      
          public 
    Names($true) {
      
              
    $this->_true $true;
      
          }
      
      }
     
     
    $names = new Names('True'); 
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us

  9. #34
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WOW! Hijacking your own thread to start a code style war!!!

  10. #35
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken
    oh ... that's just convension ... define() looks like the C statement by the same name (witch isn't exactly the same, since a define() in php is actually a constant, while in C it's a preprocessor-statement)
    Yes, you're right. It is convention.

    Enjoy it, I won't mind (though I would say it is an unnecessary define in the first place...)

    PHP Code:
    public $_true
    Don't you mean this?

    PHP Code:
    private $_true
    Douglas
    Hello World

  11. #36
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Meh, it was a quick example...anywho

    Viva procedural design patterns...FrontController

    coding is this is interesting, lots of code...
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us

  12. #37
    SitePoint Guru OfficeOfTheLaw's Avatar
    Join Date
    Apr 2004
    Location
    Quincy
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ian,

    You shouldnt call them procedural design patterns... that's largely a distortion imho. Design Patterns are meant as when you recognize a pattern in your code and refactor it for better mantainablity and performance.

    For example,

    switch statment that loads pages -> Front Controller
    multiple if/else statments -> Strategy
    global variables -> Singleton


    to call a switch statement a procedural design pattern is an overstatement... it's what the design pattern is meant to replace!! Of course, by all means, it IS how you should do it procedurally though, and once you understand OOP better, you can refactor that switch statement to a FrontController.

    James Carr, Software Engineer


    assertEquals(newXPJob, you.ask(officeOfTheLaw));

  13. #38
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course, I just wanted to alert people to the fact that I am using prodecural code, so they don't start showing me classes.
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us

  14. #39
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    PHP Code:
    define('AGREE'true); 
    In fact :
    PHP Code:
    define('AGREE'TRUE); 
    (But there's different opinions on this ...)

  15. #40
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken
    In fact :
    PHP Code:
    define('AGREE'TRUE); 
    (But there's different opinions on this ...)
    Come one guys, why not just:

    PHP Code:
    DEFINE'AGREE' TRUE ); 
    Douglas
    Hello World

  16. #41
    SitePoint Zealot Serberus's Avatar
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Quote Originally Posted by DougBTX
    Come one guys, why not just:

    PHP Code:
    DEFINE'AGREE' TRUE ); 
    Douglas
    Or

    PHP Code:
    DEFINE('AGREE'TRUETRUE); 
    Then we can all AgReE to disagree which case aGRee should be because it's case insensitive.

  17. #42
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ian,

    How is this going?

    =Austin
    Austin Hastings - Principal Consultant - Longacre, Inc.

    Anything you can do, you can do better.

  18. #43
    SitePoint Guru OfficeOfTheLaw's Avatar
    Join Date
    Apr 2004
    Location
    Quincy
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Serberus
    Or

    PHP Code:
    DEFINE('AGREE'TRUETRUE); 
    Then we can all AgReE to disagree which case aGRee should be because it's case insensitive.
    The last post on this thread: april 15, 2005 03:15
    YOUR post: april 15, 2006 10:14


    A little late there, no?

    Although I admit, posting EXACTLY one year later was class.

    James Carr, Software Engineer


    assertEquals(newXPJob, you.ask(officeOfTheLaw));

  19. #44
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by OfficeOfTheLaw
    Although I admit, posting EXACTLY one year later was class.
    Actually, he was posting about a constant, not a class
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  20. #45
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    Finland
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Framework
    PHP Code:
    <?php
    function m($modelName){
        return require_once(
    $modelName.'_model.php');
    }

    function 
    v($viewName,$data){
        return require_once(
    $viewName.'_view.php');
    }

    function 
    c($controllerName){
        
    $action $_GET['action'];
        require_once(
    $controllerName.'_controller.php');
    }

    $controller $_GET['module'];

    c($controller);
    ?>
    cool_controller.php
    PHP Code:
    <?php
        $modelData 
    m('some');
        if (
    $action == 'do_something'){
            
    $output v('show_something',$modelData);
        }
        
        echo 
    $output;
    ?>
    some_model.php
    PHP Code:
    <?php
        $data 
    = array('something_to_do_with'=>'FOO');
        return 
    $data;
    ?>
    show_something_view.php
    PHP Code:
    <?php
        $out 
    "<html>";
        
    $out .= $data['something_to_do_with'];
        
    $out .= "</html>";
        
        return 
    $out;
    ?>

    It works. But seriously, OOP is not that hard to understand, and it saves you a lot of trouble in the future.

  21. #46
    SitePoint Zealot Serberus's Avatar
    Join Date
    Oct 2005
    Location
    Herts, UK
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    Actually, he was posting about a constant, not a class
    Oh dear

  22. #47
    SitePoint Evangelist Ian R. Gordon's Avatar
    Join Date
    Feb 2004
    Location
    New York
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haha, this thread. Umm, yeah I kinda moved past this, it was really just an attempt to stave off "learning" OOP. However, I am starting to grasp it fully now, so yeah, this is definately dead.

    Moderator, please lock this thread.
    Ian Gordon
    CSS / XHTML / PHP Programmer
    http://www.iangordon.us


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •