3 ms·
I question your assumption that if something is done in 1/2 the lines of code then each line of code is twice as complex. You're equivocating on "complex". Each
by kbd 16y ago
I question your assumption that if something is done in 1/2 the lines of code then each line of code is twice as complex. You're equivocating on "complex". Each line may be "more complex" in the sense "does more", but not necessarily more complex as in "harder to understand" (and therefore more prone to bugs).
Code in a more productive (i.e. higher level) language is concise because it hides extra complexity you don't need to think about at the time, and is therefore simpler, not more complex (in the second sense).
- DrJosiah 16y agoA perfect example of this is setting up iteration in Python vs. C++. In Python: for obj in seq: ... In C++: std::base_class<template_type>::iterator obj; for (obj=seq.begin(); obj != seq.end(); seq++) {...} The reduction in lines for Python doesn't make it more complicated, it makes it cleaner and easier to express ideas.
- rmc 16y agoCode in a more productive (i.e. higher level) language is concise because it hides extra complexity you don't need to think about at the time, and is therefore simpler, not more complex (in the second sense). Another example of where this is true is automatic memory management. A line of Java code can do all the memory management that would take many lines in C. This is a mostly good thing. In this case, less lines = better.