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

JEG2
I’m closing out, for now, my series on questions at the heart of development with an analysis of when we need more abstraction. For exam...
New
axelson
I describe how we use Hot Reloading with Webpack to develop faster and show how to integrate Webpack 5, webpack-dev-server, and Phoenix f...
New
New
brainlid
In a 2 day spike, I created my own Elixir-based AI Personal Fitness Trainer! The surprising part for me was how useful and helpful I foun...
New
brainlid
On your LiveView page, you are using a custom component. You want to be able to pass HTML attributes into the component, but the componen...
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
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
brainlid
OTP 26 was released and the Elixir 1.14.4 builds have been updated! Erlang OTP 26 changed how map keys are sorted, or not sorted actually...
New
SmartLogic
Season four of the Elixir Wizards podcast launches today! This season we’re focused on system and application architecture. We’ll be doin...
New
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
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
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement