Questions tagged [dry]
DRY is short for "Don’t Repeat Yourself". This paradigm advocates to avoid code and data redundancy.
148 questions
-1 votes
2 answers
147 views
How to handle complex logic, avoiding recalculation for performance reasons?
let's say we're building an Ecommerce Marketplace. We have Sellers and each Seller has Products. We want to display a list of available Products across all Sellers to Buyers. But, we only need to ...
1 vote
3 answers
382 views
How to avoid duplicating Create and Update UIs in CRUD apps
For most apps I've built which deal with CRUD operations, I end up two very similar UI pages: one for the creation of the object, one for updating it. An example would be StackExchange's UI for ...
14 votes
3 answers
3k views
Should I choose repeated code in unit test or test logic? Can I avoid both?
When writing unit tests, I feel that there is a trade-off between code repetition and test logic. Example of my current (likely flawed) approach: To test this function (overly simple function for ...
1 vote
3 answers
431 views
How to split out shared authorization logic across spring microservices
Currently working on a project where we have multiple services that all need to consume the same authorization service when their endpoints are hit. Right now we have the authorization boilerplate ...
53 votes
10 answers
8k views
How should I test "Glue Functions" without testing that "the code I wrote is the code I wrote"?
I usually write my code in a test driven style. I write tests as specifications and then my code. It's great and useful. I always try to ignore implementation when testing and only test behaviour. I ...
2 votes
1 answer
318 views
Selective method inheritance
I have a lot of classes that are just a CRUD interface for microservices. They only have a param for the endpoint and some of the methods get_list / get_item / create / update / delete / activate / ...
4 votes
5 answers
277 views
Approaches for comment duplication
For code, we know approaches like DRY and we tend to extract common functionality. What approaches are recommended for comments? Perhaps it's a really open question, so I'm going to go with my ...
0 votes
2 answers
216 views
DRY Violation for Logical Code Organization and Readability
I have a block of code that branches into 2 pathways, let's call them the "simple" and "complex" branch, based on user input. Either the simple or complex logic has 4 steps, let's call them A, B, C ...