What are public, private and protected in object oriented programming?

They are access modifiers and help us implement Encapsulation (or information hiding). They tell the compiler which other classes should have access to the field or method being defined. private – Only the current class will have access to the field or method. protected – Only the current class and subclasses (and sometimes also same-package … Read more

What’s the difference between unit, functional, acceptance, and integration tests? [closed]

Depending on where you look, you’ll get slightly different answers. I’ve read about the subject a lot, and here’s my distillation; again, these are slightly wooly and others may disagree. Unit Tests Tests the smallest unit of functionality, typically a method/function (e.g. given a class with a particular state, calling x method on the class … Read more

What is the difference between currying and partial application?

Currying is converting a single function of n arguments into n functions with a single argument each. Given the following function: function f(x,y,z) { z(x(y));} When curried, becomes: function f(x) { lambda(y) { lambda(z) { z(x(y)); } } } In order to get the full application of f(x,y,z), you need to do this: f(x)(y)(z); Many … Read more

How to find where a method is defined at runtime?

This is really late, but here’s how you can find where a method is defined: http://gist.github.com/76951 # How to find out where a method comes from. # Learned this from Dave Thomas while teaching Advanced Ruby Studio # Makes the case for separating method definitions into # modules, especially when enhancing built-in classes. module Perpetrator … Read more

What’s the difference between faking, mocking, and stubbing?

You can get some information : From Martin Fowler about Mock and Stub Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what’s programmed in for the test. … Read more

SOAP vs REST (differences)

Unfortunately, there are a lot of misinformation and misconceptions around REST. Not only your question and the answer by @cmd reflect those, but most of the questions and answers related to the subject on Stack Overflow. SOAP and REST can’t be compared directly, since the first is a protocol (or at least tries to be) … Read more

What exactly is One Definition Rule in C++?

The truth is in the standard (3.2 One definition rule) : No translation unit shall contain more than one definition of any variable, function, class type, enumeration type or template. […] Every program shall contain exactly one definition of every non-inline function or object that is used in that program; no diagnostic required. The definition … Read more