Skip to main content
Software Engineering

Questions tagged [clean-code]

The term "clean code" is used to describe computer programming code that is concise, easy to understand, and expresses the programmer's intent clearly. Questions with this tag relate to the process of writing clean code, or refactoring old "dirty" code to be clean code.

Filter by
Sorted by
Tagged with
2 votes
2 answers
113 views

When using Clean Code with Ports and Mappers: which layer declares the Entity (Aggregate) factory interface and which one implements it?

So I was reading Eric Evans DDD book and one point that was not clear to me is which Layer (in case of using Clean Code) should be reponsible to: define the interface contract for an Entity (...
2 votes
3 answers
1k views

Scope of integration tests

I'm programming a .NET WebApi application from services. What is the scope of an integration test within the following schema? Order creation scenario: Order is created -> stored in db -&...
6 votes
7 answers
657 views

Why do "protected variables" tend to violate open closed principle?

According to Why is Clean Code suggesting avoiding protected variables?, I know there are tons of reasons to avoid protected variables. However, there is a reason at the currently highest voted answer ...
0 votes
2 answers
340 views

Which is better: a chain of OR statements or IF in a loop? (Java)

Which code style is preferred in Java? final boolean result = isCausedBy(e, ExceptionType1.class) || isCausedBy(e, ExceptionType2.class) || isCausedBy(e, ExceptionType3.class) |...
0 votes
0 answers
64 views

Where should validation be placed? [duplicate]

Recently I asked the following question regarding Clean Architecture with some things that were unclear to me: Clean Architecture using interfaces or Mediator approach? I think I have a better ...
2 votes
1 answer
230 views

checkNotNull vs. JEP 358: Helpful NullPointerExceptions: Should we remove existing null checks?

With the introduction of JEP 358 in Java 14, which provides more informative NullPointerException (NPE) messages, is it advisable to remove existing explicit null checks in cases where the null-check ...
ftb457932's user avatar
0 votes
1 answer
97 views

Orchestrating Events & Third Party Services

I am developing a hobby project utilizing an event sourced + event based architecture. In this application, I can allow my users to schedule automated calls in the system. Once the call has been done ...
2 votes
4 answers
187 views

Where are random numbers generated in Clean/CQRS architected application

Assume I have a value object in my application with random numbers for underlying values. These value objects will serve as attributes to my entity (aggregate root). In my specific case (just for ...
6 votes
5 answers
795 views

doSomethingIfCondition(). Is it good naming? [closed]

Suppose, I have some method that performs some job. In this example, it's going to be void, but it doesn't matter public void doSomething() { // doing something } But then, let's imagine, I got ...
2 votes
1 answer
159 views

Should I create another API to "move" content or modify my existing API that already does something similar?

I have a Spring Boot REST API that will copy content from one Amazon S3 bucket to another. The source and destination buckets are specified in the body of a POST request sent to the API. This works ...
35 votes
11 answers
13k views

Why don't programming languages or IDEs support attaching descriptive metadata to variables?

As developers, we often face the challenge of balancing meaningful variable names with code readability. Long, descriptive names can make code harder to read, while short names may lack context. For ...
0 votes
0 answers
97 views

Is it really difficult to test these "Service" methods in this Rust Clean Architecture proposal? Is there some other catch I'm not considering?

I reproduced a small example of kerkour's Rust Clean Architecture on the Rust Playground. The code is just an example and the methods code makes no sense at all. This architecture leaks DB information ...
2 votes
3 answers
218 views

Is it still "feature envy" if the state to make decision or the action to take after asking the state involves other classes to participate?

According to https://softwareengineering.stackexchange.com/a/212130/432039, if a class asks another class for the state, and then call methods of that class, it is called "feature envy", eg: ...
5 votes
1 answer
562 views

Confused on how abstraction and encapsulation is helpful

Using assimp I've created a function to load 3D models and it does everything I need and I don't plan to use another library or write something custom, however, I am curious how techniques such as ...
3 votes
3 answers
149 views

Is Each Table Columns on Separate Pages Considered Duplication in code?

Each table is on separate pages. Is it considered duplication (written in Angular)? The DevOps team ran SonarQube and detected the th tags as code duplication. How can I explain to them that it's not ...

15 30 50 per page
1
2 3 4 5
...
36

AltStyle によって変換されたページ (->オリジナル) /