All Questions
Tagged with design-patterns programming-languages
6 questions
0
votes
0
answers
36
views
What are the pros and cons of these two coding patterns/structures? And do they have a formal term?
I have traditionally been doing things like this:
function test() // A
{
if (/* conditions */)
return true;
else
return false;
}
Of late, ...
0
votes
1
answer
163
views
How does this example violate Liskov substitution principle, which then causes violation of the open-closed principle?
From Agile Principles, Patterns, and Practices in C# by Robert Martin,
Listing 10-1. A violation of LSP causing a violation of OCP
...
3
votes
3
answers
939
views
Design patterns for simple text based scripting language?
In my current application I am trying to determine the best way to implement a simple scripting language. This language would allow a user to create a script that controls a machine with various ...
6
votes
1
answer
1k
views
Is there a way of objectively measuring the efficiency or quality of software or code design?
I've been thinking about ways of measuring code, and, quite frankly, I can't think of truly objective, semi-universal ways of evaluating the quality or "strength" of code to say, "Yes, this is better ...
3
votes
2
answers
53
views
Is there a formal term for functions that have static state across executions?
Two examples, one in PHP:
function adder($i){
static $a = 0;
$a += $i;
return $a;
}
A similar effect can be achieved with closures in javascript:
...
4
votes
2
answers
338
views
What's the difference between declarative syntax and encapsulation?
I had been first introduced to the idea of declarative syntax when using Angular JS. From what I understand, the idea is that you say, "do this" instead of "in order to do this, do this, this and this"...