3 ms·
200 lines of python or 200 lines of Java?
by abledon 5y ago
200 lines of python or 200 lines of Java?
- deleted 5y ago[deleted]
- kqr 5y agoDoesn't matter. People are roughly as good at comprehending languages given the same number of lines.
- Jensson 5y agoI'd like to see someone try to review a 200 line regexp. They might take about the same amount of time to write per line, but they definitely don't take the same amount of time to read.
- kqr 5y agoIt sounds like you have an illegible, compact regex in mind. If you write regexes like that for others to read, I feel sorry for the other people. If you write the regex like you would production code, i.e. with whitespace, newlines, and comments[1], I imagine 200 lines of regex would be about the same as 200 lines of any other type of production code, be it APL, Haskell, or conjunctive normal form. I realise this is a bit of a circular argument: if you write the code such that 200 lines is about n units of review in a specific language, then 200 lines will be about n units of review in any language. But that's also kind of the point. There's a very specific logic density that you can accomplish for production code to be readable, and that results in about that density being reviewed. [1]: In Python you can do this with the re.VERBOSE flag, in other languages you can do it by breaking the regex apart into separate variables that are then combined together.
- pjmlp 5y agoDepends if the Java dev is stuck in Java 7 or has catch up with the times.
- kortex 5y agoBetter question: - 200 lines of statically typed, pure functional code with high test coverage - 20 lines of code with I/O, parallelism, mutable state and/or interacting with external APIs I find it way less cognitively draining to review a big chunk of blue ocean code with good patterns, than even small amounts of code which requires me to maintain any kind of state in my head, or try to think about the consequences of how this change interacts with the broader system. I'd say that some kinds of code are easily 10x more cognitively draining than others.