- PeterMoulding.com
- Author
- Trainer
- Speaker
- Business Coach
- How to write a How To book
- PHP Courses
- Speaking
- Web Architect
- Australia
- Books
- Authors
- Akkana Peck
- Alex Berenson
- Andrew Nugent
- Ben Sanders
- Brock Clarke
- Chris Simms
- David Mercer
- Dianna Mullet
- Don Winslow
- Dori Smith
- Harlan Coben
- Jack McDevitt
- James Wines
- Jerry Yudelson
- John Grisham
- Kevin Mullet
- L. E. Modesitt Jr.
- Laurell K. Hamilton
- Marshall Karp
- Martina Cole
- Michael Marshall Smith
- Michel Roux Jr
- Nadia Sawalha
- Philip Pullman
- Raymond Khoury
- Richard North Patterson
- Robert Masello
- Sally Roth
- Sarah Langan
- Stella Rimington
- Stephen Booth
- Stephen King
- Stephen Leather
- T.C. Boyle
- Tom Negrino
- Tony Hillerman
- Urban Waite
- Val McDermid
- Valerio Massimo Manfredi
- Beginning GIMP
- Beginning Visual C++
- Culturalism
- Fiction
- A Drink Before The War
- A Talent for War
- Bag of Bones
- Blood and Ice
- Burn
- Dark Lady
- Dead Line
- Eclipse
- Empress of Eternity
- Exley
- Flipping Out
- Just One Look
- Nightfall
- Pet Sematary
- Savage Moon
- Skinwalkers
- Starvation Lake
- The Fallen
- The Gardens of the Dead
- The Jump
- The Last Templar
- The Mermaids Singing
- The Midnight Mayor
- The Secret Soldier
- The Summons
- The Terror of Living
- The Testament
- The Tower
- Under the Dome
- Virus
- AJAX and PHP
- Aging with Grace
- Food books
- Green Architecture
- Life Is So Good
- SQL: The Complete Reference
- The Backyard Bird Lover's Ultimate How-to Guide
- The Garden Gurus
- Authors
- Sustainability
- -18 hours left to decide the future of Australia
- Campbells vegetable stock or Massel vegetable stock?
- Carbon Sequestration
- Carbon tax for Australia is a fraud
- Copenhagen will fail
- Cost of living in Australia
- Dick Smith jumps on the population bandwagon
- Dry Run: Preventing the Next Urban Water Crisis
- Energy Saving Lights
- Garlic
- How many people can live in Australia?
- Its obsolete, throw it out!
- Julia Gillard offers 9.9 billion dollars bribe to Rob Oakeshott
- Laundry detergent
- Petrol or Diesel?
- Reflective foil batts kill
- RoHS
- Sea level to rise 3mm due to climate change
- Solar power
- Spring again in Sydney
- Sustainable fuels
- The CRUD Tax is back
- The people who make building regulations do not own houses
- Water efficiency
- Which insulation is safer, foil or wool?
- Will Australia reduce greenhouse gas emissions?
- Technology
- Android or Blackberry or iPhone or a flip phone?
- Apple versus Google 2011
- Cameras
- Cars
- Colour
- Burgundy
- Colour Blindness
- Colour Names
- Dulux colours
- Pantone colours
- Safe Colours
- Seculine ProDisk Mini colour balance card
- What Causes Colour Blindness?
- Hardware
- Batteries for the Digital Age
- Cables
- Cases
- Computer reliability
- Computrace
- Disks
- Astone ISO Gear 481E
- Best SSD for your notebook computer
- Disk block size
- Hitachi disk HDS722020ALA330
- LaCie USB 2.0 250 GB mobile hard drive design by F.A. Porsche
- SMART disk
- Samsung 2 TB HD204UI quiet low power disk for mass storage
- Seagate and Samsung merge disk business
- Select the right disk for your RAID array
- USB disk speed
- Western Digital WD20EARX 2 GB SATA 3 disk
- How long should computer hardware last?
- Keyboards
- Mainframe
- Memory cards
- Monitors
- Netbooks, notebooks, tablets, and xPads
- Network Attached Storage
- OLED Displays
- PC's are a thing of the past
- Printers
- Quiet
- Samsung Galaxy S
- Speed
- Television
- Tools
- USB
- Worst computer movies
- Xserve is dead. What next?
- Your backup will not work
- Z68 motherboards
- iPad or Acer Aspire One?
- IQ
- LG Intello Washing Machine
- Lack of a challenge
- Networks
- 802.11n wireless networking
- D-Link DIR-655 wireless router
- D-Link DWA-160 Xtreme N dual band USB adapter
- D-Link DWA-556 Xtreme N PCI Express desktop adapter
- MIMO
- NBN spends another $12 billion of our tax money on nothing
- National Broadband Network
- Netgear wireless modem router DGND3300 with 300 Mbps 802.11n
- Refrigerator kills wireless broadband
- Small Wireless Network
- TP-LINK TL-SG10005D 5 port gigabit switch
- TP-Link TL-WR1043N wireless N gigabit router
- Telstra Pre-paid Mobile Wi-Fi
- Where are the router plus proxy server combinations?
- Open Source documentation
- Software
- 7-zip
- Accounting
- Asterisk
- Audacity
- Backup software
- Bloat only in Windows
- CAD
- CDex
- Disk imaging software for copying and backup
- Exact Audio Copy
- Filezilla
- Firefox
- Java
- LibreOffice or OpenOffice?
- Linux
- 1 in 5 servers will ship with Linux
- Android phones outsell iPhone
- Another Move to Linux
- CentOS 5.5 installation on SSD and RAID 5
- Debian
- Debian 5.0.5 AMD64 installation
- Debian 5.06 installation
- Fedora
- Fedora or Ubuntu?
- Gnome or KDE?
- K9copy
- Linux 2.6.38
- Linux Gnome login settings lost
- Linux Mint
- Linux RAID, a rant
- Linux Speed
- Linux Time
- Linux reliability as demonstrated by Ubuntu 10.10
- Linux reliability as demonstrated by Ubuntu 11.4
- Linux still a struggle in 2011
- Linux workstation disk RAID 1
- Linux, NT, Windows, and SETI
- Linux, three years of progress
- London Stock Exchange switches to Linux
- Mandrake Linux 9.2
- The partition is misaligned by 48128 bytes - warning from Linux RAID
- Ubuntu
- How to fix the scroll bars in Ubuntu 11.4 Gnome
- Kubuntu 10.10 alternate installation on desktop with RAID 1
- POWbuntu
- Ubuntu 10.10 after 6 months use
- Ubuntu 10.10 alternate installation
- Ubuntu 10.10 desktop RAID 1
- Ubuntu 10.10 desktop RAID 5
- Ubuntu 10.10 desktop install on a netbook
- Ubuntu 10.10 desktop installation
- Ubuntu 10.10 netbook install on a netbook
- Ubuntu 10.10 server AMD64
- Ubuntu 10.10 upgrade to version 11.4 beta 2
- Ubuntu 10.4
- Ubuntu 11.10
- Ubuntu 11.10 first upgrade
- Ubuntu 11.4 after one month use
- Ubuntu 12.04 beta1 desktop amd64
- Ubuntu One
- Ubuntu by Microsoft?
- Ubuntu desktop upgrade 10.4 to 10.10 failed because I did not check the media
- Ubuntu strikes again
- Upgrade Ubuntu to Linux Mint 12 LDXE for extra speed
- Yes, use Linux but not that distribution!
- Nero
- OpenOffice
- OpenOffice is now Apache Office
- Project management
- Scribus
- Software for Windows and Linux
- Text editors
- Time
- Todo applications
- Tomboy notes
- Top text editors
- Version control
- VideoLAN VLC media player
- Visio
- Webmin
- Webmin installation on CentOS for Web development
- Webmin installation on Ubuntu
- What is the most popular open source software today?
- Windows
- Another Windows person goes Linux
- BAD_POOL_CALLER
- Cygwin
- Microsoft Malicious Software Removal Tool cannot find a common virus
- One of the developers of Windows XP is criminally insane
- There are unused icons on your desktop
- W32time
- Which Windows version?
- Windows 7 Home Premium
- Windows XP Stop 0x0000007B during installation
- Windows XP is a disaster
- Windows processes
- XML
- Zip, bzip, gzip, or 7zip?
- configFree
- Technology Succession Planning
- VoIP
- Web Sites
- Drupal
- Do Drupal themes have to use the GPL?
- Drupal 7
- A better search facility for Drupal
- Drupal - performance or flexibility
- Drupal 7 Fields are hard to fix
- Drupal 7 new features
- Drupal 7 ships on January 5
- Drupal 7.14
- Drupal 7.4 hits PeterMoulding.com
- Drupal function sequence
- The evolution of a module
- Undefined index: headers in DefaultMailSystem->mail() (line 54 of /modules/system/system.mail.inc).
- Undefined index: to in DefaultMailSystem->mail() (line 83 of /modules/system/system.mail.inc).
- implode(): Invalid arguments passed in DefaultMailSystem->format() (line 23 of /modules/system/system.mail.inc).
- Drupal 8
- Drupal Code Load Cut
- Drupal How To
- Drupal Modules
- Backup and Migrate
- Browscap
- CKEditor with Drupal WYSIWYG
- Captcha
- Cel
- Colorbox
- Content Construction Kit
- Content type
- Devel module for Drupal
- Drupal Rules as an automation language
- Drupal Spam add-on module
- Form alter to node
- IMCE
- IMCE Wysiwyg bridge
- ImageAPI
- Jdog
- Lightbox2
- Module variable
- Node Gallery Access
- Node_Gallery
- Path
- Path redirect
- Pathauto
- Pet
- Search
- Service links
- Session Variable
- Statistics
- Taxonomy
- Token
- Token ex
- Transliteration
- Trigger
- Watch
- Other modules
- Drupal Training
- Drupal access controls need a major rewrite
- Drupal coding tricks
- Drupal performance
- Drupal themes for the future
- Drupal.org colours
- Import existing data into Drupal
- Multiple Web sites made easy using Drupal multisite and the right start
- drupal_lookup_path()
- Adobe PDF
- Apache
- Apache Mahout
- Audi.com
- Bleet
- CSS Strikes Again
- CSS or xCSS
- Can you believe Facebook or email?
- Content Management Systems
- Databases
- Facebook scam
- Font
- Fonts
- HTML
- Install Apache, MySQL, and PHP 5 in Ubuntu 11.4 using the Ubuntu Software Centre
- Language Codes
- Marketing
- Memcache
- Nginx
- Open source development hits another roadblock
- Oscars
- PHP
- SPDY
- Search software
- Techoni.com.au
- Theme themes
- Things to hate on Web sites
- U.S. Patent No. 6,985,875
- Virtual Private Server
- Visible Improvement
- Web 4.0
- Web browser usage
- Web browsers
- Web site development
- Bluefish
- Crying over spilt code
- Eclipse and PHP
- Getting a Git client, a story of ancient technology and pain
- HTTrack
- MVC
- Netbeans
- PHP or ..., CakePHP/Symfony/ZF versus ...
- Programming
- Superfish
- Web browser emulators for testing your Web site
- Web development frameworks
- Web site books
- Web site development on your own computer
- Webmin or phpMyAdmin or cPanel for creating databases?
- aiki framework
- jQuery
- Views development - Learn Fields first
- Views development - Learn Actions and Rules
- jQuery .each()
- jQuery .has()
- jQuery .is()
- jQuery and Firefox Firebug
- jQuery children
- jQuery for people not using Drupal - Installation and getting started
- jQuery hover
- jQuery hover de-duplication example
- jQuery or CSS?
- jQuery performance
- jQuery tests
- Web site hosting
- Westpac Web site still broken after two years and ten months
- Wordpress wins another CMS survey
- Drupal
Zend Framework 2.0 requirements as an example of code architecture
Submitted by Peter on Tue, 2011-09-13 17:07
Zend Framework is an application framework written in PHP mainly for Web sites and Web based applications. Their requirements documentation for their version 2, http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Requirements, is a good example of a wide ranging code architecture base. We look at some of the good points, the bad, and the missing as a starting point for creating your own code architecture for your next project.
There are a lot of things you need in an application architecture and code architecture is one entry point. Code architecture is rarely application specific. You can reuse your code architecture across many applications. Web based applications have some considerations not present in traditional application and will require extra points in your architecture. Touch screen oriented applications have the same need for localised interaction occurring independently of the main application. We will skip the fine details of the new requirements for Android style applications to concentrate on the details of the Zend Framework version 2.0.
- Language
- Fashion
- Ease the learning curve
- Make extending the framework trivially simple
- Simplify maintenance of the framework
- Be an exemplar of PHP 5.3 usage
- Namespaces
- Programming by Contract
- Magic methods
- User comments
Language
Your programming language will determine some architectural points. There are items that apply to only some languages. There are features that work well in some languages and are best avoided in other languages. There are also bad habits picked up from one language then transferred to another.
As an example of a bad habit transferred, consider the use of lists in PHP. The most efficient simple list in PHP is an array of data. Many programmers are forced to learn Java first then try to recreate Java in PHP. The Java recreation process includes creation of arrays of objects where arrays of data are the best choice.
In some code, you see attempts by Java programmers to go one step further into unnecessary complexity by emulating PHP lists in objects. There is really weird code out there created by Java programmers writing their first PHP code and trying to solve problems that occur only in Java, not in PHP. Sometimes they fix their PHP code when they learn more features of PHP. Other times they declare their weird inefficient code as Object Oriented
. When you look inside, you find a standard PHP list wrapped in mind numbing and resource wasting complexity of no use in PHP.
There are good features arriving in PHP with each new release plus there are features that are reversed out a few releases later. You need to plan for the features with a proven advantage and test everything else.
Fashion
Some choices are purely fashion. You will hear people rant about a feature being critical then the feature will drop out of fashion and next year nobody will mention it. In a few years the former promoters will be actively complaining about people using the feature.
Some fashions do last despite the pain. The first book on the C language was published in 1978 and mixed a few dreadful fashions among the excellent ideas. Some of the painful time wasting fashions caught on and are still popular today despite repeated research showing they are an obstacle to understanding code. Unfortunately the fashions are taught in universities and most universities are absolutely dead set against all change, no matter how worthwhile the change might be.
If you read the first C book, commonly called the K&R book after the authors, you find the book lists one fashion for formatting braces, {}, then list an exception that is more readable then the authors tell you to choose your own style. Very few programmers follow the advice of the authors. Java developers adopted the worst of the two C braces styles.
Alternatives are sometimes hard to fight for. One part of Java code styling style, the braces, has an alternative named the Whitesmiths style from 1978. The Whitesmiths style looks the same as various bracketing/indenting styles used in the 1960s because they were taught in the early 1970s by people who had used them for years. The style did not have a name and was introduced to students with the works indent for readability. Lets call it the IFR style. Students learn the IFR style faster than any other style. People maintaining existing code find the IFR style more readable than any other style.
Despite all the advantages of the IFR style, when you lets a bunch of contractors loose on your code, one of them will reformat everything to the Java style and recovery will be too hard. People give up on code quality and go with the flow. Some editing software further inhibits innovation by preventing the use of better code standards.
If you really want to think deep about the effect of being locked into a 1978 fashion, think of music. You could be locked into wearing white lycra jump suits and listening to ABBA.
Ease the learning curve
The first object listed on the Zend Framework 2.0 Requirements page is to ease the learning curve for people new to the Zend Framework. Based on experience of using frameworks and teaching people to use frameworks, Zend have some excellent goals. Most software fails to provide examples or something you can plug in and use to learn the software. The requirements page specifies examples as a goal. The requirements page specifies usable examples as a goal.
In theory you should be able to look for the function you want then read the example code to see what is involved then plug in a little program that demonstrates the code in action. This is an excellent approach with precedents going back to the first time I taught programming.
In the old master/apprentice training system you would show someone then watch them do the same then watch them do something similar. A lot of programming courses shot something too simple to demonstrate a complex function then expect students to magically jump into something complicated. i attempted to demonstrate the most simple use then demonstrate a more complex use then supervise the students through a simple use then a more complicated use then cycle them through the common range of uses for that feature. They would learn to test all the options themselves. After the first few variations, they would be ready to research the other variations.
The Zend Framework is headed in the right direction. Their big challenge will be to present each function in a useful way without hauling in masses of other code to make the example work.
Make extending the framework trivially simple
Another excellent goal for every framework. The extension section lists some steps that are questionable because there is little detail. Some of it is along the lines of A is sometimes misused so we will ban A and enforce B. The new bits, B, are useful but not always a replacement for A. They need to simplify some of their larger chucks of code and adopt new techniques. Some of the existing techniques do have a place.
Some of the changes in this section will require a really good demonstration of the exact change so people can test the result.
Simplify maintenance of the framework
More nice ideas in this section. One big problem with the Zend Framework version 1 is the use of a class or feature in isolation. People would like to contribute enhancements but they first crash against the need to use most of the Zend Framework to get something working then they have a real problem contributing a change because they do not know how to test the impact of a change.
When the Zend framework achieves the goal of testing each feature in isolation, or with minimal other modules, users will be able to work on changes in isolation and contribute those changes. You will be able to use just what you need and contribute to the parts you need without crashing into dozens of other components.
Be an exemplar of PHP 5.3 usage
The critical part of this section is MUST NOT use new language features just for the sake of using them. The idea is to use the best features of PHP 5.3 without enforcing a less useful fashion. There are some excellent ideas in this section and some things that sound like replace A with B because A failed. I suspect B will be almost as bad.
Namespaces
The Zend framework version 2 will use the PHP namespaces feature. Namespaces solve some problems and create others. The goals of the Zend Framework 2.0 are excellent and a quick look at some of the early implementation code suggests the result could be a horror to maintain. If you use all of the Zend Framework, the result should be manageable. If you use part of the Zend Framework and develop your code to fit the Zend Framework, the result should be manageable. If you try to use the Zend Framework to add into your own code, there could be serious confusion.
Frameworks were never designed to be mixed with other frameworks. Namespaces give you the opportunity to avoid collisions if all your framework code is converted to namespaces but there can be a real problem understanding which code should be used in each situation. Make your code understandable by converting everything to namespaces or by using only one namespaced framework under your un-namespaced code.
Programming by Contract
Programming by Contract is another fashion for defining application programming interfaces that work, at least in the framework sense. Framework components have to work like a black box. Choose your favourite term here. The component has to provide a predictable result from a simple to prepare input. Zend Framework version 1 failed, in part, because you had to fire up so many other modules to get a result.
Simplifying the bigger modules and making more modules work predictably by themselves will help everyone. Calling the result a by a particular term is a minor advancement. There are a few other term in this section with similar nice feels but they all come back to the ability to use part of the framework independently of the whole framework. it does not matter if you use every component of the framework in your application, when you ask one specific component to perform an item of work, that component should perform the work as requested and without complications. if that component needs another component, the need should be clear and predictable.
The proof of this approach is the ability to test a component or a small group of components in isolation from the framework.
Magic methods
One confusing things in some frameworks is the use of magic methods. Magic methods are also very slow and resource hungry. The logical thing is to ban magic methods because there are better ways to do everything you might do with magic methods.
The PHP magic methods feature lets you write classes that respond to method requests even if the methods do not exist. The response might not be the right response. Your programmers might not understand how the response occurs. The first time you notice the magic method approach fails might be when thousands of users have ordered products from your Web site and you have lost all the payment details.
The Zend Framework version 2.0 is not going to ban magic methods. Instead they are going to review them. You will be stuck with the same problem. The problem will not occur as often but it will occur. This is one point where I would seriously suggest looking at other frameworks. if you are going to invest in using the whole of the Zend Framework, there could be some serious traps left that will make you wish you chose another framework.
I have not found a performance test to show the Zend Framework version 2 outperforming any of the serious competitors. Magic methods might not be used in the part of the Zend Framework that you use or they might be everywhere and drag your Web site performance back to the speed of the valve based electronic computers invented by the British in the 1930s. The lack of decision by the Zend Framework team means you will not know what you will get until after you build your application or Web site.
User comments
The user comments on the page show the disagreement between the developers and users on the fine detail. The requirements list is a big step forward on the previous version of the framework but still misses on a few points and is probably behind Symfony 2.
The main problem appears to be the bits about replacing A with B. There are many excellent descriptions of problems with actions to fix the problems. There are also instructions to do something without an explanation sufficient to justify the change. There are also sections where they say you have to replace A with B but they might allow exceptions. They get most things right then leave holes needing further discussion and explanation.
Conclusion
The Zend Framework version 2.0 requirements document is a good step forward compared to many frameworks and still needs discussion of requirements plus specification of definitive actions in some areas. The document would be a big step forward if Symfony and some other frameworks had not reached version 2 earlier than the Zend Framework.
While the Zend Framework software is still trying to catchup with some other frameworks, their requirements document is ahead of most of the other frameworks. The Zend framework 2.0 requirements document needs only a small expansion of their justifications for some some changes to make the document complete. The document needs some changes upgraded from optional to required to make the requirements definitive. The document could easily be an excellent example of a framework requirements and way ahead of their competitors.








