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

August 2025

S M T W T F S
      12
3456789
10111213141516
17181920212223
24252627282930
31      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 10th, 2025 10:40 am
Powered by Dreamwidth Studios