arrow-left arrow-right brightness-2 chevron-left chevron-right circle-half-full dots-horizontal facebook-box facebook loader magnify menu-down RSS star Twitter twitter GitHub white-balance-sunny window-close
Horizontal vs. Vertical Project Structure
1 min read

Horizontal vs. Vertical Project Structure

This is an old post and doesn't necessarily reflect my current thinking on a topic, and some links or images may not work. The text is preserved here for posterity.

When creating new projects, especially when using new technologies or patterns, it's common to start with a very horizontal or layer-based folder structure:

An example of a layer-based folder structure, with folders for each layer in the project

As the project evolves artifacts are added to each folder. Over time, I find this structure becomes hard to work with:

  • When editing a view and needing to find the view model, there's a lot of scrolling involved
  • If I decide to split an area of functionality into a different assembly, it's not so easy to track down the files I need
  • I'm much more likely to need to edit all of the "change address" artifacts than I am to edit all of the "view model" artifacts in a single unit of work.

My preference is to structure projects vertically by feature, using a folder per feature:

An example of a feature-based folder structure, with folders for each feature in the project

Paul Stovell's Blog

Hello, I'm Paul Stovell

I'm a Brisbane-based software developer, and founder of Octopus Deploy, a DevOps automation software company. This is my personal blog where I write about my journey with Octopus and software development.

I write new blog posts about once a month. Subscribe and I'll send you an email when I publish something new.