Jump to content

MVC/Frameworks


redbullmarky

Recommended Posts

Hi all

Until this morning, I'd never really come into contact with MVC/Frameworks, templating engines, etc.

But an interesting chat i had pretty much stated that it's the only way to go. I currently use Dreamweaver 8 and rely alot on its Templating system - I can put together a pretty hefty site fairly quickly and easily.

So my questions

1, going by the sort of code that Dreamweaver produces, is it the 'wrong' way of doing things? is it wrong to embed PHP into HTML (ie, wrapping HTML in a while loop for repeating regions).

2, is MVC necessary to be 'correct' ?

3, aimed at you seasoned php coders: if you had to continue work where a previous programmer left off, would you be comfortable dealing with code created with Dreamweaver and its templates? or would you find a templating 'engine' more desirable?

4, If my code is well structured and commented as it is, does it matter?

My argument in favour of my current method is that its a preference of mine and that learning/using templating systems can be unnecessary in certain situations.

anyone have any thoughts on these questions or anything else to add for or against?

Cheers
Mark
Link to comment
Share on other sites

I'm personally against using templates created by any program, specifically Dreamweaver. I think that you'll find that things like that rarely pass standards and are usually buggy and quickly become outdated. I personally use some classes as templates, but I wrote them myself and I maintain them.

Having said all that, I've been hearing a lot about this "MVC" stuff lately and I honestly don't have a damn clue what it's about. Anyone care to enlighten me before I run off and do a bunch of research?
Link to comment
Share on other sites

from what i've read, Model/View/Controller. keeping php seperate from html. model = the 'engine' of the code, view = what the user sees and controller = managing user input ($_GET, etc). lots of people are raving on about this if you have a look through google, but it seems like it's a 'preference' thing, with the OOP police who claim that everything HAS to be OO else its crap. to be honest, i've gotten well into OOP and have found it has many benefits. but its definitely not the only way to do things, surely?

my argument is that using a dreamweaver template results in code not much different to a templating engines code. its impossible to totally seperate the coding from the HTML - you're always gonna need to make use of loops in the design to display repeated entries, etc, etc blah blah.
also from what i've looked up, using a template program like smarty is like replacing one syntax (PHP) with another (smarty's) = another load of syntax to learn + a third party bulk of a parser to turn it into something useful. the whole thing seems pointless, yet i'm being told it's "the proper way".

same with frameworks/MVC. is there really anything wrong with using functions seperated into seperate include files that are clearly labelled and commented? or is OOP the only proper way?

in summary - i feel like a bit of a cheat if i'm relying on a 3rd party templating engine to do the front end, someone elses framework to do the backend - not only have i got to learn all this stuff, but doesnt the client deserve a bit more care? if either smarty or the framework has bugs, who gets the blame? smarty? the framework coder? nope, its me.

i know the general answers, but i could do with opinions. ober, i thank you for yours.

cheers
Mark
Link to comment
Share on other sites

Sounds like a load of bullshit to me. Sure OOP is nice for the right application, but not all applications warrent the use of it. I would be willing to wager that 90% of the people on this forum will never have a use for OOP. Why over-complicate things when it's unnecessary? Why should I create a class to get a random quote? Why should I create a class to figure out what day of the week it is? Those things can be done with very few lines of code and don't require an OOP approach, and they're used ALL THE TIME.

It's my opinion that some people just think they're smart because they know how to use advanced techniques. Sometimes the situation doesn't require such overhead, and you're only increasing the processing time on the backend which leads to slower response times to the user.

KISS - Keep It Simple Stupid

I say screw the supposed "proper way". Do what you require, comment it, and keep it bug free. As long as it's efficient and you can use it over and over, why cloud up your apps with overhead and garbage you're not going to use?
Link to comment
Share on other sites

[!--quoteo(post=366401:date=Apr 19 2006, 09:12 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Apr 19 2006, 09:12 AM) [snapback]366401[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Sounds like a load of bullshit to me. Sure OOP is nice for the right application, but not all applications warrent the use of it. I would be willing to wager that 90% of the people on this forum will never have a use for OOP. Why over-complicate things when it's unnecessary? Why should I create a class to get a random quote? Why should I create a class to figure out what day of the week it is? Those things can be done with very few lines of code and don't require an OOP approach, and they're used ALL THE TIME.

It's my opinion that some people just think they're smart because they know how to use advanced techniques. Sometimes the situation doesn't require such overhead, and you're only increasing the processing time on the backend which leads to slower response times to the user.

KISS - Keep It Simple Stupid

I say screw the supposed "proper way". Do what you require, comment it, and keep it bug free. As long as it's efficient and you can use it over and over, why cloud up your apps with overhead and garbage you're not going to use?
[/quote]

I disagree a little about the OOP approach you stated. I think it makes everything much cleaner and easier to maintain. Using procedural coding works fine, and is pretty quick to get up and running, but once you think about reusability and maintenance, there is nothing better in my opinion than using objects. I've been lazy and haven't used it much in my scripts, but have recently decided to create my basic set up classes that you will pretty much always use.

There is no need for a framework in my opinion, unless you don't really know that much about how to maintain your projects.

But I think it is great to have all the work done in a class, with a couple simple calls from the html document. I think it is the only true way to seperate the content from the backend.
Link to comment
Share on other sites

I think you mis-read me. I don't have a problem with someone that wants to create an object that applies to layout and chunks of code that you're going to use and re-use over and over again with only slight tweaks from site to site. However, I'm getting the impression that people think all the little functions they use "sometimes" should be wrapped up in one giant box of crap and tossed into a class as a kind of code toolbox. I don't think that's the best approach.
Link to comment
Share on other sites

[!--quoteo(post=366437:date=Apr 19 2006, 03:38 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Apr 19 2006, 03:38 PM) [snapback]366437[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I think you mis-read me. I don't have a problem with someone that wants to create an object that applies to layout and chunks of code that you're going to use and re-use over and over again with only slight tweaks from site to site. However, I'm getting the impression that people think all the little functions they use "sometimes" should be wrapped up in one giant box of crap and tossed into a class as a kind of code toolbox. I don't think that's the best approach.
[/quote]

hahahaha
ober, as always, i value your opinion and your blunt explainations. noone can ever question your honesty lol i actually agree with you 100% too.

jcombs i thank you too. i think you're both doing a very good job of proving the immortal point - there isnt really a right OR a wrong way.

cheers guys
Mark
Link to comment
Share on other sites

[!--quoteo(post=366450:date=Apr 19 2006, 11:09 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 19 2006, 11:09 AM) [snapback]366450[/snapback][/div][div class=\'quotemain\'][!--quotec--]
hahahaha
ober, as always, i value your opinion and your blunt explainations. noone can ever question your honesty lol i actually agree with you 100% too.

jcombs i thank you too. i think you're both doing a very good job of proving the immortal point - there isnt really a right OR a wrong way.

cheers guys
Mark
[/quote]

well, there are definitely wrong ways to do things, but not one particular right way.
Link to comment
Share on other sites

[!--quoteo(post=366457:date=Apr 19 2006, 04:23 PM:name=jcombs_31)--][div class=\'quotetop\']QUOTE(jcombs_31 @ Apr 19 2006, 04:23 PM) [snapback]366457[/snapback][/div][div class=\'quotemain\'][!--quotec--]
well, there are definitely wrong ways to do things, but not one particular right way.
[/quote]

agreed. i thought than anything you could do in html was fine until i learnt about doctypes, XHTML and CSS.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.