oxygene
Certified Guru
I usually do reuse in PHP via includes, everything else is just too much trouble, and way too much typing for me..PHP has 'just enough' OOP to cut down on code reuse whilst still being very easy to develop with. Hence the number of massive PHP projects - MediaWiki, Scoop, osCommerce, PHP-Nuke etc. that run quite smoothly, especially compared to Perl.
that's a matter of reuse again.. you'd need to do this is_array check at any place, where such a data structure _might_ come up. just ask the data to do it, and you're set. and if you do it, you would have to define the behaviour (depth first, etc) at each place, instead of some specialisation of your tree class.so how would you "foreach through" a tree, using several strategies (depth first, breadth first, ..)? would you copy it to an array first? would you invent a new API?
Point taken, but I'd just foreach, and if the object is_array then recurse. PHP's arrays are ridiculously versatile.
like smalltalk, ruby has member variables private by default (and you can't override it). but, you can ask ruby to provide standard accessors via attr_reader and attr_writer. if you need some special handling, remove your variable from those lists, and define a method "variable=(value)" or a method "variable".This sounds exactly what I'm looking for. My main 'beef' is just with people who do it needlessly, but again I can see your point. It's always nice to be able to define get/set functions and have those automatically implemented, but for the program to run fine without them implemented. If Ruby does that then I am impressed.
so if you just need the boilerplate stuff, it reduces to a single line ("attr_accessor :var1, :var2, :var3, ..") per class, if you need special behaviour, it still feels native to the user of the class as well as to its developer.
academia is still 20years ahead of industry, it's a shame.. the only good thing with .NET is (even though it's something _I_ won't touch) that there's already a smalltalk derivative which even keeps most (if not all, didn't look too deeply) features of smalltalk.XP is steadily gaining acceptance as it has been proven more efficient in various studies, and studies are what the executives are influenced by. Maybe that will mean more acceptance of Smalltalk et al. Though it pains me to say this, however, some big compiler brand (like, say, Microsoft) is going to need to get behind this before it catches on, and MS is pushing .NET so people are migrating to that instead.
with that one, you can even extend "finalized" C# classes, as smalltalk doesn't have the notion of a closed class.
as for the "proven more efficient" stuff around XP, well, that depends.. you can't take a bureaucratic company, put XP on top of it and expect it to solve all your problems - sometimes the managers are the problem, not the methods of the devs.
C and lisp are sufficiently different that you look at them and you can - at least - say, "this is (not) (c|lisp)"I disagree with your 'same decoration'. I've learnt C, Lisp, etc. and can switch between them easily enough. I hear it's not uncommon that programmers find it easy to learn new languages, because its the semantics that count. C++ and Java are admittedly a little too close for comfort given their underlying differences though, as you say.
with the right code, that doesn't work for java and c++, which was my point. if you want to disallow pointers (java), don't try to emulate a language that is designed around pointers (c++)
with database you probably mean relational database - OODBs are pretty powerful, and fully transparent - so, indeed.. those continuations (as the technique used in seaside is called) are objects that contain the full execute state at this point, stack, variable state, .. you can activate them and they continue there - hence the name.now, the system allows for some fancies: how would you store that count value in php - in a session? add it to every link, so that the state is up to date?
You'd use databases. Besides, for a store, all you really need to keep around are the user's details and cart. If you want to make sure each page is unique, throw the timestamp in with it
as they're objects, you can keep them in a collection, a bag, any kind of container.. and if you have more continuations around than you can store in ram (eg because you want to provide _huge_ timeout values), just stuff them into a collection that is registered with an OODB, and they're GCd out of memory and brought back in when necessary, without you noticing or doing something extra.
and that's the intention of such systems.. there's a ruby port of a slightly older version of seaside, called "borges" - a 1:1 translation.currently, most web development is page based.. you provide some options, get some values back, do something with those values, then decide what to do, and provide a new page - real ("native") applications don't work that way, and seaside is modelled after such applications.
Not sure about this ... web applications aren't yet 'real applications', having as they do user-initiated inputs and instant outputs, with dodgy passing of information through cookies etc. Anything that translates that into something resembling a real program, of course, is helpful.
then, for lisp, there's uncommon web, which is similar in concept, afaik - otoh I'm not too much into lisp, too much parens
just moved it elsewhereHad to put that at the end, didn't you :/