“This is the 27th day of my participation in the Gwen Challenge.

Welcome to pay attention to the public number: Luka Duo duo

Is writing code stream of consciousness?

Due to the reconstruction of the project these days, the current module has added a lot of verification. After adding the previous business verification, the code I wrote is ok, but it is very difficult to get mixed together:

if(A = = null) {

/ / a check

if(b||c){

/ / b check

 if(d==null){

/ / d check

 }else{

 return  result;

 }

}

returnThe result;

}

Copy the code

I currently write a half a day of logic, less than an hour by the manager, directly written out, and the code is very clear, easy to read is also particularly high;

I gradually lost myself in thought.

Writing code, in fact, is to write logic, understand logic after start, will get twice the result with half the effort;

But I may have thought of half of it and just started;

Writing code is to play with logic, logic is the essence of business;

Writing code is actually a fun thing to do,


Realistic requirements, according to the customized business, we will use code to realize abstract requirements, complete specific functions, to provide services for suppliers

As a developer:

Luca would like to share with you the essentials of code

  • Keep in mind that good code comments can provide a lot of convenience for subsequent development

    (It is best to comment every method, function, logic, and input.)

  • Code format, to standard (code before submission formatting, readable will be very high),

Standardization leads to increased code readability

  • The entry and exit of code methods must be defined before writing

Methods -> parameter entry, parameter return value, in the control layer at the end of the normalized return

  • Parameter validation is necessary in the logic of the code

  • Code principles, high quality and reliability, good code has

  • Code extensibility also needs to be considered

  • In the code interface, consider exception handling, asynchrony, idempotency, timeout, etc

  • Code needs to be tested for safety. Reliability is essential to function. In all systems, safety comes first, function comes second.

A system without security is useless and meaningless

  • Code null pointer to avoid, check the validity of parameters

  • Code threads, middleware calls, as well as encryption, desensitization processing

Conclusion:

Code is actually our exploration of the world. In the world of computers, there are only 0 and 1, but in the world of human beings, it is 🈶 gray. In fact, it is the abstract embodiment of current human needs and life system.

We are also artists, using programming languages as brushes to paint a rich world for people’s convenience

Luca message

I am lucky enough to become a software developer. Maybe after many years, I will use the system I wrote before, and after many years, this system has been robust in our life, I will also feel a sense of achievement.

Today is the last day of June for the nuggets, and July is a good start. see you in July