DEV Community

Jake Varness
Jake Varness

Posted on

32 Lines of Code

At Cerner, we engineers work really hard to deliver innovative health care solutions. However, we also play (and hack) hard too!

Among a list of Cerner's internal hackathons is a programming competition called 2^5. The rules for this competition are fairly simple: for 32 days you can make one submission per day that's 32 lines or less of code.

This was my second year participating in the competition, and I gotta say... It's super fun. Here are a couple things I learned this year during the competition:

32 lines can be powerful

Ever deploy an enterprise application that was 32 lines or less that you never had to maintain? Me neither.

However, it's incredible how you can make simple applications using 32 lines of code. Take my submission that uses Vue as an example. Todo App is a pretty classic app to write as a hello, world! replacement for web development.

This little app just uses Vue and bootstrap to create a small application to list out all the things you have to do in a way that looks somewhat visually appealing. Will it sync up to the cloud? No. Was I able to add a button to each item that would allow you to delete it? No (would have made the submission more than 32 lines). Is it a good starting point for learning two extremely popular web technologies? Yes indeed.

Even if your 32 lines doesn't really do anything that's "cool" or "noteworthy", it can still act as a foray into expanding your knowledge. That's what a lot of my 2^5 submissions were meant to help me do: learn things I didn't know before.

The web now owns your favorite language

Don't believe me? Just look at my submissions:

Kotlin

If you write any Kotlin code or have read the docs, you know that Kotlin can be compiled into JavaScript to allow you to write front-end web application code, and it's also becoming (if not already) the defacto standard for writing native Android applications.

But did you know that you can use Kotlin to create web services as well? I certainly didn't until I found ktor, a Kotlin web framework for making web services.

I was able to write small snippets of code using Kotlin to write web services as well as web sockets.

For those of you who might use Kotlin to write applications, this is really great, as it means that your whole technology stack can be written front-to-back in Kotlin!

Swift

I wasn't going to write about Kotlin without giving at least a little bit of attention to the Apple fanboys/fangirls out there!

If you write code in Swift already, you probably know that you can write iOS and macOS applications using Swift and Apple's native libraries. However, did you also know that you can create a web service using Swift as well?

One of my submissions in Swift uses a library called Vapor to write a small microservice that calculates the Nth fibonnaci number.

Apple engineers can now also write their whole tech stack in Swift as well! All of this innovation is great news for developers because they don't have to make investments in multiple languages in order to perform the work they need to do.

Others

Of course Kotlin and Swift aren't the only languages that could bode good news for developers. I didn't have time to make submissions in all these other languages, but .NET Core is another great option, as well as Dart for all you Flutter enthusiasts out there.

If you look hard enough, you'll probably find a way to create a web application or microservices using your favorite language. Is it going to always be practical to do that? Not necessarily, but it's possible at least!

Technology is growing and becoming more diverse

When I graduated from college in 2014, 90% of my skillset involved experience in Android, WPF, and Java services. C# and Java was really all that I knew.

Looking back on the last few years of my career, I have learned so many different langauges. I have all of my submissions from the last two years in this Github repo:

GitHub logo jvarness / cerner-2-to-the-5th

Submissions for 2^5

cerner-2-to-the-5th

Submissions for 2^5.

Assume MIT license for all submissions.




I went from knowing... Really only 2 languages to learning a little over a dozen in a couple of years!

Many of the languages I know now seem to really only have gained traction over the past couple of years: Go, Dart, and Elm have been in active development for quite some time, and each have grown in popularity drastically since I graduated.

Even if I haven't really developed full-fledged applications in these languages, I have at least had opportunities to learn them. Participating in competitions like 2^5 gives me an chance to become a little more diverse in my skillset.

Thanks for taking the time to read this, and I hope you guys enjoyed all the little snippets and stuff I shared today! If you have questions about anything I've written about, or about the code I wrote, drop a comment!

Top comments (9)

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Should really be restricted to a number of characters/bytes rather than a number of lines, since a line can be as long as you like. Also, allowing the addition of Vue or Bootstrap (or any other library) is adding hundreds if not thousands of lines, making the 32 line restriction meaningless.

Check this out - 1K of JS - js1k.com/2018-coins/demo/3185

(making of - romancortes.com/v2/nefertiti-1kb.html)

Also this game - also 1K of JS - js1k.com/2017-magic/demo/2846

(Github repo here - github.com/veu/js1k-2017)

Collapse
 
jvarness profile image
Jake Varness

Pulling in Vue and Bootstrap for something this simple is overkill for sure. I'm just glad I was able to take my first dive into Vue since there's been so much hype around it!

Collapse
 
vinceramces profile image
Vince Ramces Oliveros

I am using Flutter/Dart in VSCODE and IntelliJ IDEA(Android Studio) and their style guide makes it easy for productivity as well as readability of the code. after doing fancy myMethod().myFunction().whatEver().iDontCare();, dart will always format on save to maintain the code readable using Dart Format.

Good article for good practice in a simple problem. This will be helpful for someone who looks for a simple class or function.

Collapse
 
jvarness profile image
Jake Varness

Yes, simple problems are great for practice! It doesn't even have to be a new problem. Solve something you already solved but use a different language!

Collapse
 
jdsteinhauser profile image
Jason Steinhauser

I really like the challenge of doing things in 32 lines at most! Have you been inspired from some of your coworkers' submissions, either in learning a new language/library or thinking about a problem in a different way?

Collapse
 
jvarness profile image
Jake Varness

Hey Jason! Sorry it took me so long to respond to this!

So many of the submissions do so many cool things! When we demoed our favorite submissions to each other, I was shocked to see how much people could accomplish with so little code!

It also makes me think about whether or not a different technology would provide more benefits over the technologies we currently use. New technologies sprout up every day, and it's cool to see the potential!

Collapse
 
jdsteinhauser profile image
Jason Steinhauser

Excellent, thanks for the response!

Collapse
 
gypsydave5 profile image
David Wickes

It would be remiss of me to point to a much better Kotlin library than the ktor framework - http4k.

Collapse
 
jvarness profile image
Jake Varness

This looks awesome! I'll have to check it out. Thanks David!