On May 2, 2006, at 10:13 PM, Daniel Miller wrote:
If you're interested, I have lot's of comments like this on various parts of the SQLAlchemy API.
im sure you do, but one thorny issue of SA is that it supports multiple programming styles, particularly in 0.2, where you can use an explicitly maintained Connection object to execute SQL, or you can use the "implicit" style that SA 0.1 has. I know your SQL library would only have explicit Connection and nothing else...but SA benefits greatly from supporting more succinct programming styles, the Python audience demands it (as evidenced by early critiques of SA being "too hard" compared to SQLObject, Guido's trashing of Myghty because it took more than one line of code to programmatically call a template, etc.)
at its core, cases where a __call__() method does the same thing as an explicit method is not a perl thing at all, its a Java thing. Just take a look at the collections classes, where various objects need to implement multiple interface contracts; in order to implement more than one interface, you often need to express the same functionality with different methods. As I indicated that the interface for a "session context" would be just a callable, it follows logically that SessionContext would maintain its explicit API since its clear and consistent for applications that deal with it explicitly, and also implements __call__() in order to conform to SA's interface contract for "session context" objects, which does not deal with SessionContext explicitly. its no different from a dictionary having both a keys() and an __iter__() method.
there is also an recurring undercurrent of disagreement here, which is based on my experience that total rigid adherence to commonly "accepted" rules is a recipe for disaster...when someone goes through my code and only looks that it "breaks rules A, B, C", I dont consider that to be a very deep critique. usually "the rules" are too open-ended to not be mis-interpretable....such as, is that TMTOWTDI, or is it just an object that needs to conform to multiple interface contracts ? Is that "premature optimization", or is it "failure to write an algorithm in a completely brain dead way"? is that "a global variable", or is that an "application-scoped registry" ?
------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users