When I was young I used to hate vi. I thought it was insane. Then I ended up working with very clever people who LART'd me. "Here's a nickel, sonny, buy yourself a real computer."
The learning curve is horrendous but even after a couple of hours you start to become much more productive. You then begin to wonder why people put up with all those other editors out there. Don't get me started on the likes of Eclipse or VSCode.
Funnily enough, I'm not what you'd call a vi or vim expert. I learned just enough to suit my own workflow. What I then found myself doing was automating several tasks. Do I use macros? No, I use shell scripts and sed and very occasionally a little bit of awk. At some point you have to nail your colours to a particular mast and get on with it, however, I try to avoid getting locked into particular applications. So rather than write macros for a particular editor, I use the shell.
I think the most lines of working code I've ever written in a day (by hand) was about two thousand, when I was at the top of my game some years ago. I've since developed all sorts of little ad-hoc tools for helping me write code. Some are burned into my brain and I can sit down at a keyboard and start hacking out scripts to help me write code so I can go from zero to several hundred lines in less than a day.
Of course, I should be using higher-level languages that require fewer lines of code but that's another story.
The most productive day I ever had consisted of a code review where four of us spent less than 45 minutes going through about 200 lines of code identified by a profiling tool as the significant bottleneck.
In that brief code review we identified a potential speedup: reducing those 200 lines of code to about 195 that also reduced cache misses and accelerated performance by ~100x. This was unexpected and meant that the massive arrays of 50+ high performance computers per site the company was planning for could be served by a single machine performing the task over twice as fast as needed.
I, too, have had 2000+ LOC days, but looking back at code cranked out like that has never made me proud.
(Score: 1, Insightful) by Anonymous Coward on Thursday June 06 2024, @11:15PM
by Anonymous Coward
on Thursday June 06 2024, @11:15PM (#1359603)
It can depend on the code. The most code I've ever cranked out in a day was almost 5000. That code model was impeccable, I was on my game, and newly refreshed after a vacation. It was an absolute breeze to write the code, instantiate the test templates, crosscheck against the specification, and then verify. That is the only reason I was able to crank it out in a day and it was a beautifully great day I'll probably never match. Another great day was when I moved a server from Go to Erlang while cutting server requirements by 80%. On the other side of that, I've had multiple days were I've written maybe a dozen lines of code that perfectly fit the specification that verified first try. To the reverse that, I have had days where I've torn out my hair trying to get simple five line functions to do what I want them to do in an acceptable manner and days where I've done hundreds of lines but those lines were complete shit that I wasn't happy with and ended up jettisoning eventually.
More than the code lines, it really more settles on your psychological flow and how useful the final product is. That's really what the three of us had on our special days. But it is also easy to mistake the SLOCs as the reason rather than the result.
(Score: 4, Interesting) by turgid on Sunday June 02 2024, @04:42PM (2 children)
When I was young I used to hate vi. I thought it was insane. Then I ended up working with very clever people who LART'd me. "Here's a nickel, sonny, buy yourself a real computer."
The learning curve is horrendous but even after a couple of hours you start to become much more productive. You then begin to wonder why people put up with all those other editors out there. Don't get me started on the likes of Eclipse or VSCode.
Funnily enough, I'm not what you'd call a vi or vim expert. I learned just enough to suit my own workflow. What I then found myself doing was automating several tasks. Do I use macros? No, I use shell scripts and sed and very occasionally a little bit of awk. At some point you have to nail your colours to a particular mast and get on with it, however, I try to avoid getting locked into particular applications. So rather than write macros for a particular editor, I use the shell.
I think the most lines of working code I've ever written in a day (by hand) was about two thousand, when I was at the top of my game some years ago. I've since developed all sorts of little ad-hoc tools for helping me write code. Some are burned into my brain and I can sit down at a keyboard and start hacking out scripts to help me write code so I can go from zero to several hundred lines in less than a day.
Of course, I should be using higher-level languages that require fewer lines of code but that's another story.
I refuse to engage in a battle of wits with an unarmed opponent [wikipedia.org].
(Score: 2) by JoeMerchant on Thursday June 06 2024, @04:32PM (1 child)
The most productive day I ever had consisted of a code review where four of us spent less than 45 minutes going through about 200 lines of code identified by a profiling tool as the significant bottleneck.
In that brief code review we identified a potential speedup: reducing those 200 lines of code to about 195 that also reduced cache misses and accelerated performance by ~100x. This was unexpected and meant that the massive arrays of 50+ high performance computers per site the company was planning for could be served by a single machine performing the task over twice as fast as needed.
I, too, have had 2000+ LOC days, but looking back at code cranked out like that has never made me proud.
🌻🌻🌻 [google.com]
(Score: 1, Insightful) by Anonymous Coward on Thursday June 06 2024, @11:15PM
It can depend on the code. The most code I've ever cranked out in a day was almost 5000. That code model was impeccable, I was on my game, and newly refreshed after a vacation. It was an absolute breeze to write the code, instantiate the test templates, crosscheck against the specification, and then verify. That is the only reason I was able to crank it out in a day and it was a beautifully great day I'll probably never match. Another great day was when I moved a server from Go to Erlang while cutting server requirements by 80%. On the other side of that, I've had multiple days were I've written maybe a dozen lines of code that perfectly fit the specification that verified first try. To the reverse that, I have had days where I've torn out my hair trying to get simple five line functions to do what I want them to do in an acceptable manner and days where I've done hundreds of lines but those lines were complete shit that I wasn't happy with and ended up jettisoning eventually.
More than the code lines, it really more settles on your psychological flow and how useful the final product is. That's really what the three of us had on our special days. But it is also easy to mistake the SLOCs as the reason rather than the result.