DEFRA / water-abstraction-team

Guides, info and issue management for the Water Abstraction Team
Other
1 stars 0 forks source link

Add convention on function ordering to conventions guide #92

Open Cruikshanks opened 1 year ago

Cruikshanks commented 1 year ago

One convention we don't have is for the ordering of functions in a module.

Everyone understands that the public ones go above the private ones. As the bulk of our code follows a service pattern this makes it simple

function go () {
  // Do something
}

// everything else in the service!

But it's that 'everything else' where things are not being done consistently. It's either alphabetical, by weight (importance to the module), by call order, or let's be honest, by when we thought to create the function! 😂

One of our aims as a team is to remove any barriers from those new or less experienced to be able to contribute. Inconsistencies like this can cause someone to be uncertain about where and how to make a change.

So, we need a convention and we need to add it to our guide.

As our current 'benevolent' ~dictator~ Tech Lead I'm selecting the alphabetical as our decision going forward. But happy for anyone to refute that, as long as they can document their preferred method sufficiently! 😁