juan_gandhi: (Default)
I'm pretty much tired of using so-called "DAO objects", automatically hibernate-generated classes that are dumb and simple; they are being used everywhere throughout the code; I was always willing to fill them with functionality, but, thank god, there was no chance.

Now I think this. Thanks to [livejournal.com profile] mikkim08 ideas for Scala. They should be all wrapped in decorators; and decorators should be returned from DAOs or factories. Performance-wise, it is just one level of indirection, and one more reference per instance. Conceptually, it is an implicit mapping.

E.g. I get "CountryData" from db; it is dumb and know nothing about life, just data. Wrap it in a subclass, and kaboom, an intelligent guy who can tell you this and that... and yes, immutable, since all "setters" are blocked by police.

So there.
juan_gandhi: (Default)
(that's scala)

  /**
   * Builds a category out of a segment of integers between 0 and n (not included).
   *
   * @param n number of elements
   * @return a new category
   */
  implicit def segment(n:Int) : Category[Int, (Int, Int)] = Category(PoSet.range(0, n, 1))
//...

  def testImplicitSegment {
    def sut: Category[Int, (Int, Int)] = 3
    assertEquals(_3_, sut)
  }

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

November 2025

S M T W T F S
       1
23456 7 8
9 1011 12 1314 15
16171819 20 2122
23 24 252627 2829
30      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Nov. 29th, 2025 12:31 pm
Powered by Dreamwidth Studios