MarzhillMusings

OsCon2010 Notes

Published On: 2010-07-19

Blender Tutorial:

  • Speaker:
  • enjoyed his enthusiam and the obvious mentoring from his father

Scala Tutorial:

  • Speaker: Dean Wampler
  • Really informative overview of Scala.
  • Notes
    • Type inference
    • Concise
      • No boilerplate
      • User defined factory methods
    • Templated classes
    • Objects as Functions
      • And vice versa
    • Classes:
      • fields are private by default
      • var keyword generates getters and setters (uniform access principle)
      • case classes provide helpers for structural classes
    • Traits:
      • Interface + optional Implementation
      • Templatable
      • Construction time mixin of traits using with keyword
      • Traits in Scala are order dependent
    • object = singleton class
      • constructed at the definition
    • misc
      • Unit ~~ Void
    • Akka scala actor library

Dependency Injection with Guice Sucks

Published On: 2010-07-14

I've learned to hate Guice lately.

  • It decouples the wrong things.
  • It hides details you care about.
  • It doesn't do anything a Factory class wouldn't do better.
  • It locks you in (Nobody leaves Guice... No Body)

Therefor * It's harder to reason about.

Tags:

Is NIH really so bad?

Published On: 2010-03-02

This site is now powered using molehill. I say this because for one it's nice to announce this sort of stuff and two because it leads into the main content of the article. Molehill is a static site generator and commandline content management system. It uses vcs to track changes and can build a site from files containing content on a filesystem. Because molehill is a site generator and not a web application it doesn't serve files up as part of it's normal operation. But while developing the application I found myself wishing I could temporarily serve the content from a server to see what it looks like and behaves like in that environment. So I needed an embedded webserver. Since this wasn't meant for heavy extended use and mostly only for testing a molehill site I didn't want anything fancy or complicated to use. My requirements were simple.

  1. It had to serve content from a directory
  2. It had to allow you to specify the port
  3. It shouldn't require a lot of dependencies
  4. It shouldn't be hard to add.

Now Molehill is written in clojure, which means theoretically it has access to all the wonderful libraries java has accumulated over the years. So finding a small simple embedded webserver should be easy right? I looked at:

  1. Jetty (not easy to setup or use)
  2. BareHTTP (looked like it did what I needed but the code didn't actually work)
  3. Commanche (not easy to setup or use)

Finally I found a less than 100 line clojure gist on github that did exactly what I needed. When I twittered about the find and my frustration looking for a java option I received responses ranging from: "Cool that didn't take long" to "Why are you so down on Jetty?" The latter opinion seemed to be that Jetty was fine so why invent another solution. One said I was crazy since his production jetty xml config file was only 50 lines long. Keep in mind that I was wanting to launch this from commandline with only a single command line parameter, the port, for configuration. I certainly didn't want to have to write an xml file every time I started a new site. Why put the user through that? Granted I could probably have programmatically configured the Jetty server using clojure code and not needed the file, but again why should I have to? In my mind the extra dependency, lack of simplicity, and general uckiness of using jetty for this wasn't a good fit. What I needed was something that fit in a single clojure file had no dependencies and did simple webserving. For that the github gist was exactly what I needed. It improved things for the user and the coder and in my mind thats a win win.

I agree that trying to invent everything yourself can be prohibitively time consuming and fraught with unexpected problems. Spending a little time looking for something that has already solved your particular problem is a good investment. But making it a religious belief can be just as prohibitive. Jetty is very good as an embeded java http servlet container and server. It does a fantastic job at this and if you need that in your app it's a lightweight way to go. But if you all you want is a temporary static site server with only two configuration options then jetty suddenly gets in your way. Sometimes the only solution is your own solution and that's ok. So the next time someone announces they had to build something because your favourite library/application/tool didn't do what they needed don't yell at them. Congratulate them on finding an unfullfilled need and wish them luck in their endeavor. It might not be NIH It might instead be NIY (Not Invented Yet) and you just didn't realize it.

Top X Design/Coding Principles

Published On: 2009-08-29 00:16:37

Design/Coding rules

  1. Data and Operations should be seperate

  2. Workflows are awesome

  3. Work from the outside in

    1. Then from the Inside out
  4. TDD TDD TDD

  5. Keep the IO partitioned and at the edges

  6. API's need to be *tight

    1. More Permissive == more Headaches
  7. Fuzzy states are bad

  8. Every if has an else

  9. Boilerplate is bad (boring to review hard to get right)

Really liking the new kde4

Published On: 2009-06-27 13:13:20

I just recently upgraded my home desktop. It was nearing 10 years in age and desperately whispering to me in my sleep that it wasn't going to last much longer. The new machine is a Quad core AMD phenom with A Gigabyte board and 8 gig of ram. This of course necessitated a new OS to go along with the shiny new hardware, so along comes Ubuntu Jaunty with its 64-bit joy and the shiny new KDE4 desktop. I had previously switched from kde to gnome despite being a kde fan for years because gnome had just begun to feel more cohesive. I still disliked the lack of configurability as compared to gnome but overall gnome felt better. But with the new kde4 I've come back. Plasma and the kde desktop have really upped the game. The whole experience has vastly improved and kde no longer feels like it's lagging behind but has leaped ahead of the competition. If you haven't checked it out yet you should give it a try.