General Advice - objects, classes and coding style

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • turnitup

    General Advice - objects, classes and coding style

    I am in the process of transforming a procedural code base into an OO
    code base. The code lends itself to this refactoring and it is proving
    an effective exercise.

    However, I am running into a few irritations.

    I am using __autoload to load class files corresponding to code names.

    I've cranked up error reporting, but if for some reason there is a
    syntax error or whatever in a class, the application crashes with no
    explanation. The bug hunt takes ages and lots of echoing.

    Is there anything I can do to help myself? Use of assert, or exceptions,
    or try-catch handling?
  • Jerry Stuckle

    #2
    Re: General Advice - objects, classes and coding style

    turnitup wrote:
    I am in the process of transforming a procedural code base into an OO
    code base. The code lends itself to this refactoring and it is proving
    an effective exercise.
    >
    However, I am running into a few irritations.
    >
    I am using __autoload to load class files corresponding to code names.
    >
    I've cranked up error reporting, but if for some reason there is a
    syntax error or whatever in a class, the application crashes with no
    explanation. The bug hunt takes ages and lots of echoing.
    >
    Is there anything I can do to help myself? Use of assert, or exceptions,
    or try-catch handling?
    >
    Personally, I don't use __autoload. It isn't that hard to add
    require_once statements where necessary.


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • AnrDaemon

      #3
      Re: General Advice - objects, classes and coding style

      Greetings, turnitup.
      In reply to Your message dated Thursday, October 25, 2007, 00:52:55,

      tI am in the process of transforming a procedural code base into an OO
      tcode base. The code lends itself to this refactoring and it is proving
      tan effective exercise.

      tHowever, I am running into a few irritations.

      tI am using __autoload to load class files corresponding to code names.

      tI've cranked up error reporting, but if for some reason there is a
      tsyntax error or whatever in a class, the application crashes with no
      texplanation. The bug hunt takes ages and lots of echoing.

      tIs there anything I can do to help myself? Use of assert, or exceptions,
      tor try-catch handling?

      Did You read user comments on Autoloading Objects article?

      There's some useful info and good examples.


      --
      Sincerely Yours, AnrDaemon <anrdaemon@free mail.ru>

      Comment

      • ZeldorBlat

        #4
        Re: General Advice - objects, classes and coding style

        On Oct 24, 4:52 pm, turnitup <same@samewrote :
        I am in the process of transforming a procedural code base into an OO
        code base. The code lends itself to this refactoring and it is proving
        an effective exercise.
        >
        However, I am running into a few irritations.
        >
        I am using __autoload to load class files corresponding to code names.
        >
        I've cranked up error reporting, but if for some reason there is a
        syntax error or whatever in a class, the application crashes with no
        explanation. The bug hunt takes ages and lots of echoing.
        >
        Is there anything I can do to help myself? Use of assert, or exceptions,
        or try-catch handling?
        You might have turned up error reporting, but did you enable display
        errors? If not you won't see them. You should always enable
        display_errors when developing, and disable it in production. In
        production use log_errors so your error messages go to a file instead.

        Comment

        • JustinCarmony

          #5
          Re: General Advice - objects, classes and coding style

          On Oct 24, 2:52 pm, turnitup <same@samewrote :
          I am in the process of transforming a procedural code base into an OO
          code base. The code lends itself to this refactoring and it is proving
          an effective exercise.
          >
          However, I am running into a few irritations.
          >
          I am using __autoload to load class files corresponding to code names.
          >
          I've cranked up error reporting, but if for some reason there is a
          syntax error or whatever in a class, the application crashes with no
          explanation. The bug hunt takes ages and lots of echoing.
          >
          Is there anything I can do to help myself? Use of assert, or exceptions,
          or try-catch handling?
          I would definitely check your php.ini's Error Reporting settings. To
          find out what your PHP's settings are, you can make a new php file and
          put:

          <?php
          echo phpinfo();
          ?>

          It will show you where your php.ini file is, as well as your
          display_error settings.

          Comment

          Working...