We are developing open source code - we are developing and showing everyone our software development skills

    Many novice developers are faced with the need to show existing experience in software development. Even if the vacancy is called “a programmer without work experience,” even without the Captain it is clear that preference will be given to the applicant who showed a more or less intelligible code, more or less confirming the presence of useful skills in the work.

    What to do? Show a solution to a typical assignment from an early course or a graduation project? Perhaps this is not enough? Maybe write some impressive program and at the same time get development experience? For example ... a calculator or compiler, or what do they usually write to get and show experience? And if you don’t have enough strength to finish?

    There is one almost universal answer to these questions and doubts - the completion of open source projects. You get the opportunity to solve real problems of various levels of complexity, the result will not only work for hundreds of thousands of millions of people around the world, but it can also be shown. This opportunity is sometimes mentioned, but usually it does not stop there. This time, let’s dwell on it.


    The idea to finish open source for many comes up against a variety of objections. Here are the most common ones.

    The first objection is why to finish the “alien” instead of making the “own”. It is very common among people without experience in software development and is often caused by the stories of older people who themselves also have no development experience. The plot is usually something like this:

    1. "son / daughter, you
    will graduate from that wonderful university, 2. become a TYZH PROGRAMMER
    3. write a cool program
    4. ??????
    5. PROFIT - success, money, and in general everything is yours. ”

    Everything is fine here, except for one thing - developers usually do not write code from scratch, most often they modify the existing one. Somewhere you need to figure out a ton of code and add another ton of code. Somewhere you need to debug a ton of code and then rearrange the two lines in places (even the lines themselves do not need to be changed). The reason is simple: development from scratch is a very costly pleasure and there are a lot of mistakes in the new code, so “not every day our brother gets to whitewash the fence” as a whole, usually they paint over graffiti.

    Therefore, if you start to develop something more or less complicated from scratch without experience, you may encounter the following problems:
    1. You will not be able to finish writing and debugging the code, because it is difficult, but there is not enough power yet, it may simply not have patience
    2. if point 1 is passed, then we have a program with very limited capabilities, which almost no one will use, because ... SUDDENLY potential users already have the same or similar familiar and ready-made program, but they did not hear about your new one, and so it change you need to do a lot of promotion
    3. qualified developers who are ready to evaluate the quality of your code and give you feedback, very little or not at all, and this noticeably slows down your growth and can hurt in the future - you will get used to writing the code really badly and later puzzle the employers and be puzzled by yourself.

    If you neglect these problems, you risk spending a lot of energy on work that will be doomed to oblivion (it is also “work on the table”). If you are aware of the scale of these problems and everything suits you or you are ready to solve them - do not read further, develop ... what did you want to develop there?

    For comparison, completing open source, you:

    1. you can not develop from scratch, but modify what is already working (yes, it’s buggy, but you’re about to fix it), and the refinement can be either trivial (fixing a simple mistake) or very difficult (some kind of impressive new feature or accelerating the generation of machine code by the compiler by 15 percent), you can start simple and move higher
    2. if your edits are accepted, they fall into the long-existing distribution channel of the program that you finalized, and you get promotion of the results of your work omatically
    3. your edits turn out to be a universal laughing stock in the face of a relatively large number of developers who may, for example, point out non-obvious errors and ask to complete the revision
    4. you gain experience working with the existing code, its non-damaging development and communication with people who need to explain the essence of editing and maybe answer the questions that arise, these skills are very important for the developer - assessing the risk of editing, assessing the importance of fixing this or that mistakes, an explanation to all interested in the first and second help all participants in the development to make meaningful decisions.

    So, while finalizing the “alien” open source code, you get rid of a number of significant obstacles. It’s easier to get started, it’s easier to get feedback, the result of your work may well get into the next release of the program and gradually appear among hundreds of thousands of millions of users, plus it will lie in the open repository for reading and you can show it to everyone. The path becomes much less thorny.

    The second objection is that it is necessary to have already developed skills and many knowledge, thousands of them, but there is no knowledge yet, therefore there is not enough strength, you can’t start at all.

    Let's look at this piece of code (a simplified version of the code for one needed multithreaded library)

        DWORD waitTime;
        DWORD secondsInMilliseconds;
        DWORD millisecondss;
        /*...............................*/
        /* секунды в миллисекунды */
        secondsInMilliseconds = (DWORD)interval->seconds * 1000;
        /* наносекунды в миллисекунды с округлением вверх */
        milliseconds = (interval->nanoseconds + 999999) / 1000000;
        /*
        * Многие компиляторы выдают предупреждение "условие никогда не выполняется", 
        * потому что переменная беззнакового типа, но проверка точно зачем-то нужна.
        */
        if (0 > (waitTime = secondsInMilliseconds + milliseconds))
        {
          return EINVAL;
        }
    


    You see, there is even a comment that many compilers give a warning on this code, but the code is “for some reason needed”. Indeed, VC ++, gcc and clang give a warning on this code, they say that checking is senseless.

    Spoiler: the authors wanted to check that the addition does not overflow, in the case of signed integers this trick gives undefined behavior, but it works on most platforms, and here the numbers are unsigned, the behavior is defined by the Language Standard, but the verification does not check anything. Correctly so:

        if (secondsInMilliseconds > UINT_MAX - milliseconds)
        {
             return EINVAL;
        }
        waitTime = secondsInMilliseconds + milliseconds;
    


    Above in the same code there are multiplication and addition with a constant, but there they did not even try to check the overflow.

    What qualifications are needed to understand what this code should have done and at least roughly how to fix it? Five years of work experience? Ten? Maybe twenty?

    A sufficiently interested second-third year student at a specialized university. There is, for example, one university, where in the fourth semester, students, at the prompts in the textbook, write and debug a program that stores the entered data in a singly linked list, the links of which are created in dynamic memory, and all the code, including a simple memory allocator, must be written in assembler for x86. Enough to understand the work of the memory allocator, but not enough to understand the code above? Oh really.

    Still too complicated? Then simpler - also based on real code.

    void* impl_calloc(size_t numberOfObjects, size_t objectSize)
    {
      unsigned int totalSize = numberOfObjects * objectSize;
      void *p;
      p = malloc( totalSize );
      /* WHATEVER */
    


    Here it was necessary to use size_t and check that there is no overflow when multiplying. What qualifications are needed to fix this?

    And is it too complicated? Even simpler - somewhere in the bowels of a rather neat code of a very necessary program, right in the middle of a function is THIS ad:

        std::stack f;
    


    Yes, of course, everything is clear. Obviously, f is f . Here, “everything works”, but the developer who will debug the surrounding code will for some time wonder what it is and why, and why then these pointers are added to this std :: stack object . Here it is not at all harmful to understand why a variable is, to come up with a short meaningful name, consistent with other names in the surrounding code, and fix it. You may need to name the variable fields or functions . What qualifications are needed to fix this?

    The open source code is full of various defects of various complexity, many do not even need to be looked for, they have been in a prominent place for many years, they jump and squeak “comb us, well, please.”

    The third objection is that edits may not be accepted. Really can. The project owners may decide that the proposed revision for some reason is not suitable (for example, a new feature is not needed). It helps to first look at the history of changes to understand if there is life on Mars, and then send a small edit so that it is not so offensive. Alternatively, there may be prerequisites in the form of a copyright disclaimer ( for example, in SQLite), which are technically difficult to accomplish, this is rare, but it’s better to find out in advance. In most cases, all special conditions are negotiated immediately and in a visible place (for example, there is a contributors section). Not all projects accept edits equally easily, but finding a suitable project is easy.

    The fourth objection is the garbage dump there, not for this you have studied for so many years. It’s not such a mess, especially since developers usually modify the existing code, which contains various defects in more or less quantities. Look at this from the other side - you can figure out the complex obscure (sometimes very complex and very incomprehensible) code and improve it. Adding ten lines of code to a widely used multithreaded library can be much more valuable than a whole thousand line calculator.

    Fifth objection - something complicated must be done to “join” a suitable project. No, it’s not necessary anymore. Systems like Github allow you to suggest edits in a few clicks. You can find defects in the project error list, by viewing the code, by a static analyzer (for example, completely free Cppcheck, whose code is also open and lies on Github ) or by compiler warnings. You can choose the project yourself - for example, look briefly inside the library that you used to work with XML in your term paper.

    You can come up with any number of objections or start to finish open source code already.

    Dmitry Meshcheryakov,
    product department for developers

    Also popular now: