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

[jfw] Re: Discussion - Package Updates for Framework 2.0

On Thursday, April 10, 2014 8:22:59 AM UTC-5, Michael Babker wrote:
What types of changes or deprecations would you like to see (and be willing to assist with) as we update our packages to 2.0, and why?

A couple of general comments:

1. When using external packages, it can be useful to inject an Interface (better still if the Interface is your own), rather than the concrete. I would avoid any hardcoded reference in your FW classes -- be it an include or the concrete namespace. That way, the Joomla FW isn't dependent on any other project but can still benefit from using other software. Keeps the door open for alternatives or a new choice if the current choice is no longer suitable. The dependency can be listed as recommended in the composer.json file rather than a requirement.

2. On the Filesystem package, my approach was to avoid any path statements in the FW/Application classes. I have a Resource package that uses namespaces for all file resources (not just class loading, but configuration files, images, CSS, etc., etc.). But, the more important part is that I bury all the paths in my factory method classes and I inject the file contents -- never the file. What that does is completely uncouples the classes from any file or folder references. This is important in that it allows all file/folder resources to be abstract from their location. Helpful for working with the cloud or overriding files or treating database query results the same as file contents. Bottomline is, doing this removed any real purpose for a Filesystem package for me. If I need to access the cloud, I can add a resource adapter that interacts with the filesystem and the application requires no change. I'd be happy to share more on this, if there is interest. (tl/dr - no paths in classes - pass in file contents, not locations - do all file/folder handling in your factory methods that are driven by the DIC.)

Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.