Reputation
3,545
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
11 27
Impact
~250k people reached

  • 0 posts edited
  • 3 helpful flags
  • 48 votes cast
Jan
22
comment Why does Internet Explorer have so many incompatibilities with other browsers?
The keyword is Embrace, Extend and Extinguish.
Jan
11
comment Recursion or while loops
@Giorgio: If it quacks like a duck? Using map you're using a system keyword that iterates [dictionary meaning] over all elements of a list. A loop based on Label:... if(condition) goto Label is non-obvious too for the same reason as recursion is non-obvious - but nobody does it nowadays.
Jan
11
comment Recursion or while loops
@Giorgio: map is still a loop ("foreach") keyword from the user's viewpoint, making it obvious toUpper works on a single element. (how compiler realizes it is besides the point)
Jan
11
comment Recursion or while loops
@Giorgio: In case of loop placed outside the function, calling it for each element, I don't need to look at the function body. char a[]="hello world; toUpperCase(a); - does it uppercase whole string or just its first character? I must open the function body. If I see char a[]="hello world; for(char *b = a; *b != '\0';b++){ toUpperCase(b); } I have no doubts.
Jan
11
comment Recursion or while loops
@Giorgio: You still talk about writing which takes 10% of the time. I'm talking about maintaining and debugging which is 90% time. If you debug a fragment of a program, and you see a function call, you really need to know whether it's a recursive loop over a whole range or whether the programmer just wants to modify the first element of a list/table/string and leave the rest untouched.
Jan
11
comment Recursion or while loops
@Giorgio: For WRITING yes, for YOU yes, but what about the person who is to maintain it after you? If they see a loop keyword, they know it's a loop. But there is no recurse keyword, they can recognize it only by seeing f(x-1) inside f(x). And now if you call g(x) in f(x), and then f(x-1) inside g(x), and only for the reason you didn't feel like writing a loop and thought to split the recursive function into two, called in sequence? Expect profanities.
Jan
11
answered Recursion or while loops
Jan
10
comment Creating huge decision tree
@DocBrown: Added a small fragment of the tree. The input module module-wide frame alone contains 6 different conditions, out of which only 3 were partially covered here, and that's not even starting on conditions of non-obvious origins!
Jan
10
revised Creating huge decision tree
Added picture
Jan
10
comment Creating huge decision tree
That's an interesting idea but I'm afraid it won't help. My conditions in this DSL would be long, long lines with lots and lots of asterisks. If we found the problem originates in input modules, there's no point analyzing any of 50 or so output module conditions, and vice versa - although at any point in analysis these two origins the data may finally point to power supply, or timing, or... you get the idea.
Jan
10
comment Creating huge decision tree
@DocBrown: Most conditions (nodes) will be based on unique, singular variables. Things like finding whether a message of specific type appears or not in the message queue (estimate queue length 100 messages), then analyzing the payload of the message, internal state flags, database entries etc. You can safely assume 70% of inputs will appear within only one node each in the tree. Great most of test conditions will need to be hand-crafted. So think rather 70 variables and many of them not readily available but to be extracted from unfriendly sources.
Jan
9
comment Is looking at random code snippets useful to quickly determine the quality of a project?
It helps, sure, but it doesn't determine the overall quality. A brilliant programmer working under stupid manager will write great code for awful architecture of the project. Each module will be great but the way they interact will be an unfixable bottleneck. You need a broader look besides checking code quality.
Jan
9
comment Creating huge decision tree
The structure doesn't really have to be a tree from the developer's point of view - may be flattened into independent strings of clauses leading to conclusions, but multiple re-evaluating the same topmost conditions (often involving SELECTs etc) over each leaf isn't really acceptable, so the actual compiled result should be more tree-like. Yes, a DSL is the answer, now the question is what should it look like. Also, with flat strings of conditions we lose perspective on how clauses conflict, interact or leave us with dead ends (undefined leaves). (still, maybe visualizing that is possible?)
Jan
9
comment Creating huge decision tree
@lorus: Modifying source is okay. Still, each node has unique meaning, which must be understandable - trivially readable by the developer, and each end result is a certain combination of these (usually logical AND), and its path should be easily readable and reasonably modifiable too. Note that 100 nodes isn't too much in a fairly flat multi-branched tree maybe 2-3 nodes deep. Not if its structure is resembling more a balanced binary tree. I wouldn't call a 7-level nested if() a maintainable structure...
Jan
9
comment if ('constant' == $variable) vs. if ($variable == 'constant')
@crazy2be: Speak for yourself. CppCheck currently warns against this kind of errors and saved my neck a couple times. If you mean assignment, it suggests extra pair of parentheses, if((q=!p)) goes without warning.
Jan
9
asked Creating huge decision tree
Jan
9
accepted Representing a rule in a ruleset
Jan
4
comment Representing a rule in a ruleset
Actually, yes, in essence you could say that - but it would be quite narrowly specialized (so broad, general DSL rules would apply only marginally) and this question pertains to internal representation of its fundamental tokens. If we have a simple engine at the core, we can start building syntax and features from there. This is to work in resource-limited environment and on a budget, so no "let's think up some fancy syntax and then write a complex compiler and a sophisticated engine for that", but rather "get a working engine, add some rudimentary user-friendliness when it's done.")
Jan
4
asked Representing a rule in a ruleset
Jan
4
comment Are immutable/stateless singletons bad?
I really wonder what real-life scenario could require this kind of feature.]