And again, the 256th day of the year

Hey. Two hundred and fifty-sixth day of the year is in full swing, and the guys from Avito and I want to congratulate everyone who reads this blog on programmer's day and plunge a little into nostalgia.







Under the cut, we remember in honor of the holiday our first lines of code. And also - the code and programs that we most remember. And tell why. And of course, we are looking forward to your stories in the comments!













What kind of programming language is in the picture?

We are nostalgic today, so we chose COBOL for congratulations. It was the first standardized programming language (standardized in 1960). This means that a program written on one computer could be compiled and executed on another computer without any modifications. In those days, this was a huge breakthrough, other languages ​​required refinement of programs when trying to run them on another computer, often it was difficult and long.







Happy Programmer's Day at COBOL looks like this. (Thank you for the excursion and code pik4ez ).







What is this post about?



The idea of ​​the post was born during the summer corporate party, when my colleagues and I suddenly started talking about the first steps in programming. And iseregin and I decided to collect their memories and share with the public. So…







First lines of code



It would seem that interesting in the first lines of code? Some also thought so at first.







Dev 1: I thought everyone had the first line of code something like:







!#/bin/bash echo "Hello World"
      
      





Dev 2: In our area it was sooner: MsgBox "Hello World"



. Because I still had to try to find a disk with Linux.







The discussion, one might say, started already from the first remarks in the chat. And then we got some interesting and detailed answers that we want to share. That's what colleagues from Avito told us.







image





Andrey Shodan Aksyonov, Head of Search Infrastructure: “The very first lines of code that I basically entered into the computer were definitely not mine. These were some strange Basic programs that I reprinted from magazines (because of a harsh childhood, eight-bit toys). But I remember exactly how other people first used my program.



This was the era of the end of DOS. I wrote an assembler program that captured the screen in graphical mode. Moreover, in contrast to everything that was on the “market”, she coped with all the video modes in general, including completely insane hacker ones. For example, if the standard VGA mode of operation was 320x200 and 256 colors, then people using some kind of vile hacks and reprogramming the controller, which drives the rays through the MDG tube, achieved 360x240. I managed to write a program that coped with all this, captured the screen (video memory), saved it to a file, and then from this dump you could deftly .bmp save it as a separate offline utility. I brought this program to the end, posted it on the Internet and successfully forgot.



Almost 12-15 years have passed since that moment. I got an e-mail. Such a sheet, as if Leo Tolstoy writes, on three sheets - and this is only the first phrase. “Hello, I'm a trucker from Canada. Active user of your program. I don’t have money, but I have five children. And I found the 486th computer in the garbage dump, plus I stole some old games on the Internet, and now my children are wildly spinning different games on this computer. At the same time, their favorite game does not know how to save anything: it is impossible to save a common board of honor, not even a single top high score, and even a screenshot cannot be taken, because some kind of drug addiction mode is used. And your utility does an excellent job of this, and children constantly use it. Yes, I myself, it happens, between flights ... So, since we are active users of your ancient program, I decided to encourage you. Here's a $ 20 Western Union transfer code. ” I practically cried and decided that on the darkest day, when it finally arrives and I will go hungry, here I will take this MTCN (transfer code), cash it and the doorway. Unfortunately, many more years have passed since then, so it is not known where MTCN is now. Perhaps there are in the old mail archives, if I have not lost them during this time. I recognize on the blackest day. ”


image





Artyom Razinov, a leading iOS developer: “In the fifth grade, I wrote the code on my own in the children's program Logo Worlds, while all the other more successful guys played games. I created a program and it worked. That day I decided to become a programmer. ”





image





Daniil Popov, senior android developer: s := width * height;



“It was a line on Pascal that calculated the area of ​​the rectangle. The case was in programming courses for students in the eighth grade. What impressed me the most was then that I can give the computer commands, and it implicitly executes them. A kind of master of machines. Since then, I really love it when the built-up sequence of actions (algorithm) leads to the result. ”


image





Dmitry Belov, senior backend developer: “This was the first order on foreign freelance. Hungry students, I wanted to earn at least a little money, and it was not so important what to write on: there was almost no knowledge, to study anyway from scratch.



I got an order to make an animated flash card. I had to teach Action Script a little. Stackoverflow was not there yet, I had to read the documentation.



The customer was satisfied, I managed to complete the project right away. He earned his first fifteen dollars on freelance. "


image





Ilya Gribov, front-end developer: “I was fond of programming from the 8th grade of the school (Basic, Pascal), but then there was a long break. He returned to this business only after university, and had to remember a lot!

Winter, 6 a.m., strong coffee, before going to work (then I worked at all in IT)



 static void main(String[] args) { System.out.println("!"); }
      
      







Emotions: WHAT IS String [] args ??? ”.


image





Vladimir Akimov, senior front-end developer: “My first line of code was written because I really wanted to enter the rap hangout. I was about 17 years old, I did not know how to rap and write music, and decided to enter a cool team through design.



Then no one was involved in promoting independent artists on the Internet. So, friends will draw the cover, release the disc, and distribute it to friends. And there was a MySpace site where you could coolly design a musician’s page. I watched how overseas guys do it. At some point, I came across a guy who lived in Germany and made a page for Seryoga. The one who sang "Black Boomer, Remember"? I decided to spy on how to do this. MySpace was laid out on tables, I picked up this whole page, understood his idea and borrowed it.



My first pages were similar to his pages. I did one after another, tried to promote them. So I made friends with one team. There was a designer who invited me to write code, and took the pictures on himself. We started to create MySpace pages for all our popular Russian rap artists. And then I was invited to work at the MySpace St. Petersburg office to work.

Then I wrote a lot of lines of code there - of the same type, tabular: it was CSS and layout, nothing complicated. Now any junior will figure it out and make it cooler. But then it was a “wow”, because we worked with IE5 and other browsers, for which we had to do a lot of magic.



If it weren’t for this story, I wouldn’t take up programming, wouldn’t come into design, wouldn’t understand what it is.


image





Konstantin Seleznev, backend developer: “My classmate“ hooked ”me on programming back in seventh grade (truly, like a drug):

- Pss, man, do you want some programming? - something like this he told me, handed me a disc with Borland Development Studio and a huge collection of articles about Delphi.



Later, in one of these articles, I found the following: “Let's get to know the user. For example, we suddenly display the message “It's time to sleep” and ... cut down the monitor! The crank will not be able to turn it on ... ". I tried the code given in the article and everything worked out for me! I felt like a real hacker!



True, after that I had to restart the computer, because I really failed to turn the monitor back on. ”



 procedure TForm1.Button1Click(Sender: TObject); begin MessageDlg(' .   .     !', mtInformation, [mbOk], 0); SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0); end;
      
      









And here are stories from the leading Podlodka podcast.







image





Stas Tsyganov, Head of Mobile Development, Tutu.ru: “My mother worked as a computer science teacher, and I got access to computers quite early. And my first programming experience was Cucaracha for MS-DOS. I learned with interest that she is still alive and even ported to Windows.



    5  
      
      







And the first code I had was something like this. "


image





Egor Tolstoy, App Platform Development Manager, Avito: “About ten years old I came to visit my older brother, who then had his first computer, back on MS-DOS. In addition to rampant nicks in the first GTA (in Russian localization it was called the beautiful name Avtovor) and Duke Nukem we discovered programming for ourselves. Math was not very attractive to me then, but logical branching and drawing were just right! So the first program was the generation of suprematist compositions from circles and lines: CIRCLE(10, 10), 50



”.


image





Katya Petrova, Head of Development, Frontend Architecture, Avito: “Forcing a turtle in the logo worlds to draw circles and writing“ Hello world ”in Pascal at computer science lessons was, of course, entertaining and informative. But it was even more fun in the 8th grade to drive bosses in the WoW Classic (then still not mainstream). So here are my really USEFUL first lines of code. "



 #showtooltip Regrowth /cast [@mouseover,exists,help][@player] Regrowth(Rank 5)
      
      









image





Zhenya Catella, head of mobile development, Yandex.Transport: “Somewhere in the 8th or 9th grade I became interested in programming, so my parents bought me a book on Turbo Pascal. I still remember that she was red. And at first there were simple things, like cycles and conditions. And then, it seems, the first chapter ended with a story about what recursion is. And it was necessary to solve the puzzle about the Hanoi tower. Therefore, except for the Hello Worlds, it can be considered my first program. ”


The most memorable line of code



Of course, the discussion was not limited to the first lines of code. And we also talked about the code, which for various reasons we really remember.







image





Andrey Shodan Aksyonov, head of search infrastructure: “Once upon a time, when I worked in game dev, we foolishly wrote our own engine. In general, this cannot be done, it is impossible, but no one told us this. Therefore, we wrote from scratch our own engine and all the tools for developing the game, and built a game on it, and managed to do all this in three years. Well, and in particular during this igrostroy I came up with and made this kind of clever feint with my ears. At the very very first generation of graphical programmable accelerators, where shaders were just attached, there was a short period when the GPU could be programmed in assembler and laid out instructions for the slots with your hands. Then this feature was disabled, only HLSL was left, but at the very beginning it was possible. So we managed to use four textures at a time in one pass (this is trivial), and at the same time count the lighting, the map of the bumps, the shadows to apply, and something else (but nobody knew how). Our company then had, if not 3 know-how, then 2 know-how, this thing was the main thing. Then, after a year or two, when the technology moved forward and it somewhat lost its relevance, with the permission of the authorities, I published an article in the ShaderX4 book about this. It was a very beautiful honest engineering solution, for which I have not been ashamed to this day. But this is not one line of code, but ten whole! ”



  Listing 5. #define POW c3 // c3.b=B, c3.a=A, for m=2. see [Beaudoin02] dp3_sat r1.rgb, t1_bx2, t2_bx2 // (1) (NH) dp3_sat r0.rgb, t1_bx2, v1_bx2 // (2) (NL) +mad_x4_sat r0.a, r1.b, POW.a, POW.b // (2) (NH)*A+B mul_x4_sat r1.rgb, r0.a, r0.a // (3) (NH)^n +mad r1.a, t0.b, SPECK.b, SPECK.a // (3) specshadow mul_sat r0.rgb, r0, r1_bx2.a // (4) (NL)*diffshadow +mul_sat r0.a, r1.b, r1.a // (4) ((NH)^n)*specshadow mad_sat r0.rgb, r0, DIFF, v0 // (5) (NL)*shadow*diffcol+ambi +mul_sat r0.a, r0.a, t1.a // (5) ((NH)^n)*shadow*specmap mul_sat r0.rgb, r0, t3 // (6) diffmap*difflighting mad_sat r0.rgb, r0.a, SPEC, r0 // (7) result +mov r0.a, t3.a // (7) diffuse map alpha
      
      









image





Daniil Popov, senior android developer:



 i = 0x5f3759df - ( i >> 1 ); // what the fuck?
      
      







This is a snippet of a function that computes the fast inverse root of x. Such calculations are needed in game engines to calculate stage lighting. This unreadable code became widely known after the release of Quake III: Arena.



When I saw this code, I first clearly realized the gigantic gap between the readable code and the optimal one.


image





Ilya Gribov, front-end developer: “I remember this code. I thought: “How simple and concise!)” ”.

 >>> comp_list = [x ** 2 for x in range(7) if x % 2 == 0] >>> print(comp_list) // [4, 16, 36]
      
      









image





Mikhail Yudin, senior android developer: “I was writing a red-black tree as a second year student at acm.timus.ru using the book of Corman, and something went off the roof, and I checked this for null equality. This situation is impossible. They wrote to me that I am Kommersant (like true, harsh). ”



 if (this == null)
      
      









image





Nikolai Ryabov, senior front-end developer: “Somehow, at my first work related to the front-end, where I was still a very, very green junior, the same novice developer threw this line for thought to me, with the words: “Friend, I've been trying to understand what it is and how it works - let's suffer together!”. As a result, my head was occupied only with this and after a couple of hours I still understood what it was and what we would get in foo as a result. But I couldn’t explain it then.



 const foo = Function.prototype.call.bind(Array.prototype.slice)
      
      







Already much later, I started using this snippet for interviews, and it showed excellent results: once I had the problem of finding a good developer to transfer to him all my competencies in my previous work, and at one of the conferences I met one notable person and in between the cafe invited him to tell how this code works. He managed, unlike many candidates whom I interviewed before. As a result, he fully lived up to expectations when I arranged for his then job. And to this day I like to throw this puzzle and look at facial expressions, although this code is no longer relevant in connection with the release of new ECMAScript standards. ”


And not only the code



I want to end this post by quoting Andrei Shodan 's colleague Aksyonov:







“In general, a story is usually not limited to one line of code. And even a small snippet on ten lines is extremely rare. And the most enchanting stories, they probably never about the code, but first of all about people, about how this code affected them. And what kind of line of code was specifically there, or what specifically a stupid mistake of two characters is completely unimportant. ”

Some of the stories that are told here, iseregin shot on video and posted on our YouTube channel. Drop by if you like the video.







Once again, congratulations to all the programmers (and at the same time those who work closely with them). Spend this day pleasantly and interestingly.

And share in the comments the lines and stories that you most remember!








All Articles