Linked Questions

42 votes
3 answers
7k views

How can I do TDD in real-world applications?

Doing TDD in a kata is simple. A red test, small amount of code, green test, and refactor. Repeat. And that's it. But, I work on a real application. With a REST controller, a service layer for ...
fluminis's user avatar
  • 583
3 votes
1 answer
2k views

Unit Testing in VIPER Architecture: Possible?

TL;DR There are no methods in VIPER which are returning any value so how to test them? Reasoning: In VIPER, each layer is communicating with other layer by holding an abstract reference to it (...
3 votes
3 answers
474 views

How to handle checked exceptions on interface contract in Java

I am starting a project in Java and ran into the following situation. The application requires a persistence layer for a certain document type. This could be a MySql database, an AWS Dynamo DB ...
0 votes
2 answers
2k views

Onion architecture: Dependency Inversion Principle within the Service layer

I'm trying to implement a project using the Onion Architecture (aka Hexagonal, aka Ports and Adapters, aka Clean Architecture). I understand that the user interface uses Service interfaces instead of ...
2 votes
2 answers
3k views

Where to place a common database connection in clean architecture?

I am currently trying to follow the clean architecture approach but i wonder where common things like a database connections should take place. Since i think a database connection usually will be ...
5 votes
4 answers
323 views

Ugly nested parameterizations

Suppose there's a long IO operation that may result in some return value — but doesn't have to. Completion with no return value is different from the operation being pending. Do I have better options ...
4 votes
2 answers
468 views

Control flow and communication with two separate frontends (maybe with exceptions)?

I am trying to write a backend for use with a completely text based UI for one shot operations (eg. python scriptname arg, executes that argument and exits) and a GUI using the curses library for some ...
1 vote
1 answer
625 views

In which layer should I load views on a Clean(ish) architecture?

I am trying to organize my architecture following the clean architecture while using some common practices/frameworks. I'm writing in PHP, but have no problem with other languages. The flow of my app ...
2 votes
2 answers
221 views

How should I structure an update script that handles the output of another module?

I have a large (>1,000 LOC) Python ETL script - call it fetch_and_transform_data.py - that fetches data from a remote database, appends the raw data to a local table, does some transformations and ...
0 votes
2 answers
360 views

How to refactor this tightly-coupled method and (mostly) preserve its encapsulation?

I have recently encountered this problematic method (minimal reproducible sample in C++ but this question aims to be language agnostic past the syntax): void MyObject::twice_bind_cycle() { _bind1()...