The SteadBlog

See the first post in The Pragmatic Programmer 20th Anniversary Edition series for an introduction. Challenge 1 Although there are no guaranteed ways of ensuring that you always free resources, certain design techniques, when applied consistently, will help. In the text we discussed how establishing a semantic invariant for major data structures could direct memory deallocation decisions. Consider how Topic 23, Design by Contract, on page 104, could help refine this idea.

Read more…

In an interview, I was asked to analyse the complexity (and thus relative performance) of a piece of C code extracted from functioning production software. As a follow up, I will demonstrate the process of identifying a performance problem and implementing a solution to it. The code had originally been given as part of a pre-interview exam, where general issues with the code were to be discussed. I won’t be posting solutions to the pre-interview exam question (there will be potential problems with the code) and I have changed the structure of the code so it’s not searchable for future candidates.

Read more…

See the first post in The Pragmatic Programmer 20th Anniversary Edition series for an introduction. Exercise 16 A quick reality check. Which of these “impossible” things can happen? A month with fewer than 28 days Error code from a system call: can’t access the current directory In C++: a = 2; b = 3; but (a + b) does not equal 5 A triangle with an interior angle sum ≠ 180° A minute that doesn’t have 60 seconds (a + 1) <= a All of them!

Read more…

See the first post in The Pragmatic Programmer 20th Anniversary Edition series for an introduction. Challenge 1 Points to ponder: If DBC is so powerful, why isn’t it used more widely? Is it hard to come up with the contract? Does it make you think about issues you’d rather ignore for now? Does it force you to THINK!? Clearly, this is a dangerous tool! Design by contract leads to similar arguments as the great dynamic vs static typing debate:

Read more…

See the first post in The Pragmatic Programmer 20th Anniversary Edition series for an introduction. Exercise 11 You’re rewriting an application that used to use YAML as a configuration language. Your company has now standardized on JSON, so you have a bunch of .yaml files that need to be turned into .json. Write a script that takes a directory and converts each .yaml file into a corresponding .

Read more…