Re: Using exceptions to write more perfect software ...

From: Date: Sat, 14 Feb 2004 11:24:48 +0000
Subject: Re: Using exceptions to write more perfect software ...
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-177696@lists.php.net to get a copy of this message
On Tue, 2004-02-10 at 11:40, Markus Fischer wrote: > Isn't this the same thing I started doing anyway? I however didn't > integrated those functions in my application directly but put them in a > file of its own so I can (hopefully ;) reuse them. I started putting them together then I realized I was not nor wanted to implement the framework necessary to have a proper hierarchy. Instead I am playing with replacing each function call that should throw an exception manually. This has also helped me increase the granularity of my exceptions. Because I generate practically all the code I have that uses system function calls in some way it's not much additional code for me to write. > This sounds very interesting. Can you elaborate how and what you > actually did for generating the code (what was your input and how did > you transform it)? Right now I have a php script that reads in sql code (currently MySQL's semantics) and outputs a series of classes. I can not get into too much detail as I consider it very dear to my process. :) However, I am able to generate a complete class based data abstraction layer from sql code, which is nice. :) > I think such a real hierarchy of classes will never exist. That's too > much for PHP; none of the developers want to break BC and also follow > the KISS credo (which is good, imho). I wonder what will happen to the user base as PHP 5 comes out and later when PHP 6 is in the works. Classes are becoming more popular in php and I have already seen some discussion on implementing a base PHP framework in classes. It seems some people are considering using Java's structure, which I would agree is way to formal for PHP, however hopefully some good middle ground will be found. > But it sounds interesting in re-creating the globbered global function > table of PHP in a well thought class framework and make it > exception-proof. But that would be a step back either if this wrapping > would only occur in PHP side -> for every PHP function there would need > to be called a userland PHP code before. I even don't want to think > about the performance implications. But well, since this is effectively > what I started with with my "System" class, there my be needs where this > trade off is accecptable (compensating longer execution time with caches > and more hardware power/ram/whatever). I don't think an in system solution would be a good idea. I appreciate the PHP developer's respect for functional programming and think it would be a mistake to being integrating an object oriented framework in all of PHP itself. One if the benefits of PHP is its similarity to C. > I think for the current issue I will just continue recreating the PHP > functions inside an exception-proof class if I don't find a better way. > Only creating them on-demand isn't a real problem (at the moment). Let me know how it goes. If you want to merge code and start an impromptu class repository for PHP 5 I would be interested. I have only been playing around with PHP 5 since it is still in beta, I haven't tried converting an entire application over to the new class syntax yet. Regards, Adam -- Adam Bregenzer adam@bregenzer.net http://adam.bregenzer.net/

« previous php.general (#177696) next »