Przejdź do głównej zawartości

Career advice: where do you want to be (and in what order)?

In one of Capers Jones' books (I think this was "Estimating software size") I came across a categorization of software projects that looked interesting to me. It put kinds of software projects in relation with the ability to perform the same tasks without a computer. Although I'm not able to cite it, it was something like this:
  • all tasks can be performed without a software system; computers are used only to make it easier or faster
    • bookkeeping in a small company could be an example 
  • tasks can theoretically be performed without a software system, but they would require so much time and involve so much risk of human error, that it would be extremely impractical or close to impossible to perform them without using computers
    • finding items in an extremely large collection (e.g. a huge library) could be an example
    • some banking operations could be even better example
  • tasks cannot be performed by a human by their very nature; there must be a software system in place in order to perform them
    • controlling an embedded device or processing physical phenomena are examples of this
One could ask oneself which category would be good one to work on projects in. Probably the brightest and most ambitious would aim at the third category or, if they are not able to get there, at least the middle one.

But we can look at the domains and the categorization from a different angle. Some projects require deep domain knowledge that takes years of hard work to build, others have rather simple, self-explanatory domain, known from everyday life to everybody. Would it sound logical that people working on this latter category tend to focus more on programming skills (languages, patterns, XP practices), whereas those working in a complex domain focus more on the domain itself and as long as the system works, they do not aim to become world class clean coders? It definitely sounds logical to me. It may simply be explained by the amount of effort and energy that is needed to understand the domain, so that no time is left to focus on programming skills. Or there may be other reasons. Regardless of that, one can expect that the simpler the domain is, the more chances of bettering the programming skills will be available.

We can join these two views to say that a programmer is likely to advance their programming skills working on a project that is supposed to help users in something that is generally doable without a computer. Conversly, those working on a system that can do things of which human is incapable, will not be capable to extend their programming skills much.

Where do you want to be and in what order?


Popularne posty z tego bloga

Unit Testing code with IO file operations (in Python)

We may often come across a piece of code that was written without Unit Tests at all. In addition, the piece of code may be dealing with IO like file writing and reading, which makes it more difficult to Unit Test it when we are trying to refactor and modify. Let's suppose the code in question looks like this:

def writeInitialsToFile(filename, name, surname):
    initials = name[0] + '.' + surname[0] + '.'
    with open(filename, 'w') as file:

def readInitials(filename):
    initials = None
    with open(filename, 'r') as file:
        initials = file.readline()
    return initials

A straightforward and bad idea would be to write a couple of Unit Tests that make use of a real file and simply test the reading and writing. Is therea a better way to test this code?

First of all, we need a way to replace the real file with something else. For both reading and writing we will now have a couple of functions, one that expects a stream fo…

Piotr's Less Obvious Advice on Google Mock: State maintenance

Google Mock provides several ways to maintain state inside mock objects. One way of implementing state maintenance is with SaveArg. Consider the following example.

We have a class Configurator, which allows a caller to set and get values of a parameter:

class Configurator

    virtual ~Configurator() {}

    virtual void setParamX(int n) = 0;
    virtual int getParamX() = 0;

And we have a class Client that calls Configurator's methods and it also has a method incParamXBy, that can be used to increase the current value of paramX by a certain value.

class Client

    Client(Configurator & cfg);
    virtual ~Client() {}

    void setParamX(int n);
    void incParamXBy(int n);
    int getParamX();


    Configurator & _cfg;

incParamXBy internally calls setParamX and getParamX on Configurator:

void Client::incParamXBy(int n)
    _cfg.setParamX(_cfg.getParamX() + n);

Let's assume that the initial value of paramX is A and that we want to increase paramX by…

Piotr's Less Obvious Advice on Google Mock: Returning new objects from a mock

Google Mock provides a way to return newly created objects from a mock method. Suppose we have a  Generator class that is supposed to generate new objects when createNewRecord method is called:

class Generator
    virtual ~Generator() {}
    virtual Record * createNewRecord() = 0;

...and suppose we want to mock this class:

class MockGenerator : public Generator
    MOCK_METHOD0(createNewRecord, Record * ());

Suppose the caller class Client has run method defined as follows:

void Client::run()
    for(int i = 0; i < 3; i++)
        rec_tab[i] = gen.createNewRecord();

We want the mock to return a pointer to a new object each time createNewRecord is called. This is how we can express this in the test code:

TEST(ClientTest, CanRun)
    MockGenerator gen;
    Client c(gen);

    EXPECT_CALL(gen, createNewRecord())
                 //this is equivalent of returning new Record(1,2,3)