How much work should the constructor for an HTML parsing class do?

I normally follow one easy principle: Everything that is mandatory for the correct existence and behavior of the class instance should be passed and done into the constructor. Every other activity is done by other methods. The constructor should never: use other methods of the class with the purpose of using overriding behavior act on … Read more

Giving presentation on software project to non-programmers [closed]

When I was working on my doctorate, the faculty gave us this rule for seminars – and it has proved very useful since: Tell ’em what you’re gonna tell ’em. (E.g., brief introductory problem description and results abstract) Tell ’em. (E.g. technical details comprising the bulk of the time) Tell ’em what you told ’em. … Read more

Fluent Interfaces – Method Chaining

The core idea behind building a fluent interface is one of readability – someone reading the code should be able to understand what is being achieved without having to dig into the implementation to clarify details. In modern OO languages such as C#, VB.NET and Java, method chaining is one way that this is achieved, … Read more

‘method’ vs. ‘message’ vs. ‘function’ vs. ‘???’

I’ve found this to be a language and programming-paradigm thing. One paradigm — OOP — refers to objects with member methods, which conceptually are how you send messages to those objects (this view is reflected in UML, for example). Another paradigm — functional — may or may not involve classes of objects, but functions are … Read more

Where is the difference between “binaries” and “executables” in the context of an executable program?

An executable file is one which can be executed; you would run it on the commandline by writing the name of the file itself as the command. On Unix systems, the file’s “executable” flag must also be set. On Windows, the file’s extension must be one of a fixed set of executable file extensions, including … Read more

What are ADTs? (Abstract Data Types)

Abstract Data Type(ADT) is a data type, where only behavior is defined but not implementation. Opposite of ADT is Concrete Data Type (CDT), where it contains an implementation of ADT. Examples: Array, List, Map, Queue, Set, Stack, Table, Tree, and Vector are ADTs. Each of these ADTs has many implementations i.e. CDT. The container is … 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

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