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.

22 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
801 views

Identity and access management in Clean Architecture and MVC design

The application user has a lot of standard functionality we see in most applications. At a high-level, this includes some form of authentication, authorization, and session management. At a low-level, ...
  • 181
3 votes
1 answer
864 views

How to (or should I) refactor RxJS nested subscriptions with intermediate return value?

I hope this fits more here than SO because it is mostly about code design than making it work. Also, this is not tied to RxJs, but more to the reactive paradigm. (TypeScript tag is only added to make ...
  • 212
1 vote
0 answers
102 views

Typescript Clean Architecture: How to tackle use case that needs multiple repositories?

I am implementing clean architecture in my new back-end project and getting stuck with a particular use case. I have a CreatePhysicianUseCase what is responsible for creating a new physician user in ...
1 vote
0 answers
69 views

Applying an overloaded/templated function depending on the type of a QVariant

I'm trying to take a QVariant (in this case from a QProperty generated on a class) and based on the type, return a QWidget that allows for it to be edited appropriately. a signature for the ...
  • 1,232
1 vote
0 answers
423 views

Should Flux mutation logic always be done in the store, or can it be delegated to a class?

(I am using Vuex but the question applies to any Flux architecture.) I don't have a great understanding of the reasoning behind Flux architecture. I understand that it is nice to have all of the ...
1 vote
0 answers
34 views

Running Multiple distinct Services on a single server process

I am working on a java server, which has a bunch of seemingly distinct "services". A lot of which are just effectively classes. From a software architecture point of view I wonder what the opinion is ...
  • 111
1 vote
0 answers
289 views

How do you manage object lifetimes in a use-case-centric architecture?

I've been experimenting with layered, use-case-centric architectures as described in Uncle Bob's Clean Architecture blog post. Most of the examples I've seen are simple "update the customer record" ...
1 vote
0 answers
1k views

Bootstrap components and SMACSS/BEM methodologies

I have no enough experience in web development and I need advice from more experienced developers. I have been exploring SMACSS and BEM methodologies for a few weeks, and I like them, it makes really ...
  • 1,548
1 vote
1 answer
82 views

Best way to code actions and their criteria/checks

I've been trying to make my code cleaner and I have came across an issue which I don't know what the best solution is. This is the code I want to "clean". Please bare in mind that I am refactoring ...
0 votes
0 answers
25 views

Android, are seperate state update functions a DRY violation?

In my ViewModel I’ve implemented couple of functions to manipulate the state of my UI. It quickly becomes bigger and bigger and I wonder if these functions violate the DRY principle? I could wrap it ...
  • 1
0 votes
0 answers
40 views

Hosting/Imbedding Angular Application in ASP.NET MVC Application

Currently, I am working on an existing project, my team creates a new Angular-based application with the usage of some Angular modules that are developed in the company, in addition, there are some js ...
  • 124
0 votes
1 answer
132 views

Where to create repository instances?

I've several repositories. To make them testable, I add the ORM session in the constructor. class Repository: def __init__(session): self.session = session def save(object): self.session()...
  • 143
0 votes
0 answers
25 views

Mapping data that were input to one module, to input to of module

Lets say we have typical trivial CRUD app: user sends data controller catch the request and map it controller sends data to service for processing structure: - api - request - ...
  • 231
0 votes
0 answers
159 views

Where to put use case calling threads in clean architecture?

I've just started using clean architecture, It's clean and nice, but I've found a bit confusing use case. My application should be able to register to update a token after some time, so I handled ...
0 votes
0 answers
127 views

Abstract Web API from validation and configuration management in embedded system

Im working with embedded Linux for a router. There is a web GUI for the user to configure router options. When user fill a web form this is submitted to a web server function that is responsible of ...
  • 195
0 votes
0 answers
606 views

Better and cleanest way to bind a ICommand to a RelayCommand

By reading various source code, I see that there is different ways of binding an ICommand to a RelayCommand : From the constructor MyAwesomeViewModel() { this._fooCommand = new RelayCommand((x) ...
  • 204
-1 votes
1 answer
94 views

Using helper libraries to improve readability and conciseness of code vs adhering to native functions

currently in my place of work I'm headbutting with some coworkers from other teams (but same repo), since they are in a line of thinking where they prefer this: const connectionList = Object.values(...
  • 167
-1 votes
3 answers
153 views

Chain of responsibility look alike but choose handler at runtime

Currently I have an structure of PopUps and I've been thinking to use Chain of Responsibility pattern, but the difference is a popup can back to previous one PopUp and also can go to any other PopUp. ...
-2 votes
1 answer
1k views

Pass ID or Object which has irrelavant details as RequestBody in Rest Call?

Situation: I am designing a REST API that needs one or more, potentially large objects to do it's work I am facing a decision to either Pass the large object by reference and have the API retrieve ...
  • 109
-3 votes
1 answer
95 views

Should vanilla solutions be avoided in Spring web applications?

I am making a Java and Spring webapp that scrapes data from a web and then publishes it through an API. Some of the raw scrapped data is in the form of Set<SomeObject> which I then convert to a ...
  • 15
-4 votes
1 answer
87 views

Message Strings in Backend

Its ok to have hardcoded strings on backend? Example: Log.e("Error connecting to the database") The text "Error connecting to the database" should be hardcoded there? Or should it be in a separated ...
-5 votes
1 answer
1k views

Class names with Verbs

So I am reading Clean Code. In the Meaningful Names chapter, they lay down a rule of no verbs in class names. However in the Adding Meaningful Context section of that chapter, on page 29, he uses a ...