The SteadBlog

A mixture of Computer Science and Software engineering related writings, study notes, book reviews and general ramblings. Opinions are my own - enjoy!

See the first post in The Pragmatic Programmer 20th Anniversary Edition series for an introduction. Exercise 21 Can you express the following requirements as a top-level transformation? That is, for each, identify the input and the output. Shipping and sales tax are added to an order Your application loads configuration information from a named file Someone logs in to a web application initial_order -> final_order initial_order represents the unprocessed data of an order - e.

Read more…

See the first post in The Pragmatic Programmer 20th Anniversary Edition series for an introduction. Exercise 19 In the FSM section we mentioned that you could move the generic state machine implementation into its own class. That class would probably be initialized by passing in a table of transitions and an initial state. Try implementing the string extractor that way. The generic part of the event/strings_fsm.rb example in the book is the logic to determine the appropriate state transition given an occurrence of some event .

Read more…

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…