tl;dr;

I wish I didn’t have to emphasize that I know multiple languages and ecosystems. I feel that all developers should be cognisant of what’s out there, and know multiple stacks and platforms. Here are some tips and lessons learned on picking up another language. Be sure to listen to the Hanselminutes podcast where I talked about being a polyglot developer.

My Background

Deciding on the Next Language You Want to Learn

Here are my recommendations for which language to tackle given which language you already know.

If You Know C#

If You Know Ruby/Python

If You Know JavaScript

JavaScript (ES5) is a terrible language. ES6 improves on it greatly. At a minimum, learn ES6 and move away from ES5.

With that out of the way, I feel that some time needs to be spent on the organization of languages.

How do you perceive JavaScript? A language that is function oriented or class oriented (you’ll notice that I didn’t say object oriented)?

The current JavaScript landscape splits it into two philosophies.

JavaScript is a terrible class oriented language that needs to be improved.

and

JavaScript is a terrible function oriented language that needs to be improved.

For those that want JavaScript to be a class oriented language, they want:

function Person(firstName, lastName) {
  this.firstName = firstName;
  this.lastName = lastName;
  this.sayHello = function() {
    console.log(this.firstName, this.lastName, ' says hello.');
  }
}

var person = new Person('John', 'Doe');
person.sayHello();

to look like this instead:

class Person {
  constructor(firstName, lastName) {
    this.firstName = firstName;
    this.lastName = lastName;
  }

  sayHello() {
    console.log(this.firstName, this.lastName, ' says hello.');
  }
}

let person = new Person('John', 'Doe');
person.sayHello();

For those that want JavaScript to be a function oriented language, they want:

function sayHello(person) {
  console.log(this.firstName, this.lastName, ' says hello.');
}

var person = { firstName: 'John', lastName: 'Doe' };
sayHello(person);

But with some guarantees about the mutability of objects:

function sayHello(person) {
  console.log(this.firstName, this.lastName, ' says hello.');
}

//wrapping this hash in `immutable` ensures that sayHello cannot
//change the properties of the person hash.
let person = immutable({ firstName: 'John', lastName: 'Doe' });
sayHello(person);

For those that have only used a class oriented language (which is most of us), consider this blog entry by Leon Gersing, where he goes into detail about forcing JavaScript to be a class oriented language (when CoffeeScript first came out). Specifically:

That’s it. Now, I know what you’re thinking, “Leon, please, [the class oriented example] is contrived and doesn’t represent real world domains.” You’re right and so is [my function oriented example] as a result. “But you also didn’t create real domain models.” Also right, because I didn’t have do, nor would I ever want to. Therein lies my point.

Sometimes a struct is a struct and not an class. The difference that I’m desperately trying to convey in this overly simple context is that by leveraging FP over OO (he really means class oriented, not OO) one can provide not only a more dependable abstraction but when combined with JavaScript’s inherent flexibility as a language, we can achieve true referential transparency and polymorphism.

and also:

FP encourages building small functions that do not mutate state and can be bound together as needed to perform a task whereas the OO [class oriented] philosophy is to encapsulate and achieve polymorphism through interface or contract. The more dynamic your context the more OO’s [class oriented] encapsulation paradigm, as seen in the inheritance model, leaks..

Please understand that class oriented languages are not the be all end all (neither are function oriented, but I feel emphasis needs to be placed on the former given our collective “industry” language experiences).

How Much of a Language Do I Need to Know

Having a full month of full time development in a language will get you pretty proficient. Here are some ways you can use a language in a “safe” way (and hopefully on a daily basis) during your 9 to 5.

Sometimes you have to spend time outside of work to pick up a new language. Here are some ways to make it less of a chore.

Here are a list of libraries/GH repos in assorted languages to get you started on your journey (these are libraries I’ve actually used in production environments/at clients):



Subscribe to get high signal, low noise entries with regards to software development, doing what you love, and never being content with where you are.

Also, I've spent the three years fighting the uphill battle of getting noticed in the App Store. I've decided to write some words about it in book format.

powered by MailChimp

23 October 2016