11,950 reputation
52742
bio website
location
age
visits member for 3 years, 10 months
seen 1 hour ago
Very senior embedded real-time systems programmer (Texas law is very picky about the use of the term "engineer"), unsuccessful candidate for U.S. Congress, and unreconstructed Cold Warrior.

Feb
25
comment Do iterative methods reduce cyclomatic complexity and improve supportability?
There's just this one little problem with the Maintainability Index. The three components of it are Halstead Volume, Cyclomatic Complexity, and Lines of Code. Both Halstead Volume and Cyclomatic Complexity have been shown to be very strongly correlated to Lines of Code. This means that an alternative approximate equation for the Maintainability Index that depended ONLY on Lines of Code could be derived that would be almost as accurate as the original, with considerably less computational difficulty.
Feb
24
answered Writing a TCP protocol or use HTTP for file transfer?
Feb
20
comment Validation of the input parameter in caller: code duplication?
Actually, it may be better to validate the parameter, and, if the parameter is invalid, throw an exception yourself. Here's why: the clowns who call your routine without bothering to make certain they gave it valid data are the same ones who will not bother to check the error return code that indicates they passed invalid data. Throwing an exception FORCES the problem to be fixed.
Feb
17
comment Is it possible to modify Lamport's mutual exclusion algorithm to work without a FIFO guarantee?
+1 for reminding everyone that TCP does these things so we don't have to. I have seen too many occasions where people wanted to use UDP because they couldn't stand (what they thought was) the high overhead of TCP, and then the proceeded to reimplement almost everything TCP does because they needed reliability.
Feb
14
comment What's the effect of this assignment (whatever the language)?
No, there's no typo. The point of the example is obviously to illustrate just how big a mess can be made with side-effects. (And I still recall the late Prof. Edsger W. Dijkstra saying, in a talk at UT Austin ca. 1998, that the real objective hadn't changed in 50 years: "Don't make a mess of it!")
Feb
14
comment What's the effect of this assignment (whatever the language)?
@delnan: Actually, it depends on the implementation. Some languages don't define whether the left-hand side of an assignment is evaluated before or after the right-hand side, but rather warn that the order is undefined, and the programmer is expected to be smart enough to write his code in a way that it doesn't matter.
Feb
14
comment What's the effect of this assignment (whatever the language)?
This is a beautiful example of how functions having side-effects can be a really Bad Thing. If the compiler could assume that f(x) == f(x) for all x and all f, the results would be very different, and very intuitive.
Feb
13
comment Can I use GPL software in a commercial application
GPLv2 requires you to make available the machine-readable source code. GPLv3 says, in part, "You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License...". In other words, offering a photocopy of the source listing is NOT GOOD ENOUGH.
Feb
10
comment When would you need “hundreds of thousands” of threads?
Some years ago, I spent a few years doing real-time FLIR image-processing, crunching 256x256 images at 30 frames per second. Unless you have a LOT of HARDWARE processors, and a SEAMLESS way of partitioning your data among them, the LAST thing you want to do is add context switching, memory contention, and cache thrashing to the actual computational costs.
Feb
9
comment What will be the better way for data retrieval on application that needs to handle limited amount of data.?
About ten years ago, in a graduate systems modelling class I audited, a classmate did a careful study, and showed that using XML to pass data caused two orders of magnitude of performance loss. (The data file expands to 100x the necessary size, requiring 100x storage, 100x communications bandwidth, and a much bigger parser.) In the light of this, maybe you should reconsider your use of XML?
Feb
6
comment Why has C prevailed over Pascal?
@SK-logic: PASCAL was in commercial use (defense industry) in the mid-to-late 1970s. BBN was using it for the Key Distribution Center for an experimental network crypto system. (They went through two major design iterations that I knew of, the first using raw PASCAL, the second using PASCAL plus a multitasking kernel.) TI-DSEG did a pilot project in 1988, writing a 6DOF simulation in PASCAL. They guys who did it said that the maintainability was SO much better than FORTRAN that they were happy to live with the slight performance hits.
Feb
6
comment Objective Metrics for Software Quality
@locster: I've been doing this for something over 30 years. These days, I routinely see stream-of-consciousness run-on routines, that go on and on for a few hundred SLOC, for no reason. In all those years, I have seen exactly one (1) routine that actually NEEDED to be more than one printer page of code (about 60 lines). All the rest could have been quite profitably factored down, and the readability and reliablity increased significantly. (That doesn't count big state machines. They can be a problem in this area, but they are RARE.)
Feb
6
comment When should pointers be checked for NULL in C?
@James: The problem with error codes is that programmers almost never bother to check them. Throwing an exception or tripping an assert FORCES them to deal with the problem.
Feb
6
comment When should pointers be checked for NULL in C?
@detly: If you are in a function that requires a non-NULL pointer, and you don't have a mechanism to return a fatal error to the caller, you throw an exception or trip an assert. I personally prefer throwing an exception, as that pretty much guarantees a traceback with the crash-and-burn. (I caught a lot of static on this some years ago, on an Ada project. I had to educate several people, including my manager, on the concept of policy/mechanism separation.)
Feb
6
answered When should pointers be checked for NULL in C?
Feb
5
comment How can I deal with a team member who dislikes making comments in code?
Have you considered an alternate hypothesis, that the code is perfectly understandable to him AND TO ANYONE ELSE WITH HIS WIZARD LEVEL OF SOPHISTICATION, but not to people who have barely achieved Journeyman or are still Apprentices? I have seen cases like this, in specialized real-time image-processing applications, and, as it turned out, it was absolutely necessary to train up to Wizard to be able to work on the code, NOT because it was undocumented, but because the problem domain was inherently hard. By the time I understood the domain, his code WAS self-documenting (and CLEAN!).
Feb
5
comment Objective Metrics for Software Quality
@locster: Given two 100 SLOC modules, one with a CC of 47 is likely to have more problems than one with a CC of 3. HOWEVER, for real-world code, in large quantity, one finds that short modules tend to have low CC and long modules tend to have high CC, to the point that knowing the SLOC gives you a very good guess at the CC, and vice versa. This is what is meant by "very strongly correlated." AS SUCH, on real code, any benefit you get from noticing CC = 47 is MORE EASILY gotten from noticing SLOC = 1500. (Numbers pulled at random, principle is the same.)
Feb
4
answered Objective Metrics for Software Quality
Feb
4
comment Is the average number of bugs per loc the same for different programming languages?
Unfortunately, Hatton's paper is paywalled by the IEEE, so it is impossible to determine whether it says anything useful. (That the second comment compares C and C++ seems to argue against it.)
Feb
4
comment Is the average number of bugs per loc the same for different programming languages?
Let me ask you this question. Does the answer actually matter to you? If, for example, you were told that a particular higher-level language offered, say, doubled programmer productivity and 1/4 the defect rate, across the board, what would you do with that information?