Contact Us

Use the form on the right to contact us.

           

123 Street Avenue, City Town, 99999

(123) 555-6789

email@address.com

 

You can set your address, phone number, email and site description in the settings tab.
Link to read me page with more information.

Blog

Filtering by Category: Java

Kotlin from JetBrains - try it now!

Mark Thomas

I love interviewing new developers.  It's a chance to chat with people who you don't know, and to explore ideas with someone who has different experiences and biases to yourself.  Hiring is hard, and in the past I've tried (and been tested myself) in many different ways.  At my current client, we're trialling an at-home coding exercise.  We are using a fairly straightforward problem involving a marketplace where participants can bid and offer, and the market will try to satisfy orders subject to some rules.  The idea is to send the candidate the problem and ask them to send in a solution giving an indication of how long it took them.

If the code looks good we do a pairing interview to explore the solution and work on some extensions.  It's an interesting way to figure out how someone thinks and just to see if they can produce something of high quality when they aren't pressured.

I decided to give the test a try myself to understand how difficult it is and then I remembered that I'd been meaning to try Kotlin ... Kotlin is a statically typed programming language from JetBrains.

My considered opinion after two hours writing Kotlin is that it's awesome!

To get started I had a quick look through the Kotlin language reference to get the basics, and then fired up a new Gradle based Kotlin project in IntelliJ.  I'm targeting the JVM and so everything was fairly familiar to me.  Gradle downloaded JUnit and Hamkrest (the Kotlin port of Hamcrest) and I started  TDDing my way to a solution.

The first and most obvious thing I noticed was the lack of boiler plate code.  I could create simple immutable classes in one line (see Data Classes in Kotlin), and get basic things like equality, hashcodes, toString methods for free.  The collections libraries worked well and as you'd expect from JetBrains, the IDE support is very good.  The solution I was left with was both expressive and simple.  Surprisingly given my complete lack of Kotlin experience, I think I probably got to a solution faster than I would have done in Java which I've been using for years.

For me part of the excitement is a feeling that Kotlin might be a good fit for Enterprise dev teams who use Java now.  The transition is easy, and the tool support combined with JetBrains backing may make Kotlin an easier sell than some of the other alternatives.  Time will tell.

I'll spend more time with it and develop my thoughts, but I'd definitely recommend that others take a look.  You can even try online here.

maven-polyglot and IntelliJ

Mark Thomas

IntelliJ doesn't have support yet for non-XML Maven POMs, but all if not lost if you want to use them with your favourite IDE.  The polyglot-translate-plugin provides a good workaround by generating a pom.xml which IntelliJ can use based on your Ruby/Groovy/Clojure etc. POM.

For example, if you are using Ruby then you can run the following command to generate a pom.xml:

mvn io.takari.polyglot:polyglot-translate-plugin:translate -Dinput=pom.rb -Doutput=pom.xml

If you want to avoid typing out the parameters each time you run the translate goal, then you can move the plugin settings to your pom.rb:

build do
	plugin_management do
		plugin 'io.takari.polyglot:polyglot-translate-plugin' do
			configuration('input' => 'pom.rb', 'output' => 'pom.xml')
		end
	end
end

Your pom.xml can then be generated with:

mvn io.takari.polyglot:polyglot-translate-plugin:translate

There is an open feature request to add maven-polyglot to IntelliJ: https://youtrack.jetbrains.com/issue/IDEA-138776 

Moving from Java to C#

Mark Thomas

After about 10 years working primarily in Java, I'm a few weeks in to my first commercial C# project. The transition was much smoother than I'd expected and after some head-scratching around the syntax additions in C# 3, I feel productive. I'm surprised how little time I have needed to spend learning the .NET framework libraries and exploring the .NET open source community.  As a business app, most of the code I am writing models the domain and interacts with other parts of the domain; it is all written by the team.  With the exception of things like the collections classes, most of the framework/library interaction is on the fringes of the system.  That said I've done my fair share of Googling things like 'How do I parse XML in .NET', but the community is large and so it's easy to find solutions to problems. A harder part is learning C# idioms, the Manning book C# in Depth was great for this (see later) as were chats with my teammates and pair.

Along the way I've picked up a few useful resources:

Resources

Other thoughts

  • Get Resharper
  • If you are familiar with Java IDEs like Eclipse or IntelliJ and regularly re-factor then you will need Resharper. The out of the box support for refactoring is minimal even in VS2008.

  • Remember there is an eco-system outside of Microsoft
  • Many companies having selected .NET will automatically favour Microsoft solutions for everything. Even though the open-source community doesn't appear as vibrant as for Java, it does exist. Check out alt.net too.