466 reputation
713
bio website orthogonaltonormal.com
location Johnstown, PA
age 33
visits member for 3 years, 10 months
seen 15 hours ago
//TODO Glorious Lies

Dec
4
comment How to test when arranging the data is too cumbersome?
Something I've done in cases where the parser itself is an expensive operation (eg reading data out of Excel files via com interop) is to write test generation methods that run the parser and output code to the console recreate the data structure the parser return. I then copy the output from the generator into more conventional unit tests. This allows reducing the cross dependency in that the parser only needs to be working correctly when the tests were created not every time they're run. (Not wasting a few seconds/test to create/destroy Excel processes was a nice bonus.)
Dec
3
comment Which are the cases when 'uint' and 'short' datatypes are a better fit than the standard int(32)?
Adding to what @AdamD.Ruppe said, the reason why smaller ints are normally padded in memory to a larger size is that aligning data structures to the size of the CPUs native int size is that depending on the architecture a misaligned read/write to memory is typically either slower than an aligned one or an invalid operation. Historically CISC processors generally did the former and RSIC ones that latter; but there're no hard and fast rules since it depends on how the instruction set was designed.
Nov
26
comment How do big companies maintain their products' source code without it falling into wrong hands?
In addition, copies of the Windows codebase have been leaked more than once; but you don't see copycats using the leaked code to build their own knockoff versions of the OS.
Nov
26
comment Should I accept empty collections in my methods that iterate over them?
I don't think recycling the empty collection for a return is a good idea. You're only saving a tiny bit of memory; and it could result in unexpected behavior in the caller. Slightly contrived example: Populate1(input); output1 = TransformNodes(input); Populate2(input); output2 = TransformNodes(input); If Populate1 left the collection empty and you returned it for the first TransformNodes call, output1 and input would be the same collection, and when Populaten2 was called if it did put nodes in the collection you'd end up with your second set of input in output2.
Nov
20
comment Name/Fix for Production Code Whose Sole Purpose is to Facilitate Testing?
For testing file IO, IMO it's generally simpler just to accept that the WriteFile() and ReadFile() methods of the class will only be covered by relatively lightweight integration tests that do actual file io instead of trying to mock the file system itself.
Sep
19
awarded  Notable Question
Aug
8
comment Sense of unit tests without TDD
@DougM writing tests first and intending to only write code needed to pass the tests does not guarantee that no untested code will be written (intentionally or by accident). To achieve that you need to have something (most likely a CI system) that generates a failure if code coverage falls below 100%. Setting that up is independent of if tests or code are written first.
Aug
6
comment Quantifying the advantages of a modern version control system
The biggest nightmare I had with clearcase was that, like CVS, it only versioned at the individual file level; meaning merge problems/etc would result in the newest version in CC to become a broken build and the inability to roll an entire codebase back to an arbitrary date/time. Using the option to do a local view instead of a virtual network drive greatly reduced pain from IO latency.
Jul
31
comment Client-side coding: How to prevent malicious use?
Any attempt to protect secure resources client-side is doomed because it violates several of the immutable laws of security. #2/3 - if your software is running on your adversaries computer it's not your computer by definition and you've already lost. #7 attempting to protect a resource by encryption is doomed since you also have to provide the client the decryption key. #10 no technology can fix the above. blogs.technet.com/b/rhalbheer/archive/2011/06/16/…
Jul
30
comment Should the commit history be used to convey critical information to developers?
@Klors As long as you don't restrict yourself to the most pedantic definitions of unit tests and refuse to do other types of automated tests, a test based on checking the file system/etc for the libraries name (if it has the version encoded in it) or a hash/checksum of the file itself could be used to throw a red flag at anyone wanting to update the library even in cases where the new versions flaw is difficult/impossible to capture in a test. (eg multi-threaded race conditions)
Jul
25
comment Should temporary code be put under version control and how?
@MainMa does that still work when the dll you need to reference is part of an application that needs to be installed conventionally?
Jul
25
comment Should temporary code be put under version control and how?
With VS, you sometimes need to take care to make sure you don't have absolute paths sneaking in. I've ran into more than a few problems with busted references when upgrading to win64 and having libraries for 3rd party platforms move from C:\Program Files\... to C:\Program Files (x86)\...
Jul
14
comment Is it a good idea to “#define me (*this)”?
Why not just go all out, and do: #include "vb.h", #Include pascal.h, or #include FOTRAN.h and have the next person to touch your code submit it to TDWTF.
Jun
7
answered Does it make sense to write tests for legacy code when there is no time for a complete refactoring?
Jan
10
awarded  Good Question
Oct
24
comment What are the safety benefits of a type system?
my misgivings are that you should try for 100% coverage in both types; and the use of a percent is obscuring the key fact: that 100% in a strongly typed language is significantly fewer tests than in a weakly typed one, or that phrased alternately a significant bit of the latter's required 100% is given free by enforcing type.
Oct
24
comment What are the safety benefits of a type system?
The use of 100% bothers me though; since there are lots of types of errors that type compile time type safety can't confirm are missing and which still need to be tested.
Oct
24
comment What are the safety benefits of a type system?
+1 for compiling as the equivalent to writing a lot of tests.
Oct
18
comment Is it acceptable to upload offensive content to GitHub?
@MichaelT and Triple-Double-ROT13 better still.
Oct
10
comment Is it reasonable to insist on reproducing every defect before diagnosing and fixing it?
Related: programmers.stackexchange.com/questions/196105/…