2,535 reputation
1829
bio website
location
age
visits member for 2 years, 6 months
seen 4 hours ago

Viewing this information about users with over 50,000 reputation requires a Stack Overflow Gold Account. Please log in to your gold account or join us.


Nov
12
comment Programming against interfaces in Java
It's worth mentioning that you can define methods on the interface and as long as you implement them there you don't have to implement them at every implementor (at least in Java 8).
Nov
7
awarded  Popular Question
Oct
23
comment Code that converts a value into a different representation, then converts it back to where it started is bad, but how?
"code that doesn't exist cannot have subtle defects, while code that exists often does" wish I could +2 you for that. Never underestimate the value of not having to write code.
Oct
5
comment When writing object-oriented code, should I always be following a design pattern?
I went here after reading the title in the "Network Hot Questions" - I was going to come here and post "Dear God NO!" (exact words) and finding this as the accepted answer was a pleasant surprise. If I can add one thing it's blog.ircmaxell.com/2013/09/beyond-design-patterns.html
Sep
30
comment Is there a name to this coding practice shown in the example?
Not to sound cocky, but it took me less than 10 seconds to figure it out. The second is more readable since it encapsulates the logic of storage on the categories and doesn't couple the iteration with the choice of adding a category or updating one.
Sep
28
comment Why do most programming languages have special keyword or syntax for declaring functions?
"From a more technical perspective, code (which is composed of functions) and data are separate" - some languages, most well knowingly LISPs don't make that separation and don't really treat code and data too differently. (LISPs are the most well known example, but there are a bunch of other languages like REBOL that do this)
Sep
24
awarded  Autobiographer
Sep
3
awarded  Quorum
Aug
24
comment Why do we need to include the .h while everything works when including only the .cpp file?
Uhh... getting the code to run? You can still link it but just not link the files to each other - rather they'd be the same compilation unit.
Aug
24
comment Why do we need to include the .h while everything works when including only the .cpp file?
No, it would be one compilation unit, no linking would take place at all since you include the .cpp file.
Aug
23
comment Why do we need to include the .h while everything works when including only the .cpp file?
@Snowman right, and my criticism is on your focus on it allowing sharing code. Your example is "Well, if you include the header file and then compile two files separately and then link them you can share code, but if you include the .cpp you can't unless you also don't include the .h" but if you don't include the .h you get the same level of "code sharing" without the 'cruft'. This is not what header files buy us at all - conditional linking, dynamic linking and other forms of linking are the key here - not the parts that could be solved with appending strings.
Aug
23
comment Why do we need to include the .h while everything works when including only the .cpp file?
That's not it either. That could be solved the exact same way it is solved in .h files anyway - with include guards and is exactly the same problem you have with .h files anyway. This is not what .h files are for at all.
Aug
23
comment Why do we need to include the .h while everything works when including only the .cpp file?
@Snowman Right, which is what I think you should focus on - multiple compilation units. Sticking code with/without header files for breaking code up to smaller pieces is useful and orthogonal to the purpose of header files. If all you we want to do is split it into files header files buy us nothing - once we need dynamic linking, conditional linking and more advance builds they're suddenly very very useful.
Aug
23
comment Why do we need to include the .h while everything works when including only the .cpp file?
I don't understand the argument you're making here. If you just include Foo.cpp in Main.cpp you don't need to include the .h file, you have one less file, you still win at splitting code into separate files for readability, and your compile command is simpler. While I understand the importance of header files I don't think this is it
Aug
21
comment Questioning one of the arguments for dependency injection: Why is creating an object graph hard?
I think that another advantage of dependency injection that is often ignores is that it forces you to know what objects depend on. Nothing appear magically in objects, you either inject with explicitly marked attributes or through the constructor directly. Not to mention how it makes your code more testable.
Aug
6
comment How can I keep Web services requests in a DAO layer without tying the code to the DOM?
If I may play the devil's advocate and recommend some reading: Singletons are Pathological Liars by Misko Havery, You're Missing the Point of Promises by Domenic Denicula (about $.Deferred and promises). As for positive - Silly Rabbit, Frameworks are for Prototypes.
Aug
4
awarded  Pundit
Aug
1
awarded  Good Answer
Jul
18
comment Can someone help me understand MVC?
One line proof - in MVC the view observes the model which is definitely not the case in asp.net mvc.
Jul
18
comment Can someone help me understand MVC?
This is from 2007, I've spoken about it to several people from MS since and they named it MVC to compete with Rails. I even talked with David Fowler since and asked him about it and he confirmed it on Jabbr, they realize it does not implement the MVC pattern but they don't really think it matters that much and they already picked the name.