Best Tools 🛠️ for Different Coding Workflows
Tags: productivity, laravel, webdev, tooling
Published: 2021-09-29 19:23:38

When writing code I often find myself using different tools depending on the workflow I'm currently in.

In some workflows, like fixing a bug, understanding the code is most important. In other workflows, like implementing a new feature, my focus is more on writing code.

Here is an overview of my main workflows and which tools I use the most.

## New Feature

When implementing a new feature, my focus lies on writing code. I want to write code as smooth and fast as possible and avoid distractions and context switching.

I use **[PhpStorm](https://www.jetbrains.com/phpstorm)** as my IDE. Since I'm already familiar with JetBrains IDEs and was not able to setup all the PHP plugins for vim correctly, I'm OK with it, although it's resource-intensive and could be a bit faster...

Of course, I'm using the **[IdeaVim plugin](https://plugins.jetbrains.com/plugin/164-ideavim)** to make the editor feel more like home.

Also, I like PhpStorm's auto-completion and the database integration, which avoids another context-switch.

Because I'm using **Laravel**, I can usually generate whole files with the `php artisan make` command, and then fill in the methods:

```bash
$ php artisan make:controller CustomerController
```

At our company, we [customized](https://laravel.com/docs/8.x/artisan#stub-customization) the stubs so that the generated code complies with our coding standards.

For example, we always use strict typing in our code base. So we put `declare(strict_types=1);` at the top of the stub files.

## Interconnected Feature or Change

A slightly different workflow is when I'm having to change an existing feature or add a feature, which has lots of dependencies to the rest of the code.

Then, my focus is a bit less on writing code and more on understanding existing code. For this, I use **PhpStorm's** "goto definition" and "find references" features.

Another tool, which we recently set up at our company is **[Sourcegraph](https://about.sourcegraph.com)**. It's a search engine for code for your whole organization.

This tool was a game changer for us, because it makes understanding code, especially over different repositories, so much easier.

Another important part in this workflow play **unit and feature tests**. Luckily, we have a high tests coverage, so I'm constantly running the tests to see if my changes break something.

Thanks to **[paratest](https://github.com/paratestphp/paratest)**, Laravel can [execute the tests in parallel](https://blog.laravel.com/laravel-parallel-testing-is-now-available), so this process is very fast.

## Bug Fix

I find bug fixing a very different workflow. Writing code is less of a priority and understanding the code is key.

My favorite tool here is **[Sentry](https://sentry.io)**. It is extremely helpful for fixing bugs. Not only are you getting notified when an error occurs, but you also get detailed information about the environment and the inputs which lead to the problem.

After I'm having a good idea how I can reproduce the bug, I use **Docker**, **Git** and **composer** to set up my local environment to exactly mirror the production environment.

For debugging, I use **PhpStorm's built-in debugger**. The ["Evaluate expression"](https://www.jetbrains.com/help/phpstorm/evaluate-expression.html) feature (`Alt+F8`) is especially helpful.

I typically finish up with writing a test case which checks the bug fix.

## Code Review

Code review is about understanding code, so I use the search features in **PhpStorm** and **[Sourcegraph](https://about.sourcegraph.com)** a lot.

After I understand the pull request, I comment on it in **BitBucket**. BitBucket also shows the results from the pipelines, which runs the tests and linters.

I find the user interface of BitBucket pull requests slow and lacking in many ways, but haven't found a better way to do code reviews.

👉 *Which tools for code review can you recommend?*

## Architecture and Documentation

Another very different workflow is designing or architecting a new feature. During the actual work, I mostly resort to **pen and paper**.

To communicate my ideas afterwards, I draw diagrams in **[draw.io](https://app.diagrams.net)**, describe them in **markdown files** or **Word** and present them in **PowerPoint**.

I also looked at **[Structurizr](https://structurizr.com)**, but did not really start using it, because it is a bit more complicated and less flexible compared to [draw.io](https://app.diagrams.net).

👉 *Overall, it works, but I'm not super happy with the tools in this category. Can someone recommend better ones?*