350 reputation
15
bio website jeremyp.blogspot.com
location Reading, United Kingdom
age 48
visits member for 2 years, 8 months
seen Oct 9 at 15:04

Software consultant and Mac OSX programmer


May
29
comment Review quality of code
Whichever program that crashes is the one with poor quality. Even if the other program is feeding it bad data, it should detect this and signal the error gracefully.
May
9
comment Array or Malloc?
@Donal Performance is always a trade off of memory against speed. If you are going to go round allocating arrays of several megabytes, then you have a point, however, even for a few kilobytes, as long as the function isn't recursive, it's a good optimisation.
Apr
25
comment Efficient try / catch block usage?
@Coder: In Java exceptions are often used as a mechanism for signalling issues that are part of the legitimate code flow. For instance, if you try to open a file and it fails, the Java library tells you that by throwing an exception, because the APIs that lead to opening a file have no other mechanism of returning an error.
Apr
24
comment When should you use bools in C++?
@James: also in many cases you won't save three bytes because the next variable, unless it's another bool or a char, will probably get aligned to a four byte boundary.
Apr
23
comment Is it a good practice to use smaller data types for variables to save memory?
@kevin: Good point.
Apr
20
comment Naming convention: is it good that all subclasses have same prefix or suffix or not?
@DeadMG: I don't. I put source files in directories related to the subsystem they are part of. And this is the problem with this idea. Namespaces are for classes that are logically related, not to mirror the inheritance hierarchy.
Apr
20
comment Naming convention: is it good that all subclasses have same prefix or suffix or not?
I disagree. To me, packages/namespaces should be used for logically coherent areas of functionality, not to mirror the class hierarchy. For instance, if my DOM implementation contains a class that implements java.util.list that class should go in my package, not java.util.list.listimplementations (or whatever).
Apr
18
comment Is it a good practice to use smaller data types for variables to save memory?
Your last sentence which claims short and long have practically no use. Long certainly does have a use, if only as the base type of int64_t
Apr
18
comment Is it a good practice to use smaller data types for variables to save memory?
@zvrba: The difference is a monetary quantity but not a salary. Now you could argue that a salary is also a monetary quantity (constrained to positive numbers and 0 by validating the input which is what most people would do) but the difference between two salaries is not itself a salary.
Apr
17
comment Is it a good practice to use smaller data types for variables to save memory?
Actually, with the advent of 64 bit environments, long may be different to int. If your compiler is LP64, int is 32 bits and long is 64 bits and you'll find that ints may still be 4 byte aligned (my compiler does, for instance).
Apr
17
comment Is it a good practice to use smaller data types for variables to save memory?
@zvrba: The difference between two salaries is not itself a salary and so it is legitimate to use a different type that is signed.
Apr
17
comment How to answer to this HashTable interview question?
@scarfridge: I kind of agree that just using object identity to identify the keys is pretty much useless. I was thinking nothing bad in terms of (for example) having the value of hashCode() change while the object is being used as a key in a map.
Apr
13
comment How would you explain that software engineering is more specialized than other engineering fields?
@Marcin: I have programmed in a large number of different languages and I can tell you for a fact that C is not assembler. I'm amused that you think all embedded programming is merely "frobnicating" memory locations.
Apr
13
comment How would you explain that software engineering is more specialized than other engineering fields?
@Marcin: you have obviously either not programmed in assembler or not programmed in C. I assure you that despite the common myth, C is not assembler and programming in those tools is as different as (say) programming in C and Ruby.
Apr
13
comment How would you explain that software engineering is more specialized than other engineering fields?
@Marcin: Some of the principles are, yes. The poitn I was making is that (for example) designing an embedded system in C or assembler employs the same sorts of principles even though the tools are different.
Mar
28
comment What makes C so popular in the age of OOP?
@Pubby: Except in Microsoft World, everybody uses C99.
Mar
28
comment What difference with Android when iOS is not open?
@Martin: that's ridiculous FUD. There are several iOS books in existence and the iOS community on SO is thriving. When you sign up as a developer, Apple gives you access to prerelease features which you certainly can't talk about, but anything in their released products is fair game.
Mar
28
comment What difference with Android when iOS is not open?
@tdammers: the tools are the tools. Android also limits the tools in some respects. But it's the same for many target platforms.
Mar
28
comment What difference with Android when iOS is not open?
@tdammers: I don't think the tangible benegfits are that fantastic except for the one I mentioned which is that Apple have power of life and death over your app.