NLOOVM

Just a sort of random thought; I think it’s interesting to see the number of efforts to build new languages on old vm’s (NLOOVM).  For example:

JVM:

  • Clojure
  • Scala
  • Kotlin

BEAM:

  • Elixir
  • Lisp Flavor Erlang (LFE)
  • Alpaca

These new languages are getting lots of traction.  Likewise it’s an interesting (and somewhat puzzling) situation with the CLR.  Pretty much anyone working on the CLR is working on C#.  Oh there are other languages on the CLR but they have nowhere near the level of interest or penetration of either Clojure or Elixir respectively.

Tooling Not Craft

For a while, I’ve had the nagging feeling that there’s something missing with the way that many junior developers learn to write software these days. In a way that I suppose makes me a bit of a curmudgeon, I somewhat long for the days before the prevalence of the IDE and the automated unit test framework.   But rationally I know that IDE’s and other specialized tooling have done a lot to both cut grunt work and to eliminate accidental complexity so it’s hard to deny they’re a big step forward from what came before.

And then it occurred to me.  Some of my issue with the modern tendency toward doing everything in the IDE is the tendency that weaker developers have to conflate tooling with craft.  Because Eclipse has the ability to automatically generate getters and setters for each data member of a Java class they simply stop questioning the wisdom of having getters and setters for all the members and merrily march forward–exposing far more data than they should.  The benefit of data hiding, which, after all, was the original benefit of private class members is largely lost because they can’t be bothered to actually think through the wisdom of effectively turning a class into a pseudo-struct.

A long time ago when I first began coding I had a senior developer who mentored me.  I had a bit of a tendency to charge in and start changing code (I am still guilty of that I suppose) without really thinking through the problem.  He wisely counseled me to take a few minutes to think about the problem before I started hacking.  Now I think I understand how he felt.

Don’t get me wrong–better tooling is definitely a good thing.  But don’t let your tooling dictate your craft. And if you want to be a truly better developer focus on learning the craft of building strong code.  The tooling is important, of course, but the underlying craft is much more important.

Some Updates On “LDAP Authentication With Phoenix”

There’s an excellent write-up on authenticating users against an LDAP database with Phoenix which was created by Richard Nyström.  For some reason even though it’s barely a year old, there seem to be a few points that are either out of date or simply incorrect. I worked through his example and I wanted to share a few amendments to his original code in the interests of other developers who may want to use LDAP with Phoenix.

First the set up of Phoenix


mix phx.new ldap_example # was mix phoenix.new ldap_example
...
Fetch and install dependencies? [Yn] Y

cd ldap_example

mix ecto.create (configure your db in config/dev.exs if needed)

mix phx.gen.schema User users username:string name:string email:string
# was
# mix phoenix.gen.model User users username:string name:string email:string

mix ecto.migrate

Next change is in the session_controller.ex file:


#was LdapExample.SessionController

defmodule LdapExampleWeb.SessionController do

#was LdapExample.Web, :controller

use LdapExampleWeb, :controller
alias LdapExample.{User, Repo, Ldap}

def new(conn, _params) do
render conn, "new.html", changeset: User.login_changeset
end

def create(conn, %{"user" => params}) do
username = params["username"]
password = params["password"]
case Ldap.authenticate(username, password) do
:ok -> handle_sign_in(conn, username)
_ -> handle_error(conn)
end
end

defp handle_sign_in(conn, username) do
{:ok, user} = insert_or_update_user(username)
conn
|> put_flash(:info, "Logged in.")
|> Guardian.Plug.sign_in(user)
|> redirect(to: page_path(conn, :index))
end

defp insert_or_update_user(username) do
{:ok, ldap_entry} = Ldap.get_by_uid(username)
user_attributes = Ldap.to_map(ldap_entry)
user = Repo.get_by(User, username: username)
changeset =
case user do
nil -> User.changeset(%User{}, user_attributes)
_ -> User.changeset(user, user_attributes)
end
Repo.insert_or_update changeset
end

defp handle_error(conn) do
conn
|> put_flash(:error, "Wrong username or password")
|> redirect(to: page_path(conn, :new))
end

def delete(conn, _params) do
Guardian.Plug.sign_out(conn)
|> put_flash(:info, "Logged out successfully.")
|> redirect(to: "/")
end
end

The changes to user.ex are not made in the web/model/user.ex; rather they’re made in the existing user.ex file.

And finally a change to session_view.ex

#was LdapExample.SessionView

defmodule LdapExampleWeb.SessionView do

use LdapExampleWeb, :view

end

Win Tickets To Detroit.Code

I am very excited to be helping with the inaugural Detroit.Code conference here in July 2017.  In fact all of us that work on the DetroitDevDay conference are very excited about this new conference.  We all support growing the metro Detroit software development community and this is another great step in growing that community. (Full disclosure: I am speaking at Detroit.Code.)

As such we want to help make sure as many folks get to the conference as possible. So we’re going to give away a couple of tickets to the event. However, we want to have a little fun at the same time.  So we’re also going to run a little coding contest; everyone who gets the right answer on the coding contest will be entered into a drawing for the two tickets we’re giving away.

I have no interest in spamming folks with the details of the coding contest so if you’re reading this and you’d be interested in getting into the contest, please send me an e-mail at catenacci@ieee.org (gad I’m sure to have more spam soon) and I will add you to the list of folks who get the coding challenge.

Code And Coffee

I’ve always admired something that my friend @CarinMeier mentioned that they do down in Cincinnati (or at least they used to do it anyway).  That’s  a once-monthly “Code And Coffee” where people would get together at a local coffee shop to drink coffee and learn about some interesting topic.

I’m going to be at the Biggby Coffee in Clawson (on 14 Mile) on Wednesday May 3, 2017 at 7 am.  If you’re reading this blog post consider yourself invited to join me for some coffee, some shop talk, and likely some coding.  If you want to join, feel free. People who know me will probably guess that I’m likely to talk about functional programming but honestly I’m willing to talk about almost anything technology related.  If you do decide to join, bring a laptop.

Detroit Day Of Functional

After a bit of discussion and debate a few of us have decided to go ahead with the Detroit Day of Functional on March 25, 2017. Detroit Labs is kind enough to let us borrow their space for the day so that’s where we’ll have it. We’re charging $30 a ticket but that’s mainly to cover lunch and maybe a t-shirt for the attendees if there’s enough left over for that.

We’ve also decided to do something a bit novel (well novel for me anyway). We’re organizing the event as an unconference. That means no pre-selected speakers or sessions. We’re running the whole thing on the principle of open spaces.

I know some people will wonder why we’ve decided on this approach. I can’t speak for my colleagues but for me there were a few good reasons:

  1. I wanted to keep the event relatively simple and I wanted to focus on content more than anything else. A call for speakers is a lot of work and frankly as much as I’m usually happy with the folks we end up with I also feel bad for those who submit great ideas that we can’t accommodate. This way if anyone’s got something really neat they want to discuss, they have the opportunity.
  2. I’ve observed that no matter what I pick for a conference there are people who feel that I’ve got some sort of blinders in regards to content. I’ve been told that my conferences are too “Microsoft-centric”. I’ve also had people express concerns that underserved populations aren’t represented enough by speakers at my conferences. Well here’s your big chance to show me what I’ve been missing. Literally anyone who cares to lead a session can do so. If, for instance, you don’t feel like there’s enough content on stack-based languages at conferences, here’s your chance to remedy that. Want to have a conversation on why functional programming stinks? Feel free. That’s the point of holding this as an unconference–you decide what we discuss, not the organizers (well, not only the organizers anyway).

I wanted to insure that people know exactly what to expect from the start. I wish I were a bit more glib because I think that sometimes people feel that I swing some pretty blunt language but I can’t think of a clever way to say “Hey, we’re not going to have speakers for this event. We will have lunch and we may have t-shirts but no set agenda in terms of speakers.” I’m tempted to set up a pool to see how long it takes someone to ask me “Hey why aren’t you guys going to have speakers at your event?” This is my attempt to forestall the question before it’s even asked.