advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
Partners & Affiliates
advertisement
advertisement
Average Rating: 1.7/5 | Rate this item | 3 users have rated this item.
 Print Print
 
Build an Object-oriented File System in PHP
Using a simple file storage convention and some PHP code, you can create a hierarchical file system that mimics many object-oriented concepts, facilitates reuse, and simplifies your Web development efforts. 

advertisement
he term "object-oriented" is vague and frequently misunderstood. Jonathan Rees (with more insight than the average programmer) attempted to define its meaning , but even his definition does not necessarily encompass the topic completely.


Despite the difficulties of pinning down the terminology, for the purposes of this article, you can assume an "object-oriented file system" has a specific meaning—it is a way to take advantage of traditional object-oriented concepts such as inheritance, by organizing your files and directories as if they were a class hierarchy. This may seem like an odd idea, but in practice, it's extremely useful. Adopting an object-oriented file system provides the following benefits:

  • Context Sensitivity: Perhaps the most important benefit of an object-oriented file system is that files can automatically configure themselves based on context. The class hierarchy serves primarily as an easy way to define context for your site. Then the various page elements can be selected automatically based on that context.
  • Reduced Duplication: The idea is that changes should be made once, and only once. A single piece of information should not be stored in more than one place, nor should a concept be implemented repeatedly. For example, you can easily change the appearance of an entire site, or any subsection of it, by making a single change. Instead of writing the same things over and over, you need to tell the system only how this page differs from other pages. Any commonalities are handled automatically.
  • Ease of Specialization: While it is easy to do things automatically from context, the system also makes it easy to give pages unique behavior. You can override the context without difficulty, to make pages or sections stand out from the rest of the site.
  • Easy Maintenance: Moving files and directories around is easy when you don't have to worry about breaking links. Just make sure that you move your file or directory into a directory with a compatible interface, and the system will sort out the details automatically. By interface, I mean the parent classes or folders must implement the features your migrant page needs—images, files, functions, templates, or other objects which make up a complete page. But if these things are not available, it's still fairly simple to import components from brother or sister classes. This allows you to use both vertical and horizontal inheritance.
  • Clean, Clear URLs: Readers and search engines both like to use your Web address to guess what your content will be. URLs which describe their content in human-friendly terms will be easier to find, easier to remember, easier to share and link to, and get higher search engine placement. Organizing your content into a class hierarchy has the side effect of producing human-friendly and spider-friendly URLs.
An object-oriented file system might be better labeled as a contextual framework. Though it provides very helpful features, you will still need to apply basic organization skills to make it work well. The framework is both a mechanism to provide basic object-oriented features and an approach or policy for organizing content. By using both the mechanism and the policy, you can create and maintain sites with relatively little effort.

Page 1 of 5


advertisement
  Next Page: Use Include Files to Provide Inheritance
Page 1: IntroductionPage 4: Dealing with Images
Page 2: Use Include Files to Provide InheritancePage 5: Putting It All Together
Page 3: Simplify Hyperlink Maintenance 
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES