What is the most EVIL code you have ever seen in a production enterprise environment? [closed]

Warning: Long scary post ahead I’ve written about one application I’ve worked on before here and here. To put it simply, my company inherited 130,000 lines of garbage from India. The application was written in C#; it was a teller app, the same kind of software tellers use behind the counter whenever you go to … Read more

How to block users from closing a window in Javascript?

Take a look at onBeforeUnload. It wont force someone to stay but it will prompt them asking them whether they really want to leave, which is probably the best cross browser solution you can manage. (Similar to this site if you attempt to leave mid-answer.) <script language=”JavaScript”> window.onbeforeunload = confirmExit; function confirmExit() { return “You … Read more

Why is Singleton considered an anti-pattern? [duplicate]

To help with answering, here is more about the anti-pattern comment: it is overused, introduces unnecessary restrictions in situations where a sole instance of a class is not actually required, and introduces global state into an application From: http://en.wikipedia.org/wiki/Singleton_pattern For more on this you can look at: https://www.michaelsafyan.com/tech/design/patterns/singleton Here is a great ending to the … Read more

Is ServiceLocator an anti-pattern?

If you define patterns as anti-patterns just because there are some situations where it does not fit, then YES it’s an anti pattern. But with that reasoning all patterns would also be anti patterns. Instead we have to look if there are valid usages of the patterns, and for Service Locator there are several use … Read more