|
|
|
|
|
by kchamplewski
2402 days ago
|
|
C-style languages tend to have squiggly brackets which can limit scope somewhat, but not as totally as you describe. For example: doThing(){
x = 7; //x visible in whole function
{
y = x*2; //y only visible in this block.
}
// x still visible, y no longer visible
}
Explicitly removing things from scope doesn't seem to be a feature though. |
|
Many small bits of logic are broken out into their own methods (checking if today is a public holiday, configuring the HTTP server, configuring the KV store client, etc), but the setup of the domain logic components is all in one method.
There's no way to split the setup of the components into methods without either introducing a comparable volume of boilerplate, or having to write some kind of framework to make it easier. Neither would be a win.
A caveat: this codebase uses a language which doesn't have out parameters or multiple-value returns. If it could use those, the boilerplate involved in breaking up the setup method would be considerably smaller. But still probably not worth it.