From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200202051424.GAA18255@ohio.river.org> To: 9fans@cse.psu.edu From: Richard Uhtenwoldt Subject: [9fans] code complexity Date: Tue, 5 Feb 2002 06:24:17 -0800 Topicbox-Message-UUID: 4c684ef2-eaca-11e9-9e20-41e7f4b1d025 Most of the people on this list value "elegance" in source code. To them, a solution that requires 1000 lines of code is almost always better than one that requires 10,000 lines as long as both solutions solve the same set of problems. Let us use the phrase "code complexity" or "software complexity" to refer to the mental effort needed to understand a piece of code. Number of lines of source code, excluding comments, is the easiest measure for estimating code complexity. Whereas the people on this list tend to view code complexity as a cost to be minimized/pessimized, many people --including probably most programmers-- do not. They may object to "code bloat" as a waste of memory or cpu cycles or diskspace, but that is a different thing than objecting to large source code sizes because they makes the code unnecessarily difficult to understand, maintain and modify. Some people actually welcome code complexity, eg, some managers and economists even today measures programmer "productivity" in lines of source code produced. Few on this list are going to disagree with the statement that the popular desktop and server platforms are significantly more complex than necessary. but some numbers might be fun. The Debian distribution of Linux contained 55,000,000 lines of code as of 18 months ago. (Includes all software including very specialized stuff, eg, specialized for plane pilots, doctors, etc.) Probably double that now. http://people.debian.org/~jgb/debian-counting/ the Mozilla web browser over 2,000,000 lines. gcc 984,000. I did not inquire whether that included the g++ code to compile C++. http://www.dwheeler.com/sloc/redhat71-v1/summary The idea that complexity is a cost to be minimized is not new. Dijkstra devoted his Turing Award lecture to it in 1972 ("The Humble Programmer"). And yet, it is still decidedly a minority view, even among programmers. Why?