Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
I think its the same as with C#. Its possible to do it in a single file but everyone prefers multiple files
No project "needs" to be all in a single file, and that goes for microservices too. Microservices usually have a bunch of boilerplate setup code (initialise DB connections, initialise connections to other services, initialise logging, check feature flags, start webserver) etc which has nothing to do with your application logic and is best stored separately.
Depending on how "micro" your microservice is, it might have a couple of separate concepts within it which are more maintainable when represented in separate files. Some languages such as Java even enforce one top-level class per file.
Put more simply - would you rather deal with finding where abouts in a ~30,000 line file to make a change, or would you rather the functionality is divided up into logical components and split amongst multiple small files, with each filename describing what's in the file?
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job