DEV Community

Cover image for Takeaways from a Testing and Refactoring Conference (apart from the T-Shirt)
Ingo Steinke
Ingo Steinke

Posted on • Updated on

Takeaways from a Testing and Refactoring Conference (apart from the T-Shirt)

Recently, I took part in a two-day refactoring conference, NCA Conference. The name speaks for itself: never code alone events are collaborative workshops where a shared wireless keyboard is passed around to code together.

An Awesome Live Coding Event

I used to enjoy the meetup scene when it used to be all about meeting actual people in real life and exchange some thoughts and practical tips with fellow developers in hallway talks having a Feierabendbier drink together after the official talk, even more so as a freelancer or working from home for a small team missing out on random encounters at the corporate coffee machine or watercooler. Now, since the pandemic, in-person events have become rare occasions in the dev community.

Sometimes it's the small things that matter. A seemingly unimportant detail might turn out to be the key takeaway in retrospect.

Some sketchy notes to follow-up

As live coding sessions are all about collaboration and communication, I tried not to take too many notes during a session, and as I still find it challenging to store a large amount of new information in my brain quickly, I try to take some extra (not) boring and (not) idle time to take notes in retrospect.

Notes in my sketchbook and an event website on my laptop screen that says PHP Testing and Refactoring

Eventually Important

A point I tried to make in one of my previous DEV blog posts, Productive Procrastination vs. Apparent Productivity, is that our mind needs some time without a tight schedule, without having to be productive. Time to allow our mind to roam, remember things we overheard, ideas we had, and form a connection between all of it so that we can learn, understand, and keep it all in our mind without having to look up everything on StackOverflow later.

Extending Previous Knowledge

In my sketchbook, I noted some things that I already learned in previous sessions before adding what I had been missing out until today. One of my personal takeaways: start using multiple cursors!

Boost PhpStorm Productivity

  • automatic code formatting (Control + Alt + L, or Control + Alt + Shift + L to show the formatting options menu)
  • automatic method extraction (Control + Alt + M, or Refactor -> Extract to Method in the context menu)
  • use tabnine for enhanced code completion suggestions
  • use split view more often
  • use multiple cursors (hit Alt + J on a PC, or Control + G on a Mac, and repeat multiple times to mark an expression to edit all occurrences of the same expression synchronously)

Multiple Cursors using Alt-J

PhpStorm Tips: Multiple Cursors for Selection

And no matter if you like their music or not and despite the fact that they probably thought of Apple's triangular Alt-J-character, thinking of music by the band called Alt-J will help you remember which keys to press if you need multiple cursors in PhpStorm.

And beside those small productivity boosters, I learned and practiced how to use testing and refactoring in an even smarter way. And of course, most of the "PHP tricks" are not limited to a specific programming language. Some of the tools are, like infection, the PHP mutation testing library, but the concepts are universal, and PhpStorm has become a useful editor for front-end development as well, providing inspections and code completion for JavaScript, TypeScript, CSS and SCSS even without using additional linters.

But of course you can apply the same concepts to your own favourite editor, like Florian proved when making all of us use his neovim editor in one of our refactoring sessions.

Image description

Automate all the Things, wait for Element ...

This is a quote from this year's new Testify T-Shirt, my physical takeway from this event. While I don't agree that we should automate everything we can, I still chose this design as it contains Codeception code:

I -> waitForElement
I -> see
Enter fullscreen mode Exit fullscreen mode

I -> support

This code also reminds me of last year's speaker Michael "Davert" Bodnarchuk who keeps working on testomat and his open source projects in spite of tanks and bombs trying to destroy his home country, Ukraine.

@davert is just one example of many brave people all over the world who keep coding despite far greater challenges than I can even imagine when sitting in a safe and comfortable room making plans how to improve my skills and business in the years to come and whether to buy or not to buy a new monitor or spend some money on a new software license or an event ticket.

Another Event Ticket

Speaking of code and performance optimization, Roland recalled several recent events, like his Never Code Alone session with Christian "Schepp" Schรคfer, and last year's beyond tellerrand conference where Harry Roberts told us to "get our <head> straight" to improve web page speed.

I rediscovered my beyond tellerrand 2021 notes and the badge which reminded me of a happy Monday.

Beyond tellerrand flyer and notebook

Another beyond tellerrand conference is coming up on 02 - 03 May 2022 and there are still some tickets left, so I hope to see you there!

Some more Personal Takeaways

  • time-boxed refactoring
  • "baby steps" (small changes, one at a time)
  • even more useful tools
  • refactoring code to make it testable
  • understanding code coverage
  • testing the tests

Understanding Code Coverage: Testing the Tests

This might be the most overlooked aspect when adding tests to projects, and again, it's about quality rather than quantity.

100% code coverage does not mean that our tests cover one hundred percent of all possible failures or use cases. It does not even mean that one hundred percent of our code is actually tested. All it says is that 100% of the code has been executed while running the existing tests.

This is where mutation testing comes into play.

"Killing the Mutants"

Mutation testing automatically creates variations of our code by switching logical operators and replacing values by empty strings and arrays. If none of our tests will fail after omitting an important return value, we still have some work to do before "automating all the things" really includes automating the relevant things that our customers depend upon.

These are just some of the things I noted and noticed, and I will surely watch the live video recordings again and again to follow up on all of the details that would be too much to write down in a short blog post.

Watching the Videos

This is the first part of last week's live streaming sessions, the rest will show up in the recommendations and in never code alone's YouTube channel.

Watch the videos to get an impression of the session even if you don't understand German. But if you do, and you happen to be around Duisburg some time in the future, watch out for upcoming events on their website: nevercodealone.de/de/nca-events

German Conference Recap

If your prefer to read a German version of my article (the event has been in German after all) here it is: Never Code Alone: gemeinsam testen und programmieren

Screenshot of German blog post

Conclusion

Conclusion: visit live coding events if you can, and follow me (@ingosteinke) here on DEV.to for more updates and inspiration! Thanks for reading and please share your thoughts, questions, or any other feedback as a comment.

Discussion (3)

Collapse
ingosteinke profile image
Ingo Steinke Author • Edited on

More follow-ups:

  • generate phpstan baseline file as temporary ignore list for time-boxed baby steps approach to fix legacy projects
  • type aliases in phpstan.neon
  • stub files to add missing or override faulty third-party vendor class info()
  • linter as coaches for new language features or best practices like ??, ?->, fopen(...) ?: throw in PHP8
  • git extra: git efffort --above n
  • blackfire, ideways, new relic
  • ...
Collapse
ingosteinke profile image
Ingo Steinke Author

More events coming up:

Another beyond tellerrand conference is coming up on 02 - 03 May 2022 and there are still some tickets left, so I hope to see you there!

Also there will be a free online developer conference, Devs for Ukraine with amazing speakers from both front-end and back-end, all donations go to charities supporting Ukraine.

Collapse
ingosteinke profile image
Ingo Steinke Author

Update: added a link to the German version of this recap which I finally posted in my Open Mind Culture blog: Never Code Alone: gemeinsam testen und programmieren