anti-patterns Questions

8

Solved

I'm working in a web app framework, and part of it consists of a number of services, all implemented as singletons. They all extend a Service class, where the singleton behaviour is implemented, lo...
Surcharge asked 27/6, 2010 at 2:5

12

Solved

I've recently overheard people saying that data transfer objects (DTOs) are an anti-pattern. Why? What are the alternatives?
Diplostemonous asked 17/9, 2009 at 19:46

9

Solved

Is it possible to block users from closing the window using the exit button [X]? I am actually providing a close button in the page for the users to close the window.Basically what I'm trying to do...
Cherin asked 9/2, 2010 at 14:56

4

Solved

Is sequential coupling really a bad thing in code? Although it's an anti-pattern, the only risk I see is calling methods in the wrong order but documentation of an API/class library with this ant...
Polyhymnia asked 26/4, 2010 at 8:51

12

I have two simple methods: public void proceedWhenError() { Throwable exception = serviceUp(); if (exception == null) { // do stuff } else { logger.debug("Exception happened, but it's alrigh...
Belleslettres asked 12/4, 2018 at 12:26

10

Solved

Recently I've read Mark Seemann's article about Service Locator anti-pattern. Author points out two main reasons why ServiceLocator is an anti-pattern: API usage issue (which I'm perfectly f...

15

Solved

I am studying patterns and anti-patterns. I have a clear idea about patterns, but I don't get anti-patterns. Definitions from the web and Wikipedia confuse me a lot. Can anybody explain to me in s...
Metaphrase asked 11/6, 2009 at 11:33

1

Solved

Whenever if there is any asynchronous task performing related to component and that component unmounts then React generally gives this warning - Can't perform a React state update on an unmounted c...
Roccoroch asked 24/2, 2022 at 21:41

21

I was reading the Singleton article on Wikipedia and I came across this example: public class Singleton { // Private constructor prevents instantiation from other classes private Singleton() {} ...
Linnea asked 26/6, 2009 at 20:2

18

Solved

A typical problem in OO programming is the diamond problem. I have parent class A with two sub-classes B and C. A has an abstract method, B and C implement it. Now I have a sub-class D, that inheri...
Sauna asked 18/2, 2009 at 16:4

1

Solved

In his book, Implementing Domain-Driven Design, Vaughn Vernon states, When there are User Interface views that render the model and drive execution of its behavior, these are also inside the Bound...

2

Solved

We are doing a research around LLVM libraries and we have found that the IR library sometimes reaches call stacks up to 29 method calls. Sometimes when I see some crashes in iOS frameworks I also ...
Darling asked 28/12, 2016 at 23:5

10

Solved

How does one implement the Singleton design pattern in the go programming language?
Emalee asked 1/12, 2009 at 0:12

1

Solved

It appears to be common practice to inherit from the EventEmitter if you want your class to support events. For example Google does it for Puppeteer, the WebSocket module does it, mongoose does it,...

1

Java 8 introduced default methods on interfaces to provide backwards compatibility for implementations of the collections interfaces, to avoid MethodNotFound errors on legacy libraries. i.e A lib...

4

Solved

Does anyone know the best way to refactor a God-object? Its not as simple as breaking it into a number of smaller classes, because there is a high method coupling. If I pull out one method, i usua...
Bombardier asked 14/2, 2013 at 8:10

1

Solved

I posted the following code and got scolded. Why is this not acceptable? numberOfLines=$(wc -l <"$1") for ((i=1; $i<=$numberOfLines; ++$i)); do lineN=$(sed -n "$i!d;p;q" ...
Melanosis asked 2/1, 2021 at 12:11

6

Solved

I often see this pattern to define javascript objects function Person(name) { this.name = name; } Person.prototype.describe = function () { return "Person called "+this.name; }; And in this ar...

8

Solved

A common antipattern in Python is to concatenate a sequence of strings using + in a loop. This is bad because the Python interpreter has to create a new string object for each iteration, and ...
Invasion asked 6/4, 2012 at 12:42

9

Solved

I have been told not to append stuff using element.innerHTML += ... like this: var str = "<div>hello world</div>"; var elm = document.getElementById("targetID"); elm.innerHTML += str;...
Cherrylchersonese asked 17/7, 2012 at 2:50

6

A leap year bug is a code defect that creates a problematic, unintended outcome when executed within the context of a leap year, typically within the proleptic Gregorian calendar system. The years ...
Periphrasis asked 16/8, 2019 at 20:43

5

Solved

I found the Wikipedia entry on the soft coding anti-pattern terse and confusing. So what is soft coding? In what settings is it a bad practice (anti-pattern)? Also, when could it be considered bene...
Gelsenkirchen asked 5/5, 2009 at 6:34

21

What would you consider "worst practices" to follow when developing an embedded system? Some of my ideas of what not to do are: Avoid abstracting the hardware layer, instead spreading hardware a...
Ammunition asked 30/10, 2008 at 19:26

3

Solved

I’m working on an Angular 6 application and I’ve been told the following is an anti-pattern: await someFunction().then(result => { console.log(result); }); I realize that it is pointless to ...
Anhedral asked 27/1, 2019 at 6:37

5

Solved

There has been talk of Enums in general violating Clean Code-principles, so I'm looking for people's favorite Enum anti-patterns and alternative solutions for these. For example I've seen co...
Purebred asked 12/10, 2010 at 10:9

© 2022 - 2024 — McMap. All rights reserved.