cberes

Writing about technology from an engineer's point of view.

Common Clojure idioms

Lembert Dome with some Clojure on top

Back in December I participated in Advent of Code. It's a 25-day programming challenge with a new challenge posted everyday from December 1 to December 25. I decided to take on the challenge with Clojure. Here's what I learned.

Read more >>>

How I converted this website to a static website

Static

Yesterday I converted this website (my personal portfolio) to a static website. The advantages seemed clear: cheap hosting, faster loading times, etc. But this website was built with Ring and Compojure. I'll explain how I made the change in this post.

Read more >>>

JUnit tips

JUnit tests

JUnit can be an extremely helpful tool for testing your code. Any tests for your code are better than no tests, but there might be some ways to get even more out of your tests. Are you really sure that you have the lines and conditions covered that you think you have covered? When a test fails, how long does it take for you to find out the source of the failure?

I present some helpful tips for improving your JUnit tests. I've had the luck of working with some great engineers who really knew their way around JUnit, and I'll share some tips I learned from them.

Read more >>>

Real-world tips for streams in Java 8

Pre-Java-8 stream

We made the switch from Java 7 to Java 8 a few months ago, not long after the last public release of JDK 7. This is at my 9-to-5 job. It was practically a seamless transition. Since then, I've enjoyed using one of Java 8's new features: streams! Streams add a functional element to Java that is useful for processing collections of elements.

When I created my first streams, I wasn't aware of the full capabilities offered by this new feature. So, I'd like to share some tips from my real-world use of streams. While I've modified the objects to be more generic, these examples are very similar to streams I created for real services.

Read more >>>

Making a bar chart of county names with Incanter

Chart of most popular county names versus frequency

In our last installment, we used jsoup and Clojure to parse a list of county names. As it turns out, we can thank George Washington for giving birth to both the USA and the most frequent county name: Washington County!

As promised, our county counter now automatically builds a bar chart (or histogram) of the most frequent county names in America. For this I used Incanter, "a Clojure-based, R-like platform for statistical computing and graphics." Above, you can see the final result.

Read more >>>

Most popular county names in America

Chart of most popular county names versus frequency

Lately I've been curious about the names of our counties. I live in Erie County. Are there other Erie Counties? What's the most popular name for a county? Is Erie a popular name? What about Buffalo ... a few years back, there was some talk about changing Erie County's name to Buffalo.

Okay, it's not the most interesting topic. Heck, it's probably not interesting at all. But I have questions, and now I want answers. This feels like a good opportunity to use Clojure!

Read more >>>