Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

TeeJay
  (email not shown publicly)
http://www.aarontrevena.co.uk/

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm : london.pm, bath.pm, devoncornwall.pm
lug : Devon & Cornwall LUG
CPAN : TEEJAY [cpan.org]
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl [livejournal.com]
flickr :hashbangperl [flickr.com]

Journal of TeeJay (2309)

Monday May 17, 2004
10:15 AM

Tangram Inheritance problems

[ #18792 ]
Tangram has some severe issues with inheritance and relationships, given its goals.

It lacks Multiple Inheritance and doesn't provide an alternative. This sucks.

After several days trying to grok what the hell happens to cause it to generate a query with an aliased table missing (i.e. attempting to select t3.foo without specifying what t3 was).

Finally today I discovered that when I removed a layer of inheritance it suddenly worked. so if class A inherited from Class Super, then you can insert objects of Class A nicely into Class C via a relationship and it won't barf horribly. However if you make Class Super inherit from Class SuperSuper then the insert/fetch/etc calls will barf as Tangram gets itself all confused with no hint as to what the problem could be.

In fact the more I use Tangram, the more I think "given a month I could do a shit load better than this", so much so I reckon we (myself, a web designer who has picked up some perl, and our sysadmin) could replace the PoS pretty quickly if we sat down and coded something that meets our needs without trying to be clever and pure and 'elegant'.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • You're problem is just that Tangram takes over the database for you. It keeps a table that maps class names to table names so you never have to look that far down. It does cause an inheritance problem but I suspect that could be overcome, perhaps a 1-to-many relationship for class name aliases. I suspect it wouldn't be too horrible.

    Beware, though, creating your own mapper will drive you insane if you aren't careful. I don't use Tangram because I'm not willing to give up that much control. On the other end
    --
    Casey West
    • Tangram is just not ready for production use.

      The documentation is sparse, once you leave the trivial parts and it is hugely limiting.

      I wouldn't mind it hiding the complexity and details, if it let me choose to be able to at least see what was problematic and why it crashed.

      More error checking wouldn't go amiss either - failing to check that all the table aliases it refers to in a query are in there is a stupid loophole and the sql is generated so far from the query that its impossible to find where th

      --

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
  • Hiding the database details from you is the major feature of Tangram. If you want closer access to the database, you should look at Class::DBI or SPOPS.

    Beware of hubris about Tangram -- it does a lot of tricky perl magic in order to provide almost invisible persistence. It is not easy to build something like that.

    • I'm not after hiding stuff - I am after automating stuff - there is an important difference. When something is automated I can still see what is going on - critical in any system AFAIK.

      The schema and other bits of database behind tangram aren't anything special.

      --

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
      • If you're not after hiding stuff, then Tangram is the wrong tool for you. Hiding stuff is most of the point of Tangram.

        The schema that Tangram generates is simple, but handling the query language and doing all the TIE and proxying in order to make things like arrays work is quite complex.

  • Multiple inheritance in Tangram works fine. What doesn't work is empty intermediate classes. I got burnt by the same "bug" you experienced, and found that it was simply due to the fact that I had an "organizational" superclass with no actual attributes. A little class rearrangement and everything was OK.

    But I certainly don't disagree that Tangram has many rough spots.