logo

AWS Exam GuidesNewsletterBlogContact

👋 Hey! My name is Wojciech Gawroński, but others call me AWS Maniac.

My goal is to safely guide you through the cloudy and foggy space of the AWS portfolio.

Which Programming Language is the best for AWS CDK?

3 min read, last updated on 2020-12-22

Such questions are sparking heated debates, which are downgrading from a professional dialogue to a squabble in an exponential way. Nevertheless, I will try to answer this question objectively and fairly. Let’s do it!

It depends

That will be a consultant way to answer any kind of question. You’re welcome. No, but really - let’s leave the “consulting mindset” aside. Can we objectively evaluate that?

Let’s start with a simple heuristic and observations. My first steps go to the aws-samples/aws-cdk-examples repository on Github where you can see the following distribution of languages:

Interesting distribution, isn't it?

So it looks like Python has the best set of examples, and next is Java. However, there is a trap there, as this language is well-known for its baroquesque and verbose syntax. Disappointed? Well, I said it will be a heuristic - although looking inside directories per language, Python and TypeScript have the broadest possible set of examples.

Next, a few more observations:

  • In the official documentation, we can see equal support for all programming languages mentioned in the AWS CDK FAQ.
  • APIs are very similar between languages, but that’s a standard if you think about it, e.g., in the case of AWS SDK, we have the same story.

Generally, support looks pretty uniform across languages, but in the documentation, you can find this article:

Translating TypeScript AWS CDK code to other languages

TypeScript was the first language supported for developing AWS CDK applications, and for that reason, there is a substantial amount of example CDK code written in TypeScript. If you are developing in another language, it may be useful to compare how AWS CDK code is implemented in TypeScript and your language of choice, so you can, with a little effort, make use of these examples.

Official AWS CDK Documentation

Okay, so if TypeScript was the first one, let’s move it to the top of my list regarding the evaluation order.

Side note: I am not treating JavaScript as a separate option because CDK heavily relies on types, so it does not make sense to treat it separately as it will be more tedious and error-prone to work with this language.

TypeScript

So here are the following observations regarding this language:

  • (+) Types are definitely a plus and tremendous help.
  • (+) There are dedicated extensions for a rest framework (Jest) with custom assertions.
    • Official guides for testing are covering this language - like here.
  • (+) The most comprehensive documentation.
  • (+) One of the broadest set of official examples.
  • (+) The biggest library of blog posts on the internet.

Python

Now it’s time for a snake. 🐍 It looks similarly as TypeScript, but I have observed additionally this:

  • (+) It’s the kinda native language for DevOps Engineers, and thanks to that amount of resources on the internet are not smaller than for TypeScript, and this still grows.
  • (-) Less than ideal support for testing tools.

C#

C# was added in the second batch, and that’s visible because:

  • (-) It’s supported, but definitely, it is less popular in the community, so there are fewer examples available (both official and unofficial).
  • (-) Less than ideal support in testing tools.
  • (+) You can embrace functional programming via F# because it works really good.

Java

Last but not least - it’s time for our baroquesque language. The situation is pretty similar as with the C#:

  • (-) It’s supported, but definitely, it is less popular in the community, so there are fewer examples available (both official and unofficial).
  • (-) Less than ideal support in testing tools.
  • (+) You can embrace other languages - especially my favorite Kotlin.

Summary

In my opinion, the best choice is TypeScript. It just feels native for CDK, probably because it was a first language for the creators. 😉

Python is really close to this position, but it still has some small inconveniences. The rest of the languages are a daily uphill battle with documentation and a lack of examples, especially in the beginning.

For me, the choice is between Python and TypeScript, and we need to wait for more examples and better tooling around the rest. I firmly believe that eventually, it will behave as well as AWS SDK for various programming languages.

Subscribe to the newsletter and get notifications about new posts.

Subscribe

👋 Hey! My name is Wojciech Gawroński, but some people call me AWS Maniac. I am your trusted guide through the AWS Madness. If you want to learn more about me, you can start here.

Share it:

YouTube, Twitter, LinkedIn, Instagram, Facebook
awsmaniac.com © 2021, built with Gatsby and template from @kjendrzyca