5 ms·
What makes you say so? Can you give examples?
by nvssj 8y ago
What makes you say so? Can you give examples?
- saberience 8y agoWell, for a start... having a single file called "server.rs" which is 2256 lines long is already disqualifying. This file, code structure would be incredibly poor for developer efficiency. It just grows and grows and does all the things while having a vague sounding name like "server.rs" Why is server.rs doing "EditSite." What does the name EditSite mean anyway? Poor code reuse, same bits of code copy and pasted all over instead of being refactored out into their own methods. Methods which are doing too much different crap. The single responsibility principle is broken everywhere. Imagine trying to write unit tests for "Perform for EditPost", this method is doing far too much and would be a pain in the ass to fully test. If you're making a method called "EditPost" it should only be doing the actual post editing, not making connections, or user validation or checking for a ban. These should happen in a method which only handles connections, or a method which is called "ValidateUser" which is properly re-used. Generally speaking, the structure as a whole isn't very readable, poor names, methods and files which are doing too much. The project wouldn't scale well with a bigger team or if it grew in terms of codebase size.
- 1ba9115454 8y agoThere are a few opportunities for code generation here. The server.rs looks like an implementation of RPC over websockets. So a refactoring might be to model the interface using something like https://grpc.io/ https://grpc.io/ or any other IDL then code generate Rust server stubs and Typescript client stubs. Cargo has a mechanism for this. https://doc.rust-lang.org/cargo/reference/build-scripts.html https://doc.rust-lang.org/cargo/reference/build-scripts.html The other area where there is some boiler plate is the Diesel ORM. Diesel does generate some code ie. schema.rs but you are left to write the structs that implement these as well as Form structs for passing data to Diesel.
- A2017U1 8y agoWhat is the max lines in a single file for a developer "to get fired" at your company?
- nprateem 8y ago573
- Zhyl 8y agoThe company has a shell script running in Cron. If it finds a source file with more than 1000 lines it deletes the author from the payroll.
- nercury 8y agoSadly this cron has fired the shell script author, and no one dares to touch it.
- fmoralesc 8y agoNo, it is written in APL for extra conciseness. When they wrote it in shell it deleted the authors from the payroll.
- GoblinSlayer 8y agoThe author is entire team.
- megous 8y agoIt's a ridiculous metric.
- Insanity 8y agoI do have to say, 2k lines for a single file is scary sounding to me. It would probably make me consider splitting it up. BUT, sometimes things to just logically belong together and having one file to find them is just easier. It's a rediculous metric to use.
- twic 8y agoDepends a lot on tooling as well. If you have tools that give you effective jump-to-definition, find-usages, etc, then the file structure sort of fades away, because you jump from fragment to fragment without really worrying about what files they are in.
- eeZah7Ux 8y ago> 2256 lines long is already disqualifying I'd love to hear a justification for this idea.