Working As Intended

Elixir is Maturing

October 7th 2015

I’ve been using Elixir and Phoenix a lot lately. I’ve probably shelved Clojure for the foreseeable future. Some of the major happenings lately:

  1. Elixir 1.1 was released. The amount of work that José and the rest of the team are putting in is unreal. He’s also highly active on IRC, answering questions for other developers and newbies. The whole ecosystem of code and people is very “pre-1.0 Rails”. There’s a lot of excitement, and for good reason.
  2. Phoenix 1.0 was released. While it’s the “Rails for Elixir”, it’s far from a clone. It’s built to take advantage of Elixir and the Erlang BEAM that all of this runs on. I’ve played around with several of the versions leading up to this, but 1.0 finally feels like a solid platform. The biggest downside compared to Rails isn’t really Phoenix’s fault, but it’s just that there aren’t anywhere near as many 3rd party libraries to lean on.
  3. Programming Phoenix is in beta. Only the first 122 pages are available so far, but what is there is quite good. I worked through every example so far, and learned a ton about Ecto (the database access / query builder library) and the philosophy of Phoenix in general.

Still looking for a Clojure dev environment

March 16th 2015

I’ve been writing mostly all Clojure code recently. I’m still in search of a decent development environment.

I’ve tried Intellij + Cursive, and it’s decent but the REPL is super clunky. Test integration is terrible, and clearly an afterthought. The editor itself is okay, for an IDE, with the normal amount of having to use the mouse way too much to get anything done.

Lighttable is interesting. It’s super clean, and instarepl is fun to play with. It’s a feature that turns an entire file into a live REPL and shows you the output of every line at once. I can’t remember what exactly started annoying me about this one, but overall it seemed solid. If I were to hand a Clojure project to a newbie, I would use Lighttable for sure. It was close enough to “it just works” to be great for this purpose.

I spent a couple days (again) forcing myself to use Emacs (the clean OS X build). It’s super cool and super annoying all at once. I was getting pretty good at remembering the Cider key combos for evaluating code in the REPL, and that seemed to go well. Emacs integrating with a Lisp interpreter is pretty much the killer feature for me when it comes to Clojure. This has been a solved problem for years, so I would expect it to work well.

Ultimately, I started hating the other arcane key combinations I was supposed to remember that should have been more obvious. For example, I was trying to do a J from vim while in emacs, which joins two lines together. In emacs the command is C-n M-^, which is it’s own special level of insanity (memorize an oddball chord and have to reach M-Shift+6). I know that I could bind this to something else, but I don’t want to bind this to something else. I want it to be designed with humans in mind in the first place (emacs evangelists, unload your vim irony here) . Also, C-j to get a newline with auto-indent? Seriously?

I think I keep trying Emacs, because Brave Clojure loves it so much. This is a really good intro to Emacs and Clojure, and I highly recommend it. I have no doubts that I’ll be back to Emacs sooner or later. I’m sure it’s not done disappointing me yet.

Like every other time I’ve gone through this journey to find a new IDE I’ve ended up back at vim. The interface to nrepl via fireplace is decent, but not without its quirks. It’s good enough to execute code, which is mostly what I want anyway. For autotesting I’ve been using lein quickie. This has nothing to do with vim, so I’ll have to reevaluate my test issues with Lighttable and Intellij in light of this tool.

Now that I’m sort-of-but-not-really happy with my dev setup I’ve run into another issue. My Macbook Pro is out of RAM. Apparently the apps I run, plus multiple JVM’s for the various REPLs that all need to be going at once have put me right up against the 8 GB limit, and everything comes to a crawl. I could play around with JVM settings to buy some room, but it’s probably about time that I throw some new hardware at this problem anyway. I’m writing this on a mid-2012 MBP, like a fossil. I’m considering firing up an EC2 instance as a dev box until the new 15" Macbooks come out this summer.

Finding the source code for a Ruby method.

February 11th 2015

Today I discovered Ruby’s Method#source_location. I was getting strange results in a test case and wanted to see what was going on inside of xhr.

I added a breakpoint to my test.

byebug xhr :get, :show, id:

And then in the console that came up from running the test I was able to pull up the file and line number for this method.

(byebug) self.method(:xhr).source_location [“/[…]/gems/actionpack-4.2.0/lib/action_controller/test_case.rb”, 538]


Feed Feed