📜 ⬆️ ⬇️

Secret Notes in Code



Let's talk about perhaps one of the most important issues. About the style of the code. Admit how many times they carried the heresy because they were tired or simply did not report sugar to the coffee? After a hard working night, from Saturday to Sunday (yes, I am), I accidentally wandered into the section for advertisers on Habré. Having seen a cool element - I, as a person completely accomplished in my life, it is useful to look at how it is done so that I don’t have to break my head. And you know what I saw? I saw how CSS sends me. No, the error did not come out, there is even no metaphor! I literally sent the name of the class. In the beginning, I wanted to speculate about the very ideal code to which everyone aspires, but which over and over again in trifles turns out to be in cracks due to fleeting insanity. But today is Sunday, so that we will manage the usual selection of "humor" on the topic: "hehehe."

Speed ​​version control system
private Quaternion _initialRotation; //   private float _angle = 0f; //   


And then the sticker came off and everyone forgot
 /* * UnitControl     ,      *    ,        *       *       ,      */ 

')
The main thing to warn
  while (parallaxSprite.SpriteTransforms[0].position.x - parallaxSprite.ParallaxSpriteRenderer.bounds.extents.x > CameraFollow.TransformComponent.position.x - 30) //yep, it's magic number 


 // NO REASON TO DO THIS IN THIS SCRIPT!! 


Landan and Capital the Great Britain
 //vector to target in ploskost 


This awkward moment when bruised little finger on the cabinet
 //DIE DIE DIE DIE DIE DIE DIE function die() 


By the way, when something goes wrong, you can always start calling names
 //  ,     . //   ,      . 


Once a little boy deleted a piece of code, then it turned out that this piece had never been there.
  //  ,    ,    . 


By the way, when I wrote on the pros, I was always afraid that the memory would flow:

 (  -          (  )): int MyFunction() { //       int Result = 0 //       MyObject *Ptr = new MyObject(); //      Result = Ptr->DoSomething(); //    return Result; } 


When I see something not clear, I think that this is such an optimization and move on:

 x = -x; //  ,   ,       - 


I used goto once in my life - I couldn’t look at my parents for a week.

 ICantBelieveImUsingAGoto: 


 // TODO:  .  ? 


 $GLOBALS['data'].... //        ? 


 alert("login error"+response.err); //     . 


 //   ? targetX = Mathf.Clamp(targetX, minXAndY.x, maxXAndY.x); targetY = Mathf.Clamp(targetY, minXAndY.y, maxXAndY.y); 


In his youth, he sometimes called out freelance studios with bad words due to the fact that they did bad things on my landings. He called directly in the comments on the landing, until he received a cap. Now back from funny to bad, how often do you leave rude comments in the code? Especially on the client side, somewhere in html?

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


All Articles