What is it like to write more than 1,000 lines of code by hand?

What is it like to write more than 1,000 lines of code by hand?

[[133627]]

Isn't the code all written by hand? 1,000 lines is easy to reach. Before the Spring Festival in 2007-2008, our customers asked us if we could make a search engine for them. I had never learned search, but I had read some popular science articles and studied some ideas myself. I knew Lucene in advance and knew it was based on Java.

I went out and bought an introductory book on Lucene in Action and Java language, and then went home for the Spring Festival. During the 7-day Spring Festival holiday, my girlfriend and parents were playing cards and watching TV, and I was in another room, reading these two books and writing a search system based on Lucene. I designed an XML input and output protocol, and the index import format used XML. I wrote a Java version of the web server as the bottom layer of the system. The query returns the XML result in REST format. A configuration file is used in a configuration directory to set the query field, sorting field, and built-in index sorting. To switch different query methods, you only need to select a different configuration file name in the URL, with simple logs.

In 7 days, we wrote 2,000-3,000 lines of code. After the holiday, we put it online for testing for our customers. Once it was enabled, their search speed dropped from several minutes without results at peak times to a stable speed of tens of milliseconds. Their daily search volume increased from 4,000 to 8,000, and later to 100,000.

After they had 200,000 to 300,000 searches, the code was improved for the first time, and the performance was improved to ***. Later, we connected more customers, and the code was continuously improved, and the *** single machine supported 20 million searches. After several improvements, the code increased to more than 18,000. Later, I stopped paying attention to the number of lines.

The system developed from this code has served Fantong.com, Dianping.com, FTChinese, Liujianfang.com, Shanda Bookstore, and dozens of small customers of our company at that time. The daily search volume is about 30 million, and at least hundreds of millions of searches should have been completed.

(I have written hundreds of amateur side projects in my career, most of which have not been released, and most of which have more than 3,000 lines.)

Since someone has liked this post, let me tell you another story. Shanghai Taini has not closed down yet because of a typesetting system. We support the format of Apple iBook Author from the bottom up. This is a very complex packaging format, similar to a web page, but it has a lot of typesetting formats and CSS3 standard things that are not supported by web pages. In 2012, when our company was about to run out of money, I suddenly had a crazy idea to make this very complicated thing. But when I told this idea to our chief programmer, who is now the CTO teacher @陈勇辉, this idiot didn't understand.

So, during the three days I was on a business trip to give a speech, I wrote a prototype, implemented an XML DOM parsing tree, a simple CSS parsing tree, and wrote a simple iBook Author format analysis document. Using the file format I analyzed, I wrote a demo that can display the information of a page of an iBook Author e-book. I just checked the code base, and it’s less than 900 lines.

I gave it to the main programmer and explained the ideas and file format details to him. Then the next day, he understood it, and I didn't participate in the specific code of this project. This project now has about 26,000 lines. It has earned the company about 2 million. The company survived because of this project.

<<:  Google: 10 rules you must know to build a great mobile app

>>:  Win10: The Last Windows

Recommend

Walk more, be healthier, life lies in strolling...the same goes for birds!

The chicks of the Grey-headed Lapwing are precoci...

A detailed explanation of shared power banks (with operation strategies)

The author of this article conducted a market ana...

Postpartum care center-Tencent advertising customer acquisition strategy

Industry dynamics overview The market size has a ...

Watching the World Cup on TV: Sense of Presence and Participation

On June 13, the quadrennial World Cup will kick o...

A Guide to the Evolution of Cognitive Event Operations

Today I will mainly talk about the topic of event...

Xiaohongshu advertising account opening process, Xiaohongshu advertising charges

Xiaohongshu has become another marketing platform...

How to make products to stimulate users' desire to spread the word?

In the era of social dividends, the reason why th...

How do ants and plants become allies?

Produced by: Science Popularization China Author:...

Will the smallest robot be smaller than an ant?

In Journey to the West, in order to force Princes...

Learn character design with Hollywood animation masters 2020 [good quality]

Learn character design with Hollywood animation m...