Future of end to end testing
End to end testing of web software is slow and painful.
The most popular tool is Selenium. But there are much better options.
Selenium was created by Jason Huggins in 2004, so it'll be 20 years old next year.
It's served us well as a developer community, but I think it's time to talk about end to end testing tools for the next 20 years.
There are many candidates out there:
Cypress
Nightwatch.js
WebdriverIO
Puppeteer
Despite working in Ruby, I was heavily leaning towards Cypress.
That's until my colleague Karl Entwistle pointed me to Playwright.
Why I think it might win:
Faster too
Supported by Microsoft
I'm going to experiment with it over the coming months.
I'll report back when I know more!
DDD In Rails
Small Rails apps are easy to manage.
But as the codebase grows, I've run into some big problems:
God objects - large classes that hide huge numbers of methods
Duplication of ideas - similar but different concepts across the codebase
Conflicts - teams stepping on each other's toes
An idea from DDD can help here - bounded contexts.
A bounded context is a self-contained area of the codebase that has it's language.
Example: An app to run a garage might have bounded contexts for sales, marketing, servicing, and accounting.
Each of these contexts will have a concept of a "customer", but it's a different model depending on the context.
Ideally, data should be separate too, but that's tricky in Rails, so in the past, I've shared one database table for all customers.
However, you can have a Sales -> Customer, a Marketing -> Customer etc as Rails models under namespaces.
Once this has been done, you can put sales behaviour in one customer model and marketing behaviour in another.
And slowly your app will become more segregated. Order will be imposed on the chaos!
The power of mentorship
When I started out in Ruby I sucked.
Now I can evolve a design on my own.
Evolutionary design. As a junior engineer, I could never understand it.
But then I was mentored and my life changed...
As a junior programmer, I really struggled to write code that exhibited any properties of good design.
I knew how far short I was falling.
Time and time again, I wrote code and my mentor showed me how to improve it.
For months I just wasn't getting it.
My code was a spaghetti mess.
My code was fragile, complex, and intertwined.
And most worryingly, I didn't have a clue how to evolve towards sanity.
A good mentor sticks with the junior and encourages them.
6 months later, I was starting to understand
1 year later, I could evolve a very basic design on my own
2 years later I was brimming with confidence
10 years later, evolutionary design is still one of my obsessions
I want to pass along my skills and teach the next generation of developers these timeless principles.
And I want to speed up the process for you!
That's why I'm writing this newsletter.
Need More?
I have two options:
Book a 1 hour coaching session (normally $200, FREE for a limited time)
Have a great week!