Most Popular
1500 questions
72
votes
7 answers
How essential is it to make a service layer?
I started building an app in 3 layers (DAL, BL, UI) [it mainly handles CRM, some sales reports and inventory].
A colleague told me that I must move to service layer pattern, that developers came to service pattern from their experience and it is the…
BornToCode
- 1,273
72
votes
10 answers
Never use Strings in Java?
I stumbled upon a blog entry discouraging the use of Strings in Java for making your code lack semantics, suggesting that you should use thin wrapper classes instead. This is the before and after examples the said entry provides to illustrate the…
DPM
- 1,713
71
votes
19 answers
Has any language become greatly popular for something other than its intended purpose?
Take this scenario:
A programmer creates a language to solve some problem.
He then releases this language to help others solve problems like it.
Another programmer discovers it's actually much better for some different category of problems.
By…
Jon Purdy
- 20,547
71
votes
3 answers
Etymology of "String"
So it's obvious that a string of things is a sequence of things, and so a sequence of characters/bytes/etc. might as well be called a string. But who first called them strings? And when? And in what context such that it stuck around? I've always…
sclv
- 1,080
- 7
- 11
71
votes
3 answers
Can a git commit have more than 2 parents?
In this documentation it is mentioned
A commit object may have any number of parents.
But from my understanding, the only case where a commit will have more than 1 parent is when a merge has happened, and in that case there will only be two…
Can't Tell
- 1,161
71
votes
3 answers
How do I make a JavaScript promise return something other than a promise?
I have a spec from a client for an implementation of a method in a module:
// getGenres():
// Returns a promise. When it resolves, it returns an array.
If given an array of genres,
['comedy', 'drama', 'action']
Here is a skeleton method with a…
sealocal
- 873
71
votes
3 answers
Is there a performance benefit to using the method reference syntax instead of lambda syntax in Java 8?
Do method references skip the overhead of the lambda wrapper? Might they in the future?
According to the Java Tutorial on Method References:
Sometimes... a lambda expression does nothing but call an existing method.
In those cases, it's often…
GlenPeterson
- 14,920
71
votes
6 answers
Should I pass in filenames to be opened, or open files?
Suppose I have a function that does things with a text file - for example reads from it and removes the word 'a'. I could either pass it a filename and handle the opening/closing in the function, or I could pass it the opened file and expect that…
Dan Oberlam
- 1,281
71
votes
14 answers
Is it a bad idea to return different data types from a single function in a dynamically typed language?
My primary language is statically typed (Java). In Java, you have to return a single type from every method. For example, you can't have a method that conditionally returns a String or conditionally returns an Integer. But in JavaScript, for…
Daniel Kaplan
- 6,794
71
votes
11 answers
Advice on designing web application with a 40+ year lifetime
Scenario
Currently, I am apart of a health care project whose main requirement is to capture data with unknown attributes using user generated forms by health care providers. The second requirement is that data integrity is key and that the…
Pete
- 1,257
71
votes
17 answers
Is it reasonable to insist on reproducing every defect before diagnosing and fixing it?
I work for a software product company. We have large enterprise customers who implement our product and we provide support to them. For example, if there is a defect, we provide patches, etc. In other words, It is a fairly typical setup.
Recently, a…
amphibient
- 1,591
- 2
- 17
- 24
71
votes
2 answers
How should a REST API handle PUT requests to partially-modifiable resources?
Suppose a REST API, in response to a HTTP GET request, returns some additional data in a sub-object owner:
{
id: 'xyz',
... some other data ...
owner: {
name: 'Jo Bloggs',
role: 'Programmer'
}
}
Clearly, we don't want anyone to be…
Robin Green
- 1,253
71
votes
5 answers
In functional programming, does having most of the data structures immutable require more memory usage?
In functional programming since almost all data structure are immutable, when the state has to change a new structure is created. Does this mean a lot more memory usage? I know the object oriented programming paradigm well, now I'm trying to learn…
Jbemmz
- 812
- 1
- 6
- 9
71
votes
15 answers
The Art of Computer Programming - To read or not to read?
There are lots of books about programming out there, and it seems Code Complete is pretty much at the top of most people's list of "must-read programming books", but what about The Art of Computer Programming by Donald Knuth? I'm a busy person,…
Zann Anderson
- 433
71
votes
8 answers
How do you encode Algebraic Data Types in a C#- or Java-like language?
There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as:
data ConsList a = Empty | ConsCell a (ConsList a)
consmap f Empty = Empty
consmap f (ConsCell a b) =…
Jörg W Mittag
- 103,514