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 possibly 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 started to actively test my code, I was surprised at my lack of preparation for writing high-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 running 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 discovering 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();
 }
}

postData : , , . postData . , :

function postData(data) {
 return http
   .post(`example.com/user/create`, data);
}

function validate(data) {
 //   
 if (data === undefined) {
   return false;
 }
//    
 if (!regex(data['email']) {
   return false;
 }
//   
 if (data['password'].length >= 8) {
   return false;
 }
  return true;
}

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();
 }
}

, — , , .


. , - API, , , , - .

open-source


open-source , , . . . , open-source . , open-source .


-, , , , , . , 100%, - .


, . product manager-, — , ! , , !


/ . , , , . , , . , , , .




, , API, ( ) . , .

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

, vue.js. , :

  1. new? «» ?
  2. , el id , #? , , ?
  3. data vue. ?

, , , .


, . , , , — ! , . API. , , , .


( , , ) , . . , , API.

. , . , , , .

, , : hackerrank, leetcode, codingame .


, , . stackoverflow, . medium , . github. , , .

-


API , , : « — . ». , . , DRY, , , .. (, ), . , , , , « », .


, , , . , — , !

Source: https://habr.com/ru/post/416825/


All Articles