I said/thought/learned that SDO could, should fit easily into the mvc pattern, but that's not entirely true. I think that if you want to keep your Module object clean and agnostic to the das type, you would need the mediator pattern to get the SDO/DAs object.
Still not sure how to save/store it though, while being agnostic to the das. But that's my own lack of knowledge.
Which is why i'm writing this down int the first place. Perhaps server, or i, wil come up with ideas for agnostic storing a sdo in a module later on this road.
In J2EE description of the DTO, they propose to log the changes within a DTO (ctrl +f : change flag ), so you can apply these changes when you get the DTO back to it's source.
PHP implementation seems to do this, for which i'm grateful. In my previous job i got the maintenance of a "ReleaseManager" piece of crap code. There the previous owner of the code actually tried to sync configuration files and managed to really fudge it by comparing 2 different configuration files and syncing the production file with the new configuration file by comparing it based on the line number, white lines etc.
The first thing i did was try to convince him to use xml for this, but he didn't dare to change the configuration on the production machine. So the next best thing was to tell the parser about the changes, instead of trying to guess it based on white space and line numbers.
With this in mind i ended up creating a config parser, template engine for the configuration files. Not my best code, but good enough to not create erroneous configuration files, which was one of the basic specifications i had (to come up with myself) for this project.
Anyway the moral of this story: don't try to be smart and do not guess when your updating some important data. Let the user, not the program, decide what needs to be removed, inserted etc.
If there is not a design pattern for this, then there should be one. Perhaps i can even describe it myself .... :-) Actually i could...Template Based Changes... It would create an object template, read in the data from the data source, remove the old data and apply the new data back to the source. Ofcourse design patterns are about the creation of objects
SDO for PHP is sold as a disconnected data graph. This would, imho, imply that switching between different sources for a SDO object should be peanuts. But it's not.
It is in fact just an extra layer/abstraction between a model and it's data source. Which gives it this advantage: a singe interface the model can use on the SDO. SDO is based on the Data Transfer Object design pattern. This pattern, also known as value object pattern(nl), is about transferring data, in an object, within an application.
I think the SDO technology can be enhanced by adding syncing/merging capabilities between two SDO's. Something like an merge_data and/or sync SDO functionality.
To be honest, for a really disconnected data graph, you would use xml or other string representations of a data object. This is done with the SCA part of this technology with SOA/XML.
Another thing that is bothering me is that for a relational DAS, i need to inform the SDO about it's data model via associative arrays. Most databases have meta data capabilities, but PDO is lacking here. Perhaps it is possible to "extend" schema (with our own namespace") to describe the model? This, in combination with the active record pattern should provide us with a way of automating the creation of the models and schema's.
The good news is that converting dbase query output to xml is incredibly easy, i still need 2 das, but the xml version can be an empty document. All you would need to do is fill that document with the sdo content of it's root object and voila, 1 command later (save) and we have a xml string.
converting a data graph from a dbase to an xml file should be as easy as
opening an sdo-sql-das
opening an new sdo-xml-das
merge one into the other das
apply changes (or write to file)
This can only be done if there is a xsd schema file that corresponds with the relative das. merging is the tricky part, when to crud ...., which sdo has precedence etc... tags: limala sdo dope
As i noted earlier, i recently discovered php SDO. At first i found it very exciting piece of technology. With it it's possible to start a new DOM based on a schema. Or so i thought. After someresearch i learned that it's a way of dealing with disconnected datagraphs.
The whole graph thing i find very exciting, also being able to start a xml SDO from scratch i find exciting. But on the whole i think SDO for PHP is somewhat limited.
SDO has a good fit with the MVC pattern and the ability to use xpath for SDO, whether it's a xml or sql based type, i think is very exciting. It would be nice if it's possible to transform the internet dom structure to xhtml via xslt, but i have not discoverd an easy way of doing this.
So still searching for that, if i can find such a way, then SDO is defenitly the way to go for me.
Update: ATM i have not found a way to either be able to switch easy between xml and sql or to retreive the DOM from SDO. This is an issue for me because this could be a natural fit between the declarative nature of xml , xslt and the imperative nature of programming languages such as php or java.
I think SDO is good for manipulating data and creating objects, but i still need to create my own dom to transform the contents of SDO into another form of XML, such as XHTML.
SDO as some serious issues, but i think it's still a nice piece of technology. A more detailed review will follow later.
Gentoo portage does have some nasty conflict situations from time to time. Of course when you don't update a machine for a long time, you get several weird situations at once. Thanks for the great Gentoo community, finding a solution for these issues is a matter of searching the gentoo forums.
So get this: mod_perl 2.02 conflicts with apache-test-129, but mod_perl-2.03 needs apache-test. So updating to perl-mod 2.03 is a challenge, since this will lead to a circular problem.
Knowing this ofcourse makes it easy, just unmerge perl_mod, compile apache-test en remerge perl_mod, or override the dependency check with --nodeps unmerging:
Seems less painless than it used to be. Running a apache2ctl configtest command gives all sorts of errors like this:
Syntax error on line 170 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/70_mod_php5.conf: API module structure `php5_module' in file /usr/lib64/apache2/modules/libphp5.so is garbled - perhaps this is not an Apache module DSO?
So now i have to use equery b libphp5.so to figure out i need to recompile php for apache....weird. Shouldn't gentoo do this by itself?
update: nasty little gentoo apache maintainer removed Listen 80 from httpd.conf, but (in my case) it needs it to remember to listen to port 80.
Needed to update php to play with some recently discovered php toys. The rebuild seemed easy enough, as usual. But then i ran into some problems like:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/zip.so' - /usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0
So according to some kid in the gentoo forums all you need to do is this: equery belongs zip.so then you'll find out to what package it belongs en remerge that package, like this emerge dev-php5/pecl-zip ofcourse it would be wise to check it out first with -pv before you actually merge the packages.
We really need to now these things as a webdeveloper, just so we can fool around.
For now its meant to be able to store and exchange links in a list format, and relate those links (or items) to each other via either categories or tags. Full documentation will follow later. Items can also have there own description and notations.
Soon i'll make it ready for a more distributed en general use in a network enviroment. I'll need to add security measures to avoid spamming and exploitation. Things i have in mind: encryption, network of trust , hash check, black/grey/white listings.
This should make it ready for distributed enviroments/networks and allow for the creation of meaningful widgets/desktop or webapplications.
But first we need to make it ready for normal consumption, ie: a meaningfull container of all things listable and or linkable.
I've been playing around with opml in php, to create a list of links, categorised. OPML 2.0 is fun, but it seems to have a few fundamental flaws.
The strong point of OPML is that it's easy to understand, easy to extend and easy to build lists with. But then, working with OPML i find it has some serious issues.
First the schema, there is no official schema. The OPML 2.0 schema i'm using at the moment has some errors in it. Still it is a nice peace of work i can use/reuse to build upon, i found it very helpful.
What troubles me most though is the seemingly lack of development of OPML 2.0 draft.
Another thing that is bothering me is the outlines classification scheme. If you need to classify an element, and restrict that type to certain conditions, then is it not really another element?
Take for example the outline type link, or include, the outline of this type must have an attribute url. Why not just create an element link or inlcude? This would give better meaning/structure to the opml file.
Then these is the behavioral attributes, isComment, isBoolean, again markup-smell. outline type comment would be better served with it's own element. I'm not even sure what to think of isBoolean, or worse, isBreakpoint. I think the only thinh worse then isBoolean or BreakPoint is KML's TODO element.
Why? Well it has to do with the difference between a declarative language and an imperative language.
Also, adding new attributes to an OPML2.0 file needs to be done in it's own name space; which is good. Alternatives to opml, XOXO and OML, seem to miss the point. Using xoxo i could use normal xhtml to create lists, but i would still need to extend it with my own name space.
Using OML, well, i'm not sure if that's possible. I think it's dead.
Then there is XML Bookmark Exchange Language (XBEL) which seems better equiped for exchangin links, but i'm not sure if it's flexible enough for me. So i'm thinking of combining xbel and opml into my own little language.
ATOM is the way to go, much cleaner and more semantic than OPML or any of the other alternatives.
But it's not "schema (xsd)" friendly. And it's for simple lists only. I would like to build and tree enabled list format for more than just links.