1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

From 35 to 17

Discussion in 'Off Topic' started by LPH, Jan 22, 2013.

  1. LPH

    LPH Well-Known Member

    As you probably know, I'm just learning PHP. So bare with me. My evenings are filled with watching video tutorials from Lynda, reading books, websites, and code snippets from others, as well as trying out samples on a local install.

    Today, I was proud to install my first PHP framework. CodeIgniter was chosen because it was free and the first one to look like it had good docs.

    Once CI was installed then I changed some configurations to work with WordPress as well as my PHP project. Next, multiple database configuration needs to be done.

    For now, I was practicing PDO statements.

    The first lines of code done in Coda 2 by hand were over 35 lines (the old mysql_connect methods) - with plenty of comments to make sure I'd remember later what was happening.

    Today, that same code was put into CI and sits at 17 lines - mainly extra lines so I could read it. The actual code is only 5 statements.

    Not bad for a novice.

    What is your best code efficiency? When you look to make code more efficient, do you follow a plan of attack - look for obvious ways - or do you just read through until you see something that can be done better?
     
  2. rellek

    rellek Well-Known Member

    I usually write code in the way I think it's best at this time. I might reconsider it when I need to review it because of feature enhancement or things like that, but I do not write code and try to optimize it later.
     
  3. EQnoble

    EQnoble Well-Known Member

    a couple days ago I went from over one thousand lines to about 80 and actually gained functionality
     
  4. SneakyDave

    SneakyDave Well-Known Member

    Codeigniter is a great framework to learn from, but it's progress has been a little slow coming around to PHP 5.3. If you have the basics of CI and other frameworks, you might want to try Faravel. I've been migrating a lot of my projects to it, and the contributors to CI seem to like it quite a bit.

    http://laravel.com/

    But that's just my personal opinion. Good luck to you. Sometimes those frameworks are a lot of work just to start learning PHP, but at least you're diving in head first.
     
    LPH likes this.
  5. Shamil

    Shamil Well-Known Member

    In terms of code efficiency, I look to remove as many logic statements as possible, or should I say, displace them from whatever is using it.

    Given that I am, by standard, working with objects, whatever I'm doing is quite easy. I normally do follow a plan of attack - an agreed set of standards by our team. We've to take into account both PHP side and MySQL efficiency - but also, security.
     
    LPH likes this.
  6. SneakyDave

    SneakyDave Well-Known Member

    Meanwhile Shamil, the Radon Systems' SSL connection is still broken, as well as the "My Account" page on the site.
     
  7. LPH

    LPH Well-Known Member

    (y)

    Amazing.
     

Share This Page