dcsimg
www.webdeveloper.com
Results 1 to 14 of 14

Thread: CakePHP vs PHP

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    CakePHP vs PHP

    I have been using a mixture of both as of late. I find that CakePHP is faster to use when you are used to it. From my experience, their slogan "Convention over Configuration" is beautifully suited to commercial and operational incidents as well as creating a standard much like HTML from SGML. Please give me your opinions on whether or not:
    • CakePHP is the next step for php.
    • Model-View-Controller is a concept that should be made standard where possible.
    • The future of software services are online and tablets for non-power-users.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,617
    1. Well, Cake is by no means the only player in the world of PHP MVC frameworks. Just off the top of my head: CodeIgniter, Zend, Symfony, Lithium, Yii to name a few. Some, like CakePHP, have been around for several years now. If you're looking for the "next step", check out Lithium.

    2. MVC is very useful in many situations, but it is only a tool, and may not be the right tool for all situations. I see no need to make it a standard, just as I see no need to make OOP a standard (what if I want to use aspect-oriented programming, instead?).

    3. My crystal ball is not working today, but I'm not sure what that has to do with PHP and MVC frameworks.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2012
    Posts
    2
    I appreciate your reply NogDog, I will look into those frameworks tonight. Do you think Javascript will be phased out in HTML6?

  4. #4
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    Sound like essay questions to me.

    Anyway, your previous question is malformed.

    HTML is a mark-up language used for structure and presentation, it's not a client-side scripting language. JavaScript is not going anywhere, any time soon. I'm bewildered at how you've become so confused that you could even imply that HTML can, or is going to, overthrow JavaScript.

    In order for HTML6 (which isn't even on the horizon yet) to become so full and complete that it could accomplish anything JavaScript can, it would have to become a scripting language itself, probably one very similar to JavaScript, which kind of makes the entire discussion rather pointless. Anyway, that's a discussion for the JavaScript boards.

    Not sure what you mean when you say you've been using a mixture of PHP and CakePHP; they're one and the same. CakePHP is simply a framework written in PHP to speed up application development and provide a simple and logical development environment.

    Frameworks in my opinion are only useful for intermediate-and-above developers who have a firm grasp of their language of choice. I'm actually getting sick of the number of frameworks popping up all over the place that all pretty much do the same thing. It's like the jQuery forum where no-one actually bothers to learn JavaScript any more, normally thinking it's a separate language, despite relying on the JavaScript language to run their frameworks.

    I like them, [sarcasm]but there should be a law requiring people to first demonstrate proficiency in their chosen language before being given rights to use frameworks!![/sarcasm]

  5. #5
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    How do you get support for CakePHP? I once asked a question, in the question and answer part of their site, and it was never answered. I notice that this happens with a lot of the questions people post there.

    This is the place I am talking about: http://ask.cakephp.org/

  6. #6
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    Maybe make friends with people who use it? Other than asking on the official forums, you can try around these boards, and you might find answers on Stack Exchange, personally I hate SE and it's nasty workings, but there's a lot of developers on there. Don't go asking anything too complicated mind, they don't like that. Don' say "thanks" either, they'll delete it on your behalf.

    It's just my opinion, but you only recently made postings wanting to learn more about OOP. Maybe it would be more worthwhile learning OOP without trying to learn it through a framework. I would say just write your own basic OO code and have your own simple projects rather than trying to learn frameworks without having a firm grasp of OOP in the first place.

    Don't let me discourage you though, if it's what you feel is best then go for it. I just think it'll be more difficult learning OOP if you try learning it through a framework over simply making your own basic projects.

  7. #7
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    Quote Originally Posted by George88 View Post
    Maybe make friends with people who use it? Other than asking on the official forums, you can try around these boards, and you might find answers on Stack Exchange, personally I hate SE and it's nasty workings, but there's a lot of developers on there. Don't go asking anything too complicated mind, they don't like that. Don' say "thanks" either, they'll delete it on your behalf.
    I know a similar site like that. It's called Stack Overflow. I run into it sometimes when I've got some random problem and I'm Googling for answers. This site, like you describe Stack Exchange, is a bit odd too. There was somebody who posted a question asking people their opinions on something to do with MVC and it got a lot of thought-provoking answers. The mods came and closed it because the question was "not clear enough" and would "inspire debate." I think they closed a question that was contributing to the site =\

    Quote Originally Posted by George88 View Post
    It's just my opinion, but you only recently made postings wanting to learn more about OOP. Maybe it would be more worthwhile learning OOP without trying to learn it through a framework. I would say just write your own basic OO code and have your own simple projects rather than trying to learn frameworks without having a firm grasp of OOP in the first place.
    Short answer: I don't know what I'm doing.

    Long answer: I know if I don't focus on something, I will get overwhelmed by the massive amount of information I need to assimilate in order to become a competent OO PHP developer, and probably give up. So I really do see what you're saying. CakePHP was something I messed with a few months ago and gave up on because I was having trouble getting support on the site.

    What would make me happy as a lark right now is if I could go in my site, and set everything up to be ready to use the MVC pattern before I start writing classes and whatnot. Like I would be so glad to know just what folders I need to make: "models", "views", "controllers"? And what to put in them: Start out with just model.php, layout.php, and controller.php?? Somehow I think it's not this simple >.>

    And sorry for hijacking your thread vim_espresso, but this was too long to put in a private message. Apparently this site has a 2,000 character limit

  8. #8
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    I can't really sympathise with you on this one because I learnt object oriented programming in C++. PHP is a little different but generally the same, and I had no frameworks to worry about, just projects and code samples. I also had a pretty solid understanding of procedural programming from C and C structures. Structures are the predecessor to classes, so understanding what they are and how they work also made it easier to pick up classes.

    If you completed that YouTube video I sent you and wrote the code, maybe you could extend it to incorporate some simple classes like users/login/database? Might be an easy little project for you.

  9. #9
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    Quote Originally Posted by George88 View Post
    If you completed that YouTube video I sent you and wrote the code, maybe you could extend it to incorporate some simple classes like users/login/database? Might be an easy little project for you.
    I did watch the video and I did go along with it and makes the files, folders, and scripts. It was nice to actually see a MVC pattern come together. I'm not sure what to do now, though, because I heard there is stuff missing from the tutorial. I'm not sure what I need to change about my files and file structure to be up-to-date. I thought I'd just find a more advanced MVC tutorial but there's so many of them. I don't know if a given tutorial is teaching me the most up-to-date concepts either.

    I guess what I'm asking is, what qualities should I look for in the MVC pattern a tutorial teaches me to make? And what should I avoid?

  10. #10
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    To be honest I don't know why you would want something more advanced than this at your stage in OOP. The tutorial is not entirely up-to-date, but it's still useful for learning the principles and logic behind the MVC framework.

    I wouldn't say it's outdated, but it's certainly not complete. I think the point behind the video is to act as more of a first step into MVC than to be a complete tutorial on how the framework is supposed to be. I personally like the codeigniter framework; it may be worth a consideration. There's much documentation on their page found here: http://codeigniter.com/user_guide/

    I don't actually use MVC frameworks very much so I'm not the best person to advise you on this. I still claim that learning OOP is better done without a framework, but I think you can get by just find if you really want to go that route. Out of interest, what sort of level do you actually consider yourself to be at when it comes to objects and classes? Can you articulate your level of comprehension? If not I would say go back to the drawing board and learn more of the basics before learning frameworks; but again, don't let my words discourage you from your goals.
    Last edited by George88; 07-27-2012 at 04:31 PM.

  11. #11
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,617
    Where the files go on the file system is not really part of the MVC pattern, it's simply an implementation decision. While it certainly makes sense to implement such a framework with separate folders for M, V, and C elements, exactly where they go in the hierarchy, whether you allow sub-folders withing those folders, what other folders you need for supporting files, and what file(s) belong at the top of the directory are all specific to the framework being used (or that you create yourself). In theory, everything could be in a single folder and still implement a MVC pattern, though that's probably not recommended (unless it's a very small project ).

    If you want to see the details of creating a "real" MVC application not based on an existing framework, you could look at PHP 5 Social Networking. I got a review copy of this book a while back and thought it was pretty decent (with the exception that I thought they should have made more use of class inheritance).

    But there's no real reason you have to take this "big bang" approach to learning OOP. If you keep in mind the ideas of reusability and compartmentalization when creating classes for specific, limited purposes, you should find it easy to integrate them into a larger system (MVC or not) as and when you get to that point.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  12. #12
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357
    In response to George:

    Quote Originally Posted by George88 View Post
    To be honest I don't know why you would want something more advanced than this at your stage in OOP. The tutorial is not entirely up-to-date, but it's still useful for learning the principles and logic behind the MVC framework.
    Does this mean you think I'm ready to try out using MVC on a project? What about the URL redirection stuff where you make it so you can load a controller and method and what not just by typing everything into the URL. I don't totally get that yet. I wasn't sure what to study that was MVC related, so I spent the last few days focusing on OO PHP in general. Is it necessary that I use the URL thing?

    Quote Originally Posted by George88 View Post
    I personally like the codeigniter framework; it may be worth a consideration. There's much documentation on their page found here: http://codeigniter.com/user_guide/
    Going by the bullet list that points out its positive traits, it sounds nice. I bookmarked the page so I can return at a later time.

    Quote Originally Posted by George88 View Post
    I still claim that learning OOP is better done without a framework
    I've heard this a lot, and I never questioned it because its been spoken by people far better at programming than me. I assume that one doesn't write classes when they use a framework, so I can see why I would learn less about OOP, but what I'm wondering about is something else. Is a developer who can both use a framework and develop OOP applications from scratch worth more than one who can just do one or the other? Why or why not?

    Quote Originally Posted by George88 View Post
    Out of interest, what sort of level do you actually consider yourself to be at when it comes to objects and classes?
    Well, I'm not clueless but I'm still a beginner. I'm much more comfortable with procedural PHP, but I want to leave that behind. I get some basic concepts (like inheritance) and I know how to use some features (like abstract classes). I'm not good enough, though, to actually make anything useful. I can't make a login script, or a database script, or anything else a site would actually need.

    Quote Originally Posted by George88 View Post
    Can you articulate your level of comprehension?
    Hmm. You want me to verbalize what I think I know? Well, I get that OOP makes it easier for multiple coders to work on the same project, because the client coders only need to learn the interface and that's never as complicated as the implementation. I'm guessing the implementation is the whole of what is contained in the classes and the interface is whatever has been made public.

    I can sort of see how bugs are less likely with OOP than procedural programming. For one, the client coders can only change what the interface lets them change, so they are less likely to mess something up. For two, code inside a class is isolated from code elsewhere in the application, especially if it's private or protected. I'm guessing this lessens the likelihood of unfavorable interactions.

    I can see how OOP could make web application development a lot faster than just procedural programming. Writing the classes is a big time investment up front but if they are generic enough then they could work on a lot of sites, regardless of database used, login information required, or what have you, because the objects derrived from them can be customized to fit the needs of the particular site. I guess if you don't use a framework, then you make your own.

    In response to NogDog:

    Quote Originally Posted by NogDog View Post
    But there's no real reason you have to take this "big bang" approach to learning OOP. If you keep in mind the ideas of reusability and compartmentalization when creating classes for specific, limited purposes, you should find it easy to integrate them into a larger system (MVC or not) as and when you get to that point.
    So you think I should take my limited knowledge and get a site working in whatever way I can manage?
    Last edited by evenstar7139; 07-28-2012 at 04:31 AM.

  13. #13
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    I'm not entirely sure on the job status of developers. I can't see how one could become employed as a PHP developer simply by understanding a framework alone. It's essential that the underlying principles are thoroughly understood by the programmer; and this would require an in-depth understanding of the language in question. What will you do when something goes wrong? It's almost impossible to debug a project when you don't understand the code. However, I wouldn't be surprised if developers were being hired for their framework knowledge alone.

    If you can't write a login class or database class, why don't you just try? They're very easy classes to write and you'll find much support around this forum and others. Once you've written a few classes and have developed a better understanding of them, I'm sure once you go back to your MVC you'll feel a little easier about the whole thing.

    I actually don't think you're ready to try out writing your own MVC projects at this point; but you might be interested in this http://anantgarg.com/2009/03/13/writ...mework-part-1/

    This tutorial will show you how to redirect the URI and accept parameters to be called in PHP. Be careful of the code, there's a couple of accidental errors where it hasn't been parsed correctly. There's 2 "&&" that have been parsed as "&". It's a little more advanced than the YouTube video, but it'll show you the URI redirection.

  14. #14
    Join Date
    Jul 2012
    Location
    Vancouver
    Posts
    61
    You can create your own MVC 'framework' of your own, it's just the programming method.. CakePHP is actually one of the worst platforms to use for larger sites - it's extremely bloated and prone to security problems much like WP plugins are.

    With propery development and custom libraries ontop of CodeIgniter, you can create something just as powerful and with less overhead, bugs and security issues - assuming you know how to code properly. I always said this about cakephp - "cakephp.. it's in the name. it's fat, makes you run slow but it looks tasty."

    Clean & rapid development is made easier with frameworks - the more features in the frameworks means the more overhead, more possible security issues, etc..

    The idea of MVC should be applied to everything - it doesn't necessarily mean you should follow Model>View>Controller strictly.. It's simply seperating front from backend - giving you the ability to easily interchange your code from both areas of your site, and site to site. There's no reason, and no scenario for any site that shouldn't use this approach (seperating logic and front-end)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles