ragamuf

ragamuf

Elixir Blog Post: Software developers should not be afraid of their code

A little halloween hocus-pocus on the value proposition of having a reliable test suite in place.

You are not scared, are you?

Most Liked

dimitarvp

dimitarvp

Many of us know this, man, the problem is, 80% of the time, leadership who indeed (as you said) asserts “if it ain’t broke don’t fix it”. The other 20% are spoiled programmers that constantly have to touch their code out of some misguided sense of perfection or vanity.

The job of us the senior programmers should also be to educate. Use any analogy you can – car needs changing of oil and while doing that the mechanic might notice a bigger problem is a good example that I found stuck with a good amount of business people – and do your best to get the message across.

We have to find a way to communicate the challenges of just letting the code sit and never get updated. Because unfortunately people come to tech with a lot of uninformed bias and prejudice and they have to be either educated out of it, or we should leave. Or we can just make peace with it, collect paycheck and do the minimum – I don’t blame the people doing it because fighting with leadership is (a) not everyone’s goal in life and (b) very hard.

derpycoder

derpycoder

Testing is a first class citizen in Elixir and same for Phoenix framework as well.

Elixir’s founder, Jose Valim even pointed out in his talk about his future with Elixir, that Types don’t solve the errors or help greatly with refactors, it’s the tests that enable us to have the fearless refactors. (See: Types lead to fewer tests)

Testing is so well integrated that the code examples mentioned in the documentation are verified as well, so they don’t end up breaking later on!!

Testing with Live View takes it to whole another level, i.e. you test your whole site in parallel, and without a headless chrome or browser instance slowing your tests down!!


Everyone realise the importance of testing, otherwise the tooling won't exist!!!

There’s a course which I have my eyes on for testing Live View: Test LiveView effectively. Trust your code. Ship confidently.
There’s Property Based tests: StreamData: Property-based testing and data generation

There are libraries to enable those:
PropCheck - Property based testing for Elixir
Faker - Fake data generation for Elixir

Ecto allows creation of test databases and what not, so you don’t end up messing up production db. Emails can be previewed without really sending them to real Email receivers in development mode!!


But man it depends on the company, I have been part of 2 such companies in my 7+ years of experience and they make us work as if the world is about to halt without their products and services.

Sprint after sprint with no breathing room, while “SCRUM Master” tersely explains, after office hours, that the ticket needs to go by this sprint & that deployment needs to happen by weekend.

And the beautiful architecture you dreamt for yourself, gets thrown into the mixer. It gets unrecognisable with each sprint.

Business use cases gets so twisted that even the browser groans while rendering your simple form, while it happily plays shadertoy or youtube on the side.

GitHub action pipeline consists of shallow metrics, that is so detached from reality that it shows a green tick even when the changes made will fail at runtime.

The application so unnecessarily distributed that you can’t make heads from tails. Good luck running distributed testing on a graph of micro services that’s so dense, even OOP inheritance gets put to shame.


So perhaps testing is not the root cause of our fear, rather its Scrum, Sprints & Microservices!.

I believe ousting people who have no business in Software Engineering and getting rid of the scrum bi-weekly waterfall model, for development, will be a step in the right direction.

And to top it all of, maybe we should return back to monke Monoliths, with a dash of Tests on the side. :wink:

quda

quda

…or just the programmer is too busy, has a family, multiple jobs, multiple customers, other priority projects, other personal issues so he won’t update its code unless it’s requested by leadership/customer: “it’s broken, fix it!”. IMO, this happens 99% of the time.

Where Next?

Popular in Blog Posts Top

New
brainlid
There is a new community resource available on writing “Safe Ecto Migrations”. When we get a migration wrong, it can lock up your product...
New
wmnnd
Hey there, I’ve started a little blog series about building and deploying Elixir applications. Now I would like to share with you the f...
New
ragamuf
A little halloween hocus-pocus on the value proposition of having a reliable test suite in place. You are not scared, are you?
New
ConnorRigby
Just finished a post for Embedded Elixir and I thought it should be cross-posted here: I’ll update this thread as posts get published. ...
New
AstonJ
Elixir Blog Posts How to use this section You can post links to your blog posts either in one of the Official Blog Posts threads, or, vi...
New
Paradox
Testing is an important part of any modern piece of software. But writing tests can quickly become an exercise in frustration, with tons ...
New
psantos
Just wrote a new blog post about how to deploy a Phoenix app using Kamal 2. Check it out and let me know what do you think:
New
alvises
Just published the first part of series of articles aimed to explain the architecture behind a kv-store engine written in Elixir and impl...
New
davydog187
Hello all! I wrote a blog post called Elixir Observability: OpenTelemetry, Lightstep, Honeycomb. The post post covers how to integrate ...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement