Click here to Skip to main content
15,508,892 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionWhat version should I use Pin
Stevey T5-Jan-21 7:19
Stevey T5-Jan-21 7:19 
AnswerRe: What version should I use Pin
jsc428-Jan-21 3:48
professionaljsc428-Jan-21 3:48 
QuestionDistributed transactions within a microservices architecture Pin
Pelle3021-Dec-20 1:22
Pelle3021-Dec-20 1:22 
AnswerRe: Distributed transactions within a microservices architecture Pin
Gerry Schmitz21-Dec-20 10:19
mveGerry Schmitz21-Dec-20 10:19 
QuestionWhat technologies to use to build a site like Kaggle? Pin
SIDDHARTH_JAIN12-Dec-20 18:50
SIDDHARTH_JAIN12-Dec-20 18:50 
AnswerRe: What technologies to use to build a site like Kaggle? Pin
Gerry Schmitz13-Dec-20 7:11
mveGerry Schmitz13-Dec-20 7:11 
AnswerRe: What technologies to use to build a site like Kaggle? Pin
Richard MacCutchan13-Dec-20 7:34
mveRichard MacCutchan13-Dec-20 7:34 
QuestionShould we duplicate code? Pin
Member 44870839-Dec-20 10:24
Member 44870839-Dec-20 10:24 
I have always had the view that duplication is bad. There are always exceptions, but most of the time I it seems bad to me. Unit tests are one are where I tolerate it more but in production code it's something that I rarely find desirable.

Some people duplicate things two or three times and only eliminate the duplication on the third or fourth time. I really can't understand why somebody would blindly follow this rule. I understand the argument that we may not know how to refactor something if there are aren't enough instances of the duplication but I find that it is rarely the case. At least if you don't know how best to refactor something then keep it simple. The rule seems crazy as why would you do something if you know it's bad? Eliminating duplication is usually quick and, in my opinion, usually makes things much easier to read, particularly when you have half as much code to read/understand.

As an example, imagine we want to format a number as a currency. We could have the following
x.ToString ("£0.##")

Having it once seems fine, but not really more than once. Surely, as a very simple refactor, something like the following would be better?
Format.AsCurrency(x)

Surely the time saved by the readability would outweigh the code of writing it and it solves the problems of duplication.

Deliberately duplicating code doesn't make much sense to me, but maybe I've been working with people who have taken things a bit too far?
AnswerRe: Should we duplicate code? Pin
Pete O'Hanlon9-Dec-20 22:30
mvaPete O'Hanlon9-Dec-20 22:30 
AnswerRe: Should we duplicate code? Pin
Gerry Schmitz10-Dec-20 6:45
mveGerry Schmitz10-Dec-20 6:45 
QuestionAdvice for web application technologies / architecture Pin
cpper28-Dec-20 9:46
cpper28-Dec-20 9:46 
AnswerRe: Advice for web application technologies / architecture Pin
DerekT-P11-Dec-20 0:49
professionalDerekT-P11-Dec-20 0:49 
QuestionDesign Pattern advice Pin
Freerk_C16-Nov-20 4:20
Freerk_C16-Nov-20 4:20 
AnswerRe: Design Pattern advice Pin
Pete O'Hanlon16-Nov-20 5:46
mvaPete O'Hanlon16-Nov-20 5:46 
GeneralRe: Design Pattern advice Pin
Freerk_C16-Nov-20 23:09
Freerk_C16-Nov-20 23:09 
GeneralRe: Design Pattern advice Pin
Rob Grainger6-Jul-21 12:40
Rob Grainger6-Jul-21 12:40 
AnswerRe: Design Pattern advice Pin
Gerry Schmitz16-Nov-20 8:24
mveGerry Schmitz16-Nov-20 8:24 
QuestionData Class for data combined from Other Classes Pin
cjb11010-Nov-20 22:27
cjb11010-Nov-20 22:27 
AnswerRe: Data Class for data combined from Other Classes Pin
Richard Deeming10-Nov-20 22:50
mveRichard Deeming10-Nov-20 22:50 
AnswerRe: Data Class for data combined from Other Classes Pin
Gerry Schmitz10-Nov-20 22:53
mveGerry Schmitz10-Nov-20 22:53 
AnswerRe: Data Class for data combined from Other Classes Pin
Mycroft Holmes11-Nov-20 12:07
professionalMycroft Holmes11-Nov-20 12:07 
GeneralRe: Data Class for data combined from Other Classes Pin
cjb11011-Nov-20 20:20
cjb11011-Nov-20 20:20 
Questionn-Tier Design Question Pin
Kevin Marois2-Nov-20 8:10
professionalKevin Marois2-Nov-20 8:10 
AnswerRe: n-Tier Design Question Pin
Richard Deeming2-Nov-20 23:16
mveRichard Deeming2-Nov-20 23:16 
GeneralRe: n-Tier Design Question Pin
Kevin Marois3-Nov-20 7:16
professionalKevin Marois3-Nov-20 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.