Most Popular

1500 questions
57
votes
5 answers

Is it still valid to speak about anemic model in the context of functional programming?

Most of DDD tactical design patterns belong to object-oriented paradigm, and anemic model describes the situation when all business logic is put into services rather than objects thus making them a kind of DTO. In other words anemic model is a…
57
votes
4 answers

Development process used for the code on Apollo 11 missions?

The Apollo missions had technology no more complicated than a pocket calculator. From link here, there's an information about Apollo Guidance Computer (AGC) The on-board Apollo Guidance Computer (AGC) was about 1 cubic foot with 2K of 16-bit RAM…
Josip Ivic
  • 1,637
  • 6
  • 29
  • 46
57
votes
22 answers

Do you actually write 'clean code'?

I have seen some programmers tweaking their code over and over again not only to make it 'work good', but also to make it 'look good'. IMO, 'clean code' is actually a compliment indicating your code is elegant, perfectly understandable and…
ykombinator
  • 4,287
57
votes
6 answers

Should a getter throw an exception if its object has invalid state?

I often run into this problem, especially in Java, even if I think it's a general OOP issue. That is: raising an exception reveals a design problem. Suppose that I have a class that has a String name field and a String surname field. Then it uses…
AgostinoX
  • 841
57
votes
6 answers

Is making a small change, testing it, then "rinse and repeat", a bad habit?

I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not. I get a list of tasks to perform for a solution, even small small tasks, for example, Change resources of…
Mathematics
  • 1,007
57
votes
3 answers

What is a symbol in Ruby?

I'm totally new to the Ruby world, and I'm a bit confused with the concept of Symbols. What's the difference between Symbols and Variables? Why not just using variables? Thanks.
wassimans
  • 1,173
57
votes
5 answers

Why do all functions take only ranges, not containers?

There are many useful functions in , but all of them operate on "sequences" - pairs of iterators. E.g., if I have a container and like to run std::accumulate on it, I need to write: std::vector myContainer = ...; int sum =…
57
votes
3 answers

What's is the point of PImpl pattern while we can use interface for the same purpose in C++?

I see a lot of source code that uses PImpl idiom in C++. I assume Its purpose is to hide the private data/type/implementation, so it can remove dependence, and then reduce compile time and header include issue. But interface/pure-abstract classes in…
ZijingWu
  • 1,057
57
votes
5 answers

Why are reference-counting smart pointers so popular?

As I can see, smart pointers are used extensively in many real-world C++ projects. Though some kind of smart pointers are obviously beneficial to support RAII and ownership transfers, there is also a trend of using shared pointers by default, as a…
user99541
57
votes
2 answers

What is the purpose of NaN boxing?

Reading 21st Century C I arrived at chapter 6 at the section "Marking Exceptional Numeric Values with NaNs", where it explains the use of the bits in the mantissa to store some arbitrary bit patterns, to use them as markers or pointers (the book…
andijcr
  • 681
57
votes
3 answers

Are asserts or unit tests more important?

Both asserts and unit tests serve as documentation for a codebase, and a means of discovering bugs. The main differences are that asserts function as sanity checks and see real inputs, whereas unit tests run on specific simulated inputs and are…
dsimcha
  • 17,234
57
votes
5 answers

Is jQuery an example of "god object" antipattern?

I want to ask – I am slowly learning jQuery. What I see is an exact example of a God Object anti-pattern. Basically, everything goes to the $ function, whatever it is. Am I right and is jQuery really an example of this anti-pattern?
57
votes
8 answers

Why a static main method in Java and C#, rather than a constructor?

I’m Looking for a definitive answer from a primary or secondary source for why (notably) Java and C# decided to have a static method as their entry point, rather than representing an application instance by an instance of an Application class (with…
57
votes
9 answers

Are Intel compilers really better than the Microsoft ones?

Years ago, I was surprised when I discovered that Intel sells Visual Studio compatible compilers. I tried it in particular for C/C++ as well as fantastic diagnostic tools. But the code was simply not that computationally intensive to notice the…
user7071
57
votes
6 answers

Who created the idea(s) of the first loop constructs?

while (1) { if (1+1==2) { print "Yes, you paid attention in Preschool!"; } else { print "Wait... I thought 1+1=2"; } } As a developer, we all have to use loops very frequently. We know that. What I was…
Dynamic
  • 5,746