How to NOT be a mediocre developer

    Hi, Habr! I present to you the translation of the article "How not to be a mediocre developer!"
    Dushyant Sabharwal. The article provides some tips for beginners and perhaps some experienced programmers who can help significantly improve their professionalism and change their attitude to work. Some of them may seem trivial, but beginners may be able to find something useful for themselves.

    Write more code


    If you want to improve your skills in any lesson, you need to practice more - workarounds, unfortunately, do not exist. No matter how many programming articles you read per day or how many times a day you re-read the documentation, you won’t get results without working with your own hands. Design patterns that seem difficult to apply to many beginners will automatically start flying out from under your fingers when you practice practicing them in different contexts.



    Write tests


    When I began to actively test my code, I was surprised at my lack of preparation for writing quality tests. Writing tests will teach you to look at your code in a new way, because by inventing ways to break your code, you will most likely become more aware of the structure and logic of your code, will find some errors of your own (even before executing tests, while writing them) and notice that it may be worthwhile to move some parts of your code to helper functions or to make some functions more generalized — in some cases, you will even have to do this after finding that your code cannot be tested.

    Let's look at an example:

    function postData(data){
     boolean valid = true;
     // проверяем наличие данныхif (data === undefined) {
       valid = false;
     }
    // проверяем формат электронной почтыif (!regex(data['email']) {
       valid = false;
     }
    // проверяем длину пароляif (data['password'].length < 8) {
       valid = false;
     }
    if (valid) {
      http
       .post(`example.com/user/create`, data)
       .then((response) => {
        //добавляем информацию в списокthis.users.append(response.userid);
       })
       .catch((error) => {
        // выводим информацию об ошибке
       });
     } else {
       showValidationError();
     }
    }
    

    The method postDataperforms several functions at once: checking the correctness of data, adding information to the list of users in case data passes the check, handling errors. Writing a unit test for postDatacan be quite a challenging and unpleasant task. It would be better to break this code into several methods and test each individually, for example:

    function postData(data){
     return http
       .post(`example.com/user/create`, data);
    }
    function validate(data){
     // проверяем наличие данныхif (data === undefined) {
       returnfalse;
     }
    // проверяем формат электронной почтыif (!regex(data['email']) {
       returnfalse;
     }
    // проверяем длину пароляif (data['password'].length >= 8) {
       returnfalse;
     }
      returntrue;
    }
    function appendUsers(userId){
      this.users.append(response.userid);
    }
    function main(){
     if (validate(data)) {
      postData(data)
       .then(data => appendToList(data.userId))
       .catch(error => handleError(error))
     } else {
      showValidationError();
     }
    }
    

    Already now you can see that writing tests leads to an improvement in the quality of the code — you had to break your long function into several shorter, performing fewer actions that can be easily tested separately.

    Be honest


    Do not lie about your knowledge. Pretending that you understand any API, you cannot bring real benefits to the team, but you can let people down if you are entrusted with the task or simply disgrace yourself by saying something out of place during the discussion.

    Participate in open source projects


    By participating in open-source projects, you may encounter situations that would never have happened in your regular job. So you can expand your horizons. You can learn more about working in distributed teams. continuous integration and other development tools actively used in large open-source projects. As you know, open-source significantly affects the world of information technology in general and developers in particular.

    Help people


    Helping other people with something that you understand well increases your value and reputation in the team, and also allows you to consolidate your knowledge and, sometimes, to find gaps in them. Calling for help with tasks that you do not understand 100% can often help you learn something new.

    Start your own project


    Own projects are a great way to learn new frameworks and technologies that you don’t encounter at work. When working on your own project, you are a product manager, developer and designer - just imagine how many important decisions you have to make on your own! Perhaps, once in your work, you will successfully offer to introduce a new technology or framework that you learned while working on your own project!

    Kill your ego


    Do not allow your ego and your work position to stand in the way between you and learning / improving skills. Every day, think about who you will become, instead of who you are now. Always be open to new ways to solve problems in which, in your opinion, you already understand. If this is not the case, you risk missing an algorithm that is more efficient than the one you use, or a more suitable architectural solution.



    Think about the reasons for the existence of software


    Before you begin to actively use the new framework, pattern or API, try to understand the reason (and the main goal) of its existence. Try to get an idea of ​​the reasons for creating the tools you are going to use.

    var app = new Vue({
      el: '#app',
      data: {
        message: 'HelloVue!'
      }
    })
    

    Above is an example of code that you can find online documentation vue.js . Even looking at this simple example, I think of the following things:

    1. Why use a keyword to create a component new? Why don't they use the factory pattern to create objects?
    2. It seems that the property eltakes the value of the idelement, but why does it use #? Does this mean that I can add other element selectors, such as attributes and classes?
    3. datalooks like a generic property name for an object vue. What exactly is she?

    I'm not saying that you should be so attentive to all the code that you encounter in your life, but developing this habit will help you better understand the essence of the devices used.

    Do not be lazy


    Laziness can prevent you from demonstrating your skills or making things that seem important to you. For example, if you believe that refactoring can improve code performance, do it! Add comments to save the time of other developers. Document the API you wrote. The time you have invested in your code is the time saved by other developers who will work with your code.

    Solve algorithmic problems


    Solving programming problems (meaning algorithmic, perhaps olympiad tasks) makes you think about things you don’t always pay attention to in your daily work. I'm talking about the asymptotic estimates of the code for time and memory. Some people argue that such tasks are useless, since everything has already been done for you and you just need to work with the API.

    I do not agree with this view. This not only helps you look at the code more critically, but also allows you to confidently propose solutions to improve the performance of the code. Another advantage is that the knowledge gained by you in the process of solving algorithmic problems, it may well be useful to you at the interview.

    Sites containing such tasks include: hackerrank ,leetcode , codingame and others.

    Praise people


    If you like the commit made by your colleague, write to him about it. Put a plus sign on stackoverflow answer that turned out to be useful for you. Vote on medium for the article that gave you useful knowledge. Put an asterisk to the project you are interested in on github. Encouraging other people helps them, and then you, to develop the best qualities.

    Do not abandon tasks of any type.


    If you see a problem in the API and imagine what it is connected with, then you shouldn’t say: “I am a front-endander. It's not my problem". In my opinion, this attitude to the problems is wrong. Basic programming principles, such as DRY, the use of abstractions in cases where classes implement mixed functionality, exception handling for all possible branches of code execution, etc. applicable at almost any level (frontend, backend), where problems arise for programmers. With these principles in mind, you will probably cope with tasks that at first glance seem to be “not your headache,” since you are working with other code.

    Conclusion


    As I said, reading this article can help you learn about new things that can make you a more qualified programmer, and require effort and discipline. If you have found ideas here that seem useful to you - do not tighten, try to implement them now!

    Also popular now: