Re: [SMARTY] smarty templates vs. php templates
| From: | DC | Date: | Tue, 05 Apr 2005 18:01:44 +0000 |
| Subject: | Re: [SMARTY] smarty templates vs. php templates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12406@lists.php.net to get a copy of this message | ||
David Ngo had written:
At my work I work with a html designer and one other programmer. Both of them refuse to learn to use Smarty and keep arguing that we should do away with it.Don't point out to them that they are arguing from ignorance. That will make it hard to sway them to your point of view!
My boss's take on it is that Smarty adds complexity with little benefit.Um, having a team of programmers developing and testing a solid code base is a pretty big benefit. Who are you going to get to test and debug the proposed XML caching system? How much time and money will it take to build? Is it a critical part? If so, why not use a mature compiling/caching system instead of a new caching system?
Their solution is to just do away with the templates and instead have php include files with html in them that will act as the templates.That sounds a lot like Smarty to me! "Php include files with html in them" is just another term for template. Besides, you can avoid using the complicated stuff pretty easily. And then it boils down to building html files with smarts.
We also have a proposed solution using xml that can replace the caching options that Smarty has built in.Yes, the key phrase here is "proposed." Why use vaporware when you can use real, battle-tested code?
I have to come up with a few examples where using Smarty is a better solution.Why don't you share them here?
Does anyone have any extremely convincing examples I can use to change these people's minds? All of the examples I have seen on the Smarty site and through google are very simplistic examples that could easily be replaced by php includes.I think the key is to find the breaking point for the application you are building. That is, where has Smarty saved you in the past? And what capabilities are you going to want to add to your custom solution that Smarty already has. Another important point that people often overlook is that Smarty is very widely known and used. That will be a critical selling point for including it in your system. This is what I call "universality." It's the likelihood that others will know Smarty when it comes time for you and your co-workers to move on. If you don't go with Smarty, the company is left with a highly specific, customized solution with (very likely) no documentation, and that no one know how to maintain or develop.
I do not want to move away from Smarty because I feel it makes my code better structured, easy to read, and just forces me to have better coding habits.Those are great reasons! Now translate them into dollar amounts for your boss. Do a conservative estimate of the time it would take to replicate some of the Smarty technology in your custom system, then multiply that by your estimated hourly wage. Then multiply that by 2-4 because we are all optimists and underestimate the time it takes to do anything custom built!
However how do I explain to someone that has never used Smarty and refuses to learn it that it is the way to go?Let them drive it. You can't argue against someone who has a closed mind and no direct experience. Come up with an ordered list of criteria for evaluation: say, initial development time, application maintenance and expandability, code speed, separation, learning curve, documentation, "universality", etc... Each person will have different ideas of what should be at the top of this list but will basically come down to "company makes more money" and "workers suffer less pain." But, do the ranking separately for each stakeholder, and don't share rankings until the test is over. Then, clear some time in your dev schedule and devise a test mini-project to develop in Smarty and your custom template environment in parallel. This should only take 1 day to build both. Then look at both solutions with your criteria in hand. Whichever satisfies the critical criteria the best (across all interested parties) is your winner. The key is to come up with what is important to you and your company and rank it and then take a realistic view of the results.
I fear that if I can't come up with some good examples we will switch to the system of using php includes as templates which I do not like at all.HTH, dan