Where and how is the term used “wrapper” used in programming, and what does it help to do?

The term ‘wrapper’ gets thrown around a lot. Generally its used to describe a class which contains an instance of another class, but which does not directly expose that instance. The wrapper’s main purpose is to provide a ‘different’ way to use wrapped object (perhaps the wrapper provides a simpler interface, or adds some functionality). … Read more

What are magic numbers and why do some consider them bad? [closed]

A magic number is a direct usage of a number in the code. For example, if you have (in Java): public class Foo { public void setPassword(String password) { // don’t do this if (password.length() > 7) { throw new InvalidArgumentException(“password”); } } } This should be refactored to: public class Foo { public static … Read more

What’s the difference between anonymous classes in Java and closures?

There is almost no difference. In fact the there is an old saying about closures and objects. Closures are the poor man’s object, and objects are the poor man’s closure. Both are equally powerful in terms of what they can do. We are only arguing over expressiveness. In Java we are modeling closures with Anonymous … Read more

Difference between a deprecated and a legacy API?

From the official Sun glossary: deprecation: Refers to a class, interface, constructor, method or field that is no longer recommended, and may cease to exist in a future version. From the how-and-when to deprecate guide: You may have heard the term, “self-deprecating humor,” or humor that minimizes the speaker’s importance. A deprecated class or method … Read more

What are the differences between genetic algorithms and genetic programming?

Genetic algorithms (GA) are search algorithms that mimic the process of natural evolution, where each individual is a candidate solution: individuals are generally “raw data” (in whatever encoding format has been defined). Genetic programming (GP) is considered a special case of GA, where each individual is a computer program (not just “raw data”). GP explore … Read more

What is “over-engineering” as applied to software? [closed]

Contrary to most answers, I do not believe that “presently unneeded functionality” is over-engineering; or it is the least problematic form. Like you said, the worst kind of over-engineering is usually committed in the name of future-proofing and extensibility – and achieves the exact opposite: Empty layers of abstraction that are at best unnecessary and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)