rethinking aatree

2 views
Skip to first unread message

William la Forge

unread,
Sep 6, 2015, 9:27:45 AM9/6/15
to AgileWikiDevelopers
Everything always looks good until you decide to use it. In the case of aatree, I want to build on it and, as it is written, I would need to duplicate all the code. The issue is that I am a Java programmer working in Clojure.

In Java, methods are bound to an implementation which then gets subclassed. But in Clojure, you do not subclass. So you keep the number of methods to a minimum and put the bulk of your logic in functions.

So it looks like I need to work on aatree 0.2.0. And I should add an aavector into the mix. I'm going to need aavector later anyway, and it will help drive code reuse.

But I should note that when I did this in Java, I ended up rewriting the code anyway, even with subclassing. Things just got so complicated. My expectation here is that functions are more reusable than methods, especially when multi-inheritance is not an option. 

But at least I've made progress. I can now program in Clojure. I just need to write more reusable code. I am still such a newbie. There is a lot of code out there that I still can not understand without a major effort. And I'm talking about single lines of code at that!

Raoul Duke

unread,
Sep 6, 2015, 11:20:24 PM9/6/15
to AgileWikiDevelopers
while i often turn to inheritance by default, i feel like 9 times out
of 10 it ends up being bad news.

i wish we all used languages that favoured composition.

William la Forge

unread,
Sep 7, 2015, 6:42:01 AM9/7/15
to AgileWikiDevelopers
Not to dis Java completely, what I am talking about is the roughly the same as having default methods in interfaces (Java 8). And I used them when working with aa trees in Java. So I am not sure why I have a higher expectation for Clojure. But I do.

Also, the problem I am looking at in Clojure is tougher, as I am doing a full integration, which means addressing all the collection interfaces in both Clojure AND Java. Though I am cheating by using some of the abstract classes used to implement Clojure's own data structures.

Of course, this is a rewrite. And that always helps. :-)


--
You received this message because you are subscribed to the Google Groups "AgileWikiDevelopers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to agilewikidevelo...@googlegroups.com.
To post to this group, send email to agilewiki...@googlegroups.com.
Visit this group at http://groups.google.com/group/agilewikidevelopers.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages