Takeaways from a Testing and Refactoring Conference (apart from the T-Shirt)
Tags: programming, productivity, php, testing
Published: 2022-03-31 08:23:22

Recently, I took part in a two-day refactoring conference, [NCA Conference](https://nevercodealone.de/de/nca-events/php-testing-refactoring-conference). The name speaks for itself: [never code alone events](https://nevercodealone.de/de/nca-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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fkp58vcf24bsj48pbumw.png)
  
## Eventually Important

A point I tried to make in [one of my previous DEV blog posts, Productive Procrastination vs. Apparent Productivity](https://dev.to/ingosteinke/productive-procrastination-vs-apparent-productivity-fbd), 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.

{% post https://dev.to/ingosteinke/productive-procrastination-vs-apparent-productivity-fbd %}

### 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](https://www.tabnine.com/) 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](https://phpstorm.tips/tips/1-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](https://altjband.com) will help you remember which keys to press if you need multiple cursors in PhpStorm.

{% youtube https://www.youtube.com/watch?v=_7-r0KON9GI %}

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](https://infection.github.io/guide/), but the concepts are universal, and [PhpStorm](https://www.jetbrains.com/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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3staan7vf9ebh9b8hnwr.png)

## 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](https://codeception.com) code:

```php
I -> waitForElement
I -> see
```

### I -> support

This code also reminds me of last year's speaker [Michael "Davert" Bodnarchuk](https://github.com/DavertMik) who keeps working on [testomat](https://testomat.io) and his open source projects in spite of tanks and bombs trying to destroy his home country, Ukraine.

{% twitter https://twitter.com/davert/status/1508826333039759366 %}

@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](https://beyondtellerrand.com/blog/wrap-up-and-coverage-for-dusseldorf-2021) where [Harry Roberts](https://csswizardry.com/) told us to "get our &lt;head&gt; 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9j5t74o0lch4iu095fw.png)

Another [beyond tellerrand conference is coming up on 02 - 03 May 2022](https://beyondtellerrand.com/events/dusseldorf-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](https://en.wikipedia.org/wiki/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](https://www.youtube.com/c/NeverCodeAlone/).

{% youtube https://www.youtube.com/watch?v=5zLi5QfUmXY %}

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](https://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](https://www.open-mind-culture.org/2133/never-code-alone-testen-programmieren/)

[![Screenshot of German blog post](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rk2r415leo2feajyf3kr.png)](https://www.open-mind-culture.org/2133/never-code-alone-testen-programmieren/)

## 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.