AKA Panama Jack wrote:My philosophy is the KISS principle. Keep It Simple Stupid.
Unfortunately that doesn't seem to happen often when it comes to web site creation. One area that is a little out of hand is the use of abstraction layers for just about everything. Honestly, it adds too much overhead to add a layer for everything. Sure there are times when using an abstraction layer is very useful as with databases and templates. Sadly some people go "ape doo-doo" when abstraction layers. At times it's almost as bad as making everything an object on a site. It's just adding more processing overhead.
I agree, however I do have other reasons to add a File abstraction outside of just adding the layer...
The API is then consistent and if I were to port my framework over to PERL, ASP or even C the porting of application code is also minimized.
Plus like d11, I do like the idea of abstraction, it does make sense. However I am in the same mindset when people use classes for everything, although I am slowly convincing myself that using classes as a quasi-namespace in PHP is acceptable practice.
But again, like my arguments on template engines, I also am an adovcate for optimization when possible and wrapping a string class just might be overkill...I dunno yet as there are certainly advantages of doing so, especially when porting a framework to another language. Plus the KISS principle applies. PHP's default string handling functions are complex and verbose, like the array functions. Newbies would have an easier time adjusting to a fixed framework API wrapper for a string or array, allowing them to start simple and build on that knowledge.
For instance, consider the array_* not only are they anaologous to a vector, but also a hash/associative and at the same time, they emulate a stack with push_* or pop_* functions...thats all that sprint to mind. But thats alot of function to remember when all you mostly do is add/remove...overly complex...which is good because advanced programmers like flexibility, but bad for newbies.
Admittedly MFC helper classses such as CArray and CFile do little more than add extra error checking, etc, they also encapsulate the concept of a file pointer, etc...working with an object is prefered to working with the raw API IMHO. It makes you think more OOP, which, even for advanced developers is a good thing, as we all know OOP lends itself to problem solving better than procedural.
Cheers
