All Questions
Tagged with programming-practices design-patterns
123 questions
-2
votes
1
answer
163
views
Best Practices for Managing Multiple Entity Types in ASP.NET Core
I'm working on an ASP.NET Core application that requires handling multiple types of a single entity. Each type has its own properties and validation rules, which has led to confusion and complexity in ...
0
votes
4
answers
199
views
How to eliminate repetition in three subclasses: each defines an identical method that does almost the same thing, but with a different return type
TLDR:
I have three subclasses, each inherits from the same parent class, each defines an identical method that does almost the same thing, except that each of these methods has a different return type....
0
votes
1
answer
370
views
How best to share common steps between services while allowing them to provide their own behaviour
I've started working on a C# codebase. There are three services which run the same set of steps of three kinds of objects, each returning IResult:
public IResult FooService(Foo foo) { ... }
public ...
-1
votes
1
answer
107
views
How can I prevent an object from being re-sanitized everytime it is passed as input to a function?
Suppose that I have a class named CharStream
Additionally, there are a large number of functions which convert their function input into a CharStream
def funky_the_function(_input):
input = ...
4
votes
2
answers
1k
views
How to organize a chain of functions that share parameters, functional programming
When trying to follow a functional programming paradigm, I often find myself in a situation where I have a chain of functions that I would want to combine/compose somehow, but they all also take in a ...
0
votes
2
answers
933
views
Best pattern/practice to execute a multi-step code generation process
I am working on a project that generates an API with the possibility of doing CRUD operations based on a high-level description of the resources that the user would like to have in an application. In ...
2
votes
2
answers
584
views
Design of a modular application
I'm developing an application (Java) in a modular architecture. I have two approaches in mind and I'm not sure which one will be "better code" in case of maintenance and conventions.
I have ...
1
vote
1
answer
398
views
Common methods of generating code with code
I wish to develop an application that can generate code based on an user input.
Long story short: a user gives a formal description of a Resource (can be viewed as a REST resource) and based on this ...
3
votes
4
answers
780
views
Is it a bad practice to have an interface method to tell whether it can handle an object?
interface Resolver {
boolean canResolve(SomeInput input);
SomeOutput resolve(SomeInput input);
}
public static void main(String[] args) {
List<Resolver> resolvers = ...;
...
0
votes
1
answer
672
views
Source of "... against the interface, not the implementation"
For a paper I am writing, I need to find the origin of the following two phrases:
Code against the interface, not the implementation
and
Test the interface, not the implementation
(Note: the ...
1
vote
1
answer
822
views
Is it bad practice to run different versions of code in different environments? (i.e. test, prod)
As an example, let's say you have the following pseudocode:
if test environment: # meaning you don't have the typical service account prod perms
sudo as service account + do operation
else: # in ...
3
votes
2
answers
207
views
Checking the user in almost all use cases
I have a web application that has Users that belong to Companies. A User can only belong to 1 Company at a time and they can manage their own company information. I'm using java spring and I'm ...
4
votes
3
answers
1k
views
Passing object or using the field
I would like to know what is a more appropriate way to code in Java. Is it generally better to pass entire objects in the method's parameters or just using the fields from the class?
Using the field:
...
0
votes
2
answers
555
views
MVC who knows about whom?
In the Model-View-Controller pattern, I do understand the role of each component.
The Model represents our application's domain model. The View presents this information and the controller ...
-2
votes
1
answer
504
views
What are the best practices for writing a long, multi-step process? [closed]
When writing a long process, i.e. one filled with many steps of business logic, what are the best practices for organising it? There are a few different options here that I can see:
Just write a long ...