Shift Left: The good parts

5 practical ways to help your org shift left

Everyone's telling us to "shift left" these days. This raises some questions. What's being shifted? Who's doing the shifting? How far left should we be shifting it?

Shifting left means addressing important parts of the development cycle early on. Doing this enables you to get an MVP out speedily, receive feedback sooner, and ensure your project is robust enough to handle the journey ahead.

So what needs to be addressed? Well, it differs in each project, but mainly you should be paying attention to: user validation, context acquisition, testing, security, and code review.

Shift left #1: Get validation from your users!

You definitely don’t want to end up with an Over-Engineered Boondoggle that doesn't actually solve a real problem. The best way to avoid this is to get validation from your users ASAP, and this means getting an MVP out pronto.

Some ways to help you achieve this include:

  • Save time by stitching together existing components and making use of external libraries instead of reinventing the wheel.
  • Consider cutting things that you might think are essential. Do you really need a production environment? Maybe use a tunneling tool like Ngrok and serve your product directly from your local machine.
Discovering and reusing existing code can help you spin up an MVP ASAP, so you can quickly validate the user need with a rough sketch of the product.
Walking the forward and backward graph of code (defs and refs) is the bread-and-butter of building up a contextual mental model of how the code works.

Shift left #2: Know thy codebase!

Working on informative documentation will help developers write code faster and avoid problems down the line. Understanding your codebase will help you understand what to code and avoid errors along the way.

To achieve this you could:

  • Add useful features and information to your documentation to help readers navigate and understand it.
  • Keep track of which team members wrote what so that developers can reach out to those who will be able to help them understand the code.

Shift left #3: Write tests now, thank yourself later

Do you ever buy an ice cream without a game plan? I thought so. First, you run through all the scenarios and figure out the best outcome from those preliminary tests. Testing early on will help speed up the debugging process and can even help you figure out just what you want your code to achieve.

Shifting testing left will:

  • Create a robust and reliable codebase with tools for debugging early on in the development process.
  • Help to establish what you code will achieve, thus helping to inform the user validation step.
  • Provide an outline of the code, which can be used to provide helpful context for developers.
Code coverage tools reveal gaps in test coverage.
Set up alerts for anti-patterns and vulnerable dependency versions in your codebase.

Shift left #4: When it comes to security — keep your house in order

You have to be prepared for problems in life and in code. Skip the security headaches and time-consuming review cycles by planning ahead. You can do this by empowering developers with tools to meet security standards by themselves. This reduces the time spent on tedious multi-person review cycles.

Achieve this by:

  • Running recurring searches for vulnerable code blocks and dependencies.
  • Search for your own set of regular expressions and Comby patterns — they can even be suggested by your dev team.

Shift left #5: Review your review

Reviewing code can get a lot harder as the project gets more and more complex. Make sure your project has the right reviewing tools to keep up with its scale.

Here are some great reviewing tricks:

  • Break up large changesets into smaller changesets (e.g., using feature flags). These smaller changes can be more easily reviewed and validated.
  • Help to establish what you code will achieve, thus helping to inform the user validation step.
  • Use go-to-definition and find references to conduct code reviews that are both thorough and efficient.
Go-to-definition and find references at work.

Ready to shift left?

Shifting left means getting a head start on some of the most important aspects of the development process. Both the general philosophy and the specific process changes of shift left can be boosted by using tools that enable the developer to take full charge of shipping a new feature or bug fix.

Try Sourcegraph for free today

Experience code intelligence with a free 30-day trial of Sourcegraph for you and your team.