Re: MVC: code in views

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-01-04 at 12:36 -0500, Tedd Sperling wrote:
> Ash:
> 
> <opinion>
> 
> Trying to protect Developers from technology is like swimming against the current.
> 
> Please understand I teach WebApp Development (and Mobile App Development) and it seems everything is becoming more and more complex. Not only do I have to teach HTML, but also CSS, HTML5, CSS3, Javascript, jQuery, Bootstrap as well as PHP in making Websites do stuff. In addition, my Developer students must also consider design, UX, and Device types (Desktop, Mobile, Tablets, whatever)-- nothing is simple anymore.
> 
> However with that said, HTML can be enhanced with just a little PHP, such as using includes (i.e., pulling in a common menu, pulling stuff from db, and so on) as well as using technologies like Bootstrap and jQuery to deal with "Mobile First" concerns. You can’t solve those problems simply, but you can use those technologies to help. In short, none of us can understand everything, but we can figure out how to use technology to help us.
> 
> Developers who are confused with simple PHP additions need to learn how to develop around them, if not understand the basics of why those statements are there in the first place.
> 
> For the exception of static-business-cards websites, the days of simple HTML websites are gone. Developers must keep up with technology or find another profession.
> 
> Of course, this does not include Designers — the only thing they need to know "about the Web" is what devices (screen-size) their clients want to provide their customers — a different skill-set.
> 
> But after the Design, Developers must know how to take those designs and present them to users to provide the content clients want. I wish it was simple, but it’s not.
> 
> Here’s part of what I teach my WebApp Developer students:
> 
> WebApps are written in Web Languages, such as HTML, CSS, JavaScript, PHP, and MySQL. I often use the analogy that a fully functional Website is like a fully functional House.
> 
> 1. HTML – is like the foundation, framework, and structure of a house – it holds things together, namely the Structure;
> 
> 2. CSS – is like the color of the walls and carpet, the type and color of shingles, the exterior of the house (i.e., brick, siding), namely the Presentation;
> 
> 3. PHP – is like the plumbing, electrical, heating/cooling of the house – the things that work in the background to provide service, namely the Function;
> 
> 4. JavaScript – is like the “on/off” of light-switches, turn “on/off” of water-faucets, “opening/closing” of doors and windows, namely the Behavior;
> 
> 5. MySQL – is like the safe where you put permanent and persistent documents, like the deed, insurance papers, mortgage, receipts, and other important papers, namely the storage of the Data.
> 
> All of those items work in concert hold Content. In the case of a House, it’s you, your family, and your possessions. In the case of a Website, it’s the text and images that are collectively known as Content required by the client.
> 
> Focusing on one topic (i.e., Structure, Presentation, Function, Behavior, or Data) will not solve the need, but rather will cause implementation problems down the road.
> 
> For example, imagine a Carpenter not leaving room for electrical, plumbing, or furnace needs — that’s like a Developer not considering CSS, PHP, or Javascript additions. Developers, like Carpenters, need to understand the end-game.
> 
> HTH’s
> 
> </opinion>
> 
> Cheers,
> 
> tedd
> 
> _______________
> tedd sperling
> tedd.sperling@xxxxxxxxx
> 
> 
> > On Jan 3, 2016, at 4:43 PM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote:
> > 
> > Hi all,
> > 
> > Just wanted to get some thoughts from others on the list. Recently I've
> > been trying to avoid using any PHP code at all in my views at all, not
> > even an if statement or for loop. The general idea is that I want to
> > make it as easy as possible for developers who do no PHP at all (I work
> > with a lot of them) to be able to work more easily.
> > 
> > So far I've been doing this by moving the little logic bits that might
> > otherwise end up in the views to controllers or the template engine to
> > handle, and use a basic templating system that the frontend developers
> > can use.
> > 
> > What are peoples' thoughts on this? Am I going down the wrong path with
> > wanting to keep my views HTML-only, or is this something that any of you
> > are trying to do? I'm finding the benefits only when working with others
> > in a team, otherwise I've no problem with PHP in views myself.
> > 
> > As an aside, it has made things slightly easier when it comes to using
> > CodeSniffer to analyse code quality, because a lot of the tests were
> > throwing false positives because of the mix of HTML and PHP in the view
> > files. Keeping things separate now means that an error in a view is a
> > true error.
> > 
> > Thanks,
> > Ash
> > 
> > http://www.ashleysheridan.co.uk
> > 
> > 
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 

Hi Tedd,

I do agree on the whole with your reply, and it's what I tend to do as I
work with both the front and back ends. Apparently though, this seems to
be becoming more unusual (at least in the UK) as people specialise in
one or the other. 

Obviously there is some crossover knowledge, but with new frontend
frameworks appearing every week (React is causing quite the storm in
certain circles these days with the regular shifts in direction and
behaviour); it's becoming a full-time job for people to keep up. And
while I consider my knowledge of frontend to be good, it's not on a par
with the guys I work with who make this their focus.

It's good to hear everyones opinions though, as I don't want to head
down a road that will limit me or what I build too much.

Have you any thoughts on automated code quality tools for PHP like Code
Sniffer? I'm using this at the moment, but it tends to like to complain
when it encounters PHP files that are not pure PHP (i.e. views). Part of
this is due to the rules I run, but I'm loathe to remove those rules
just for the sake of a small part of an application.

Thanks,
Ash

http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux