Questions tagged [design-patterns]

18 questions
6
votes
1 answer

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 than that based on X, Y, and Z metrics" that are…
5
votes
2 answers

Is there one (or a few) canonical/ specific use cases for "functions returning functions" (beyond "decorators")?

Is there one (or a few) canonical/ specific use cases for "functions returning functions" (beyond "decorators")? What can you do with "functions returning functions" that you cannot (easily or elegantly or expressively) do with functions as…
Serge Hulne
  • 165
  • 5
4
votes
2 answers

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". You don't care how it's done, you just want it…
3
votes
3 answers

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 inputs and outputs. I have defined most of the…
3
votes
2 answers

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: var adder = (function(){ var a = 0; return function(i){ a += i; return a; }…
3
votes
1 answer

system architecture or software architecture

I was trying to get started with a small project but I quickly realized I had to do more research on the subject. Suppose, when creating a site, in production, there's a certain structure how the backend and front end are maintained for scalability.…
BumbleBee
  • 31
  • 2
2
votes
1 answer

What is the difference between a "meta model" and "design patterns"?

Where is the difference between a "meta model" and "design patterns"? If you take, for example, Fowlers "Identity Field" from his book "Patterns Of Enterprise Application Architecture": Why is this a pattern and not a meta model? Thanks!
powerweb
  • 123
  • 2
1
vote
1 answer

Combine abstract factory with decorator pattern

I'm working on a simple project of software engineering that should combine two patterns. I choose Abstract Factory and Decorator patterns to modify (dynamically) objects created with the concrete Factory classes. My question is: is delegating…
1
vote
1 answer

Reference request for book on design patterns with foreword by Christopher Alexander

I do recall having found a book on software design patterns with a foreword by Christopher Alexander. Now, as is well known Alexander is credited as the creator of the concept of design patterns and design languages. In this particular text, he also…
1
vote
1 answer

design cache system using queuing theory

If we have data from a random population, a 3d histogram of throughput and current cache size of DRAM (intersection of a IOPS & a cache size will have a count). How can one use queuing theory to estimate the best possible cache size ?
1
vote
0 answers

Building an architecture without pointers, objects, memory allocation or first class functions

Many sources for good software architecture will use objects, pointers, memory allocation in their solutions. The PLC programming language 61131-3 Structured Text is really limited in this regard, more like a limited version of Pascal. Reasons for…
krakers
  • 11
  • 1
0
votes
1 answer

State Machine and State transition Table - Explanation and Creation Of

How do I create a state transition table/array in actual code/pseudo-code? I haven't experienced the "ah-ha" moment yet with the state machine to coding (and I really want to). I've looked at several code sample and read blog posts, but it's not…
GisMofx
  • 123
  • 5
0
votes
0 answers

How to Think About Physical Design of Libraries in C++ When Considering the Deliverable's API?

Since design ideas, and even the concept of Physical Design (exactly where you put your files), are such a broad topic, may I give a definite example and ask for feedback on the example? Suppose you are tasked with making a C++ application that does…
tarstevs
  • 1
  • 1
0
votes
0 answers

Clarification about a sentence from GoF Design Patterns book

I'm currently reading Design Patterns: Elements of Reusable Object-Oriented Software by GoF and having trouble understanding the following sentence (page 19, Section 1.6): Composition requires objects to respect each others' interfaces, which in…
0
votes
0 answers

When to dynamically compute data vs. when to use variables and update on demand?

Two scenarios: Function is called and data is computed and returned. Data is saved in variable, updated when required, data is retrieved from variable. So I was wondering in what kind of scenarios one would be beneficial over the other?
1
2