Questions tagged [design-patterns]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

What would be be a nice design pattern to code a function that implements a math function but doesn't know which parts of the equation get passed?

Take for example the Pythagorean theorem: a^2 + b^2 = c^2. This example is a little simple so please conside a function with 7 variables that are related. I would like to design the function in a way ...
0
votes
0answers
24 views

Is machine learning and AI all about pattern recognition?

I realized that machine learning and AI is mostly about spamming the auto correlation and cross correlations from mathematics and combining them with memory arrays. Is it right? What do you think ...
0
votes
0answers
11 views

Best way to code a shopping cart consisting of items with different properties

This is an interview question. Interviewer wanted a scalable solution Goal is to find value of shopping cart. Cart could have 3 different types of items(Physical,Digital,URL). Only Physical Items have ...
0
votes
0answers
25 views

Is there an appropriate design pattern for this problem?

In terms of good OOP design, what is the best way to structure the code described below. The data I have a set of commands. Each command has an identifier, deadline, and a set of jobs to be done. Each ...
0
votes
0answers
36 views

Abstract syntax tree: expression->operation->lhs|rhs vs expression->lhs|operation|rhs - what should I take into account in decision?

I am trying to build class hierarchy for the abstract syntax tree of First Order Logic as specified in the grammar https://github.com/antlr/grammars-v4/blob/master/fol/fol.g4 (ANTLR parser generator). ...
0
votes
0answers
30 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
1answer
38 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 ...
1
vote
1answer
43 views

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 ...
1
vote
0answers
45 views

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

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, ...
0
votes
1answer
53 views

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 ...
1
vote
1answer
123 views

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 ...
3
votes
3answers
657 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
1answer
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
2answers
44 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
2answers
253 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"...
1
vote
1answer
2k views

Combine abstract factory with decorator pattern [closed]

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 ...