SitePoint Sponsor

User Tag List

Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 81
  1. #51
    SitePoint Member
    Join Date
    Dec 2004
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mihd View Post
    can you show us a benchmark and not just throw words up in the air

    In fact I can:

    http://www.webmasterstop.com/56.html


  2. #52
    Not yet perfect mattalexx's Avatar
    Join Date
    Oct 2005
    Location
    Taos, NM, US
    Posts
    441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jamesm6917 View Post
    Classes slow down applications, its a proven fact, so not in all cases are they good for development.
    This is definitely true. The catch is, the slight decrease in the execution time of a script that uses OOP as opposed to a function library becomes a non issue when you consider the benefits (code reuse, portability, the ability of a programmer to build an object that can be used easily by another programmer that may be less familiar with the app, the list goes on, ..).

    When I started programming in OOP, I never looked back. The actual size of my scripts is much less and because I was able to use so much of the same code in various applications, my development time literally reduced by 50%. It's like I built robots to do all the work for me.

    Some of this functionality can be applied to function libraries, but why?
    Matt Alexander
    Alexander Site Design

  3. #53
    SitePoint Member
    Join Date
    Dec 2004
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mattalexx View Post
    This is definitely true. The catch is, the slight decrease in the execution time of a script that uses OOP as opposed to a function library becomes a non issue when you consider the benefits (code reuse, portability, the ability of a programmer to build an object that can be used easily by another programmer that may be less familiar with the app, the list goes on, ..).

    When I started programming in OOP, I never looked back. The actual size of my scripts is much less and because I was able to use so much of the same code in various applications, my development time literally reduced by 50%. It's like I built robots to do all the work for me.

    Some of this functionality can be applied to function libraries, but why?

    Agree, I do the same, but for the beginner that just wants a small app and does not need a goliath web application, then functions will do.

  4. #54
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Templates is another thing I don't get. What is the point in separating the presentation but putting placeholders in, only to drag it all back again and replace the placeholders with the data? Why not just put the data straight in in the first place?

  5. #55
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    edge of nowhere
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Suppose 10 weeks later you hire a designer to re-skin your site. Say you hire an absolute design genius, but no PHP skills whatsoever.
    Would you trust him to go about fiddling with your pages possibly touching the php code and making everything not work?
    Programming boils down to three things: fast, good and cheap.
    Please pick two.

  6. #56
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Chicago
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't mess around with template syntaxes. Instead I just use PHP short tagged variables to represent various page elements or content areas embedded in the HTML code. Besides, for a content-rich site, it's still necessary to have some loops and conditions.

  7. #57
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    edge of nowhere
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's not a good approach.

    1. Short tags can be disabled, breaking your code. That's a templating method in itself.
    2. You can still use loops and conditions either via PHP itself as the template lang or via a meta-lang, like for example Smarty uses. The point is keeping business code away from presentation code.
    Programming boils down to three things: fast, good and cheap.
    Please pick two.

  8. #58
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sebulbus View Post
    The point is keeping business code away from presentation code.
    Concentrate on the three-tiers technique and it is just as simple as this
    Would you like to withdraw more cash?
    Make money while sleeping?
    Turn 7$ into 2000$ in 2 weeks?
    I need to know more about that

  9. #59
    SitePoint Zealot lutrov's Avatar
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    159
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Having used both Smarty and PHP alternate syntax a fair bit over the last six years or so, and now refusing to use Smarty anymore, I'll chip in with my 2 cents:

    Would you trust him to go about fiddling with your pages possibly touching the php code and making everything not work?
    Yes, because whether you're using Smarty or PHP in your "template" files, the perceived danger is the same. Things won't work in the template. So what? Granted, the gee-wizz designer could do more damage with PHP than with Smarty but that's probably unlikely. The probable outcome is that the gee-wizz designer will make either basic syntax or logic errors and if that's the case, the output will be pretty much the same.

  10. #60
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use CodeIgniter framework, base on MVC , it is a good structure and even if you don't use CI, if you reed the first chapter of the documentation, nice explained, you will see a good example of "order".

  11. #61
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sebulbus View Post
    Suppose 10 weeks later you hire a designer to re-skin your site. Say you hire an absolute design genius, but no PHP skills whatsoever.
    Would you trust him to go about fiddling with your pages possibly touching the php code and making everything not work?
    Even if you are using a template language, I'd bet that you still have to charter some programmer to turn that new design into something functional. The designer probably won't get it.

    Actually, I jumped to that conclusion.. has there been a PHP-dunce designer who could go through, create a new design, and then edit all the template-lang-type statements back into said design? The only way I could see this happening is if there were tags that looked like html, but offered additional functionality (<if>, <repeater>, <cycle>, etc). But even then, if you had something like the following, I bet that php-dunce designer would get thrown for a loop: <div class="alt1 <if condition="{$current}">current</if>">words and such.</div>

    I can understand the seperation of most code from design, as it makes my life as a programmer easier, but I'm not sure if it makes the designer's job easier at all..

  12. #62
    SitePoint Evangelist AlienDev's Avatar
    Join Date
    Feb 2007
    Location
    UK
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sebulbus View Post
    Suppose 10 weeks later you hire a designer to re-skin your site. Say you hire an absolute design genius, but no PHP skills whatsoever.
    Would you trust him to go about fiddling with your pages possibly touching the php code and making everything not work?
    No, why I would i trust him to change php files? He is a DESIGNER, not coder. Designers shouldnt ever need to change php
    Me on StackOverflow | Blog & personal website.

    I mostly use: PHP, Java, JavaScript, Android.

  13. #63
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't matter if it's php, python or smarty, if they break it, they break it

    A better and more maintainable solution would be to use PHP & XSLT.

  14. #64
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI

    What if you don't want to give your source to someone? Is it possible to encrypt your files with ION cube or Zend encoder if you're using some of mentioned frameworks ?

    What is the procedure?

    Thanks
    www.mangiaphoto.com - daily photo news
    www.serveradminblog.com - Open source tips and tricks

  15. #65
    SitePoint Guru rageh's Avatar
    Join Date
    Apr 2006
    Location
    London, Formerly Somalia
    Posts
    612
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    CI and Cake are trash compared to Symfony.
    Why are Codeigniter and Cake trash? Can you explain a bit further? What is it about Symfony that is so promising in comparison?
    ------------------

  16. #66
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sebulbus View Post
    That's not a good approach.

    1. Short tags can be disabled, breaking your code. That's a templating method in itself.
    2. You can still use loops and conditions either via PHP itself as the template lang or via a meta-lang, like for example Smarty uses. The point is keeping business code away from presentation code.
    1. Don't use short tags then..
    2. See all the other comments - if you have loops in your template meta language, it is just as easily broken as if you just used php in the first place instead of wasting time with templates.

    And I do keep my business logic code separate, in the classes. The presentation layer then uses these classes and outputs the html directly. Using a template to do that is just creating an extra layer of complexity for no added benefit whatsoever.

  17. #67
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jamesm6917 View Post
    from the horse's mouth http://devzone.zend.com/article/1236...ramming-in-PHP

    the FACT that you complain about PHP's OOP speed and the SAD FACT that this topic exist just goes to show you OOP in PHP is an after though. PHP was never build with OOP in mind from the ground up unlike Ruby, Python, Java or C#.

    for programing languages that build with OOP from the ground up, the speed is never the issue and the NAME SPACE is how you organize your code and not some made up "blah_class.php".

    PHP6 promise the support for Name Space and other OOP goodies. let's hope Zend doesn't put out yet another half-baked OOP support in PHP.

  18. #68
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its kinda funny

    the procedural guys claiming OO is slower (tho still no benchmarks presented of latest PHP5 with APC of procedural vs OO)

    they seem completely oblivious to the benefits OO when used properly by knowledgeble programmers for medium to large size projects (no im not talking about mickey mouse blogs or small sites, im talkin about large web apps that actually make alot of money)

    its hilarious that users are arguin about OO vs Procedural when in fact most of the speed problems with php come from them using Apache (mod_php) not a server like lighttpd or nginx (php fastsci) which would give them a magnitude faster results for large sites, its like arguing about the size of the engine in a truck which has bicycle wheels on!

    also alot of webapps are slowed not by php but by mysql, using latest mysql with innodb and memory tables + ramdrive caches + memcached will help alot, tho it seems from the posts here alot of users use shared hosting (where speed is out of theitr controll anyways) and wouldnt know how to run own servers or compile programs on linux or optimise large php sites


    its quite apparent from this thread that there are many misconceptions about PHP which is sad

    btw the example @ http://www.webmasterstop.com/56.html is very badly written! the muppet initializes the object every time arround the loop! lol

  19. #69
    Free me php klassicd's Avatar
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    I've been using the Zend Framework since it was first made available. It has been the best aide in teaching me php 5 and object orientated programming.
    Code:
    /stage (apache document root and phing build directory)
    /branches
    /tags
    /trunk
        /app
            /www
                /controllers
                /views
            /cli
                /controllers
                init.php
            /admin
            /ads
            /mail
            bootstrap.php
        /build-tools
            build.xml
        /data
            /cache
            /uploads
            /sql
            /sessions
            app.log
            php.log
        /docs
        /etc
            apache2.conf
            php.ini
            app.ini
        /lib
             /Zend
             /PersonalFramework
        /share
            /www
                /images
                /css
                /js
            /admin
            /ads
            /mail
        /tests

  20. #70
    SitePoint Evangelist spoondevil's Avatar
    Join Date
    Jun 2001
    Location
    Harlow, Essex, UK
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    root
    - includes
    - - connections
    - - defaults
    - javascript
    - media
    - - audio
    - - css
    - - images
    - - flash

  21. #71
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    /index.php
    /rpc.php
    /boot.php
    /dynamic
    --frontend
    --backend
    ----modules
    --cache


    /static
    --images
    ----global
    --css
    ----global
    --flash
    --javascript
    --misc


    all basic php classes goes into/dynamic/backend while site modules ie the model goes into /dynamic/backend/modules
    all templates ie the view goes into /dynamic/forntend/**Template Name**
    all template related images and css goes into /static/images/**Template Name** /static/css/**Template Name**
    in both images and css folder there is a global folder. in global folder all the images/css used globally by all templates will be placed
    boot.php when included in any php file boot's up/initialize the whole application
    the main class and the main controller is located in /dynamic/backend/main.php which routes the traffic to the modules
    rpc.php allow to call the module methods which will return the data in json xml or normal html
    Last edited by ak007; Sep 6, 2007 at 02:07.

  22. #72
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting the mix of replies on this topic.

    I use my own MVC Framework. I will never go back to doing things the way I did before. When you start to get very huge applications, it's can be a nightmare to maintain and evolve to work with new features and requirements. So, separation of things into the various MVC layers makes a cleaner more manageable design.

    For those that throw function libraries into a main include, what if you jsut don't need all those libraries on every page? With MVC, you dynamically load only what you need for a particular functionality. I'd gladly trade off a few microseconds for less scratching my head when it comes to how am I gonna work in some new functionality.

    Most of my reusable includes are outside of the web root. I use XAMPP in the opt folder on Linux.

    /opt/myframework/config (server specific config)
    /opt/myframework/includes

    In the includes:
    auth/
    db/
    debug/
    error/
    export/
    html/
    ldap/
    log/
    mvc/
    mail/
    states/
    types/
    xml/



    In the webroot, I have:

    opt/xampp/htdocs/app1
    opt/xampp/htdocs/app2
    opt/xampp/htdocs/app3

    Inside an app folder:
    config/ (app specific config)
    css/
    java/
    images/
    realm/
    template-cache/

    The realm folder contains related sets of sub applications. Inside a realm folder would be at least:
    models/
    templates/

    and optionally
    includes/
    web-services/


    Each template folder has an optional nav.tpl file. It contains a category name and set of links to the sub applications. If the file exist, the framework will pick it up and stick it into the left side main application navigation automatically. So, I can drop in new sub applications easily without having to change any of the main templates.

    I use mod_rewrite to alter the URL:
    http://msite.com/app1/realm/model/event

    becomes

    http://msite.com/app1/index.php?real...del&event=some -event

    Every application has a default realm which contains the an error model, a login model, logout model, maintenance model. The default templates contain templates for each for the above models, plus common data output utilities, like result.tpl which prints a beautiful table for any 2d array of output from a database query, complete with optional pagination.

    index.php loads my controller. The controller looks for the model named some- model and loads it. If the model is not found, it loads the error model and sends it the error code for "Model not found". If the model exists, the controller checks if login is required and if not logged in, loads the login model instead, remembering the path of where the user was trying to go so it can take them there once they've logged in. Also, the controller looks at the event the user is requesting and checks if it's a restricted event. If so, it looks up that user's membership in any group that is allowed access to that event. If not a member, the error models is loaded with a "Your not Authorized" message.

    Each model is derived from a parent model which gives the same base functionality, like session management, database connectivity, creating the base view which loads the main templates for that sites look and feel. Adding a new page can be as simple as creating a new empty model derived from one of the parent models and calling the display() function. Only a few lines of code. If I need to output a phone list of all employees. I add just a few lines: query = "some sql", execute query, fetch all to array, assign result template, assign result array, display.

    As I said, I'll never go back to the old way of doing things. I'm still learning, but MVC, OOP has made things much easier without a doubt. It's a "night and day" difference.

  23. #73
    SitePoint Member
    Join Date
    Dec 2004
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mihd View Post
    Its kinda funny

    the procedural guys claiming OO is slower
    Please do not presume how much I know about OOP. I know a lot. I myself build all my large application using my own MVC Pattern with PHP5 OOP. I reuse code all the time with my own class and function libraries. I do not stereotype myself as any type of coder. I myself run my own dedicated server and have run many commands on it. APC has it drawbacks too, because it can use more memory on your server.

  24. #74
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easy.. use a real language, not one with OOP bolted on and mixed with procedural functions that can't even keep a consistent name among all of them.

  25. #75
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by robsp View Post
    Easy.. use a real language, not one with OOP bolted on and mixed with procedural functions that can't even keep a consistent name among all of them.
    oh php is far from perfect but what do you suggest?


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
  •