I Love Go and Django. Here's Why.

TAGS: WEBDEV

I like Go and Django. Both are currently very valuable parts of my toolbox when working with web applications.

You might wonder why I have bundled up a language and a framework. Why not picking a certain Go framework? Because with Go, there are no must-use third party libraries. You’re completely free to choose and match, depending on the type of project.

Go is a amazing for writing flexible web services. Django is a lifesaver if you want to create a CRUD app with batteries included without getting sidetracked.

Let’s go into what each of them do well, and how they complement each other.

Django - so much developer convenience

The Web framework for perfectionists with deadlines

Django makes it very easy and fun to build a certain type of web application

  • a CRUD (create, read, update, delete) app. Funny enough, almost every single real-world web app can be started as a simple CRUD app.

With Django, you won’t have to reinvent the wheel. It just works and lets you focus on your business logic and creating something users can use.

Most things you will probably need already exist, and don’t need to be plugged together. (Well, sometimes configuring them can be a bit tedious.) Things like auth, user accounts, data migrations and the amazing admin interface.

It brings along a lot of convenience. If you were to use a micro framework instead of Django, you’ll end up reinventing or stitching together things you “wish you had in place already” like:

  • An ORM
  • Migrations!
  • Forms
  • User management
  • An easy way to add REST
  • Lots of choices you don’t know you need have been made for you
  • Lots and lots of structure and boilerplate
  • Easy access to plugins
  • An amazing amount of dev tooling

Sometimes, I’ll reach for Flask to get started with a simple prototype. But in the end, Django is my most productive tool for building classical sites which will be easy to maintain.

However, there are things which Django just wasn’t designed for. Things you CAN use it for, but you’ll feel like you’re doing things wrong and fighting an uphill battle.

If you really need to keep things minimalistic and want to avoid implicit choices, Django’s magic will get into your way. If you don’t want to use a relational database, you’re in for trouble. Doing lots of things in a parallelized fashion is not really straightforward. This is where Go shines!

Go - so much flexibility

Interested in getting better at Go? Check out Gopher Dojo!

Go is amazing for web services. You are completely in control as you can start from scratch. The language itself gives you a few advantages: static typing and advanced linting superpowers can save you from many silly mistakes. Concurrency is built into the language itself. You can create multi-threaded code without having to jump through hoops first.

Building your application is quick, and deployments are as simple as they get - you only need to deal with a single compiled binary without dependencies.

Go can help you when you really need to have fine-grained control and make unconventional choices. If you architect your application correctly, you’ll be able to adapt to changing requirements and new challenges.

You can architect beautiful applications which you can design to be testable, resilient and blazing fast.

There’s no magic to understand, as everything you need to know can be discovered easily. The things you build should be very easy to customize - even writing boilerplate code is cool with Go. It won’t stay untouched and your code will be able to evolve once the boilerplate needs to be adjusted beyond the default use-case.

But if you were to use Go for a CRUD app, you would miss having the things Django provides. Sure, there are frameworks for Go, but they are nowhere near as mature as Django. The place it shows most, is tooling and the pain from having to address well-known real-world issues around well applications you just didn’t think about yet. Reinventing the wheel can be kind of painful.

I don’t want to miss either in my toolbox

There are projects, where using Go would cause regret down the line. There are others, where Django is out of the question and wouldn’t be able to shine.

Depending on the project, it might be better to build a REST API using Django and Django REST Framework. Or it might be better to whip out Go and use it instead.

I’m very glad to have both in my toolbox, and it’s very liberating to be able to choose the right one for different projects.

One additional mention: VueJS. I LOVE it for the convenience of putting together an easy dynamic interface, no matter what backend language I work in. No REST endpoints are needed, but you can transition to them eventually. There’s almost no setup overhead - just a single .html file. If you haven’t got a convenient way to whip up a quick fancy UI for your web app projects, you should check it out!

Subscribe to my newsletter!
You'll get notified via e-mail when new articles are published. I mostly write about Docker, Kubernetes, automation and building stuff on the web. Sometimes other topics sneak in as well.

Your e-mail address will be used to send out summary emails about new articles, at most weekly. You can unsubscribe from the newsletter at any time.

Für den Versand unserer Newsletter nutzen wir rapidmail. Mit Ihrer Anmeldung stimmen Sie zu, dass die eingegebenen Daten an rapidmail übermittelt werden. Beachten Sie bitte auch die AGB und Datenschutzbestimmungen .

vsupalov.com

© 2024 vsupalov.com. All rights reserved.