Reputation
2,158
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
1 11 21
Impact
~269k people reached

  • 0 posts edited
  • 1 helpful flag
  • 143 votes cast
Apr
5
comment Exception Handling: When and Why?
My personal opinion regarding exceptions is that the clue is in the name. They should be used for dealing with exceptional circumstances, such as a network going down part-way through a data transfer, etc, or when the predicates of a method have not been met when it's called. There's a nasty tendency to see exceptions being used for jobs that normal program flow constructs can handle it better. EG a method that returns an object based on argument should return the object normally, NULL if it couldn't find a match and throw an exception if the argument was invalid.
Apr
5
comment Why isn't there a primitive “complex number” type in Java?
It's not a proper programming language if it doesn't support imaginary numbers!
Apr
5
answered Does setTimeout() really execute in parallel?
Mar
18
comment Why have private fields, isn't protected enough?
Shouldn't it be "Private by community"? :)
Mar
18
comment How to find all occurrences of a variable within a source code?
grep -i "variable_name"
Mar
18
comment When comparing a string variable to a string literal with .equals(), is there a standard practice for the order of items?
In languages that use = and/or == for assignments/comparisons it's normally best practice to put the thing that can't change on the left so that you can't do an accidental assignment when you meant to do a comparison. For languages that use methods on an object like .equals I don't think it matters.
Oct
15
awarded  Notable Question
Jun
23
awarded  Yearling
May
26
comment SQL: empty string vs NULL value
Your example is flawed because a) a good designer avoids long forms like the plague on the grounds that the length of a form is inversely proportional to how many people actually complete it, and b) you could work around the problem described by holding the data in a temporary store (such as a PHP session) and only submitting it to the database when it's complete and valid. If it's not and you need to reload the page then you can repopulate the form from the temporary store.
May
25
comment Lesser of two evils regarding return types
It's more a question of building a library for managing computations with things like money whilst avoiding floating point calculations.
May
25
accepted Lesser of two evils regarding return types
May
21
answered Lesser of two evils regarding return types
May
20
asked Lesser of two evils regarding return types
Apr
27
comment Why were frames deprecated in HTML5, but not iFrames?
Because frames were a terrible idea from the start but iframes do have a few legitimate use cases?
Mar
18
comment What's so bad about creative coding?
Act in haste, repent at your leisure. I deal with some codebases that are full of things that seemed like a good idea at the time to some developer. Had they taken a few hours to think about what they were going to do they could have avoided a lot of pain for me!
Mar
18
comment How can QA staff test caching logic that they can't see?
Well generally a cache is meant to speed up an operation by storing results in memory that would otherwise come from another source (db, remote server, computationally expensive method, etc). Therefore measuring the time things are supposed to take when hitting the cache seems like the simplest way. Also check for stale cache problems (updates to the actual data not appearing because the previous version is still cached)
Jan
8
comment Will a profound knowledge of C++ help you in learning other languages faster/easier?
depends on how like C++ the other languages are. The more they deviate the less helpful it will be.
Jan
8
answered How does a developer code in anticipation of change?
Jan
8
comment Best practice for using namespaces in my PHP libraries
In Java the common practice is to start with a vendor name as your topmost package (or a URL in reverse such as com.apple). You can then create anything you like inside that package without having to worry about it colliding with other similar generic names in other packages. You can do the same thing in PHP namespaces (and I'm pretty sure that it's starting to become standard practice to do so, \com\apple in the above example)
Jan
8
comment Why does PHP allow sending mail from any address
Because the specifications for email as a whole allow it. There's no authentication in email addresses.