Re: MVC: code in views

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

 




On Jan 4, 2016, at 9:36 AM, 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


My view is that skills are too specialized. A house usually has an architect/designer who has the overview. Then the various trades only need follow the plans an blue prints. Any "improvisation" is probably going to
cause problems.

The other approach, without a design and plan, is to work like a musical group, specifically, a Jazz group where every one understands music, harmony, and can allow for and mesh with the other players, and has mostly
the same overall vision:  I.E TEAM WORK.

I work alone. I am not professional, in that I have never made any money doing this. In order for me to produce even an online portfolio type site, I have learned html/css/javascript/ regex/ php/ and some sql. I have to make it all work together to do what I want. I have also learned to setup and administer unix based servers, including custom building
the machines and operating self hosting.

As for simplicity: a house is usually made of sinple pieces of wood, but a piece of wood is not a house.
JK



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



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



--
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