Live data from Hacker News

Ask HN: What are your favorite developer-efficiency tips?

news.ycombinator.com

411–420 of 532 posts

Re: Ask HN: What are your favorite developer-efficiency tips?

#411

Learn to touch-type properly. I'm not a shit hot typist or anything, but it does make hours on a keyboard more pleasant. And (hate me) I do judge other devs on it. If someone can't be bothered to invest a few tens of hours on such a key productivity enhancement then what does that say?

I'd love to subthread hear from people if alternate keyboard layouts have made a difference. ?

I use QWERTY but on an ergodox. Massively improved my experience at my usual workstation and it’s still seamless to jump on a normal keyboard if I’m using my laptop or someone else’s machine.

Re: Ask HN: What are your favorite developer-efficiency tips?

#412

SCM Breeze[1] is one of the first things I install whenever I set up a new dev machine. Setting up bash aliases for git commands like `ga=git add` is nice, but SCM Breeze takes it one step further and automatically numbers each file in the git output. Then you can do `ga 1 2 5`. [1]: https://github.com/scmbreeze/scm_breeze

Zsh has this built in

Re: Ask HN: What are your favorite developer-efficiency tips?

#413
post #156

Probably an unpopular opinion but... Write your own text editor. I've been working on my own ( https://github.com/alefore/edge ) as a side project and using it exclusively for about six years. I don't expect it to be very usable by other people (it's very customized for my workflows, I suppose; e.g., it's mostly useful for writing C++ and Markdown files) but, because I know it inside out (and I've invested in making…

Genuine question: do you think that writing your own editor was a better investment than extensively customizing an existing editor like Vim or Emacs (even going so far as to change the keybinds and UI)?

Good question.

I guess I'll never know for sure. I believe it has been worth it for me, as there are several things I can do now that I'm not sure whether I'd have been able to achieve by customizing them (unless you include "rewriting their source code extensively" as customizing them; but at that point I think I'd be roughly doing the same as what I did?).

I'll give three examples:

1. Being able to run

  edge -view=all src/*.cc
This loads all those files, splits the screen, showing all matching files (up to a minimum area for each, with "Additional files: 498" (not shown) at the bottom), and lets me modify all files simultaneously (e.g., "search for a given regexp, make all cursors active, advance 5 words, delete to end of line, save all files, quit).

I just recorded an example of that (where I'm just renaming "OpenBuffer" to "Buffer"; you can trivially do that with Perl, but obviously you could do much more than just a simple regexp replace): https://asciinema.org/a/XNbNGL38kOrok2HO7zrarrQad

These are things that even heavy Emacs/Vim users would typically do through sed/awk/perl; I see that as a limitation in their editors (since you wouldn't use the same sed/awk/perl technique if you're just going to edit a single file).

2. I've supported multiple cursors (within one buffer) natively for a while (and I use it very often; for example, searching for a regular expression just leaves a cursor in each occurrence).

I guess I'd have been able to accomplish things like this, but I'm not sure of the quality of the results. In other words, I feel that it would have to rely on putting a lot of complexity in extensions and I'd guess that it would be too brittle and difficult to maintain. There are probably extensions for these things for Vim and Emacs, but I would be slightly worried that they may not integrate very well with other features and may brittle. But I don't really know.

3. I also got fed up that these editors would block on most operations (such as when you typed ":make" in Vim or when you opened a file from a networked file system); my editor never stops responding to user commands (rather, it simply visually indicates that it is executing something; perhaps you'll see side-effects as they occur). For example, here is how "make" works (you'll see me switching back and forth; most of the time you'll see the dots next to "make" (at the bottom line) moving, reflecting make's progress; in case it helps understand what's going on, I save the file, which causes "make" to be killed and restarted): https://asciinema.org/a/es4O4UdxPzB0vl7Tr88TKlq9N

I bet you can make Vim/Emacs operate this way (compile asynchronously, overlay errors with the files (as you can see around second 0:31); be able to nest commands with a pts within them, so that you can use them as you'd use tmux/screen). I'm not sure you make them load/save files asynchronously, never blocking?

Those are the examples.

When I started I was a heavy Vim user, but I got fed up of having to edit vim syntax, which I considered a, hmm, suboptimal programming language (yes, I'm aware that there are bindings for nearly every language under the sun, but still). I considered Lisp slightly preferable (and at the time I was still somewhat enamored with Scheme; I had been contributing some ~important modules to the Chicken Scheme implementation; these days I'll go to great lengths to avoid coding in languages that make static typing difficult, mostly because I don't think I'm smart enough to use them successfully for large/complex enough projects), but I was more into Vim than into Emacs. But I felt like it ought to be possible to do better than either. I felt that they suffered from carrying a lot of assumptions that were valid in the 90s (or earlier, perhaps 70s) but no longer applied, so I wanted to see how far one could go and experiment.

For example, as the user is typing, between each keystroke, something like ... hundreds of milliseconds pass. That's an incredibly long time for a computer! However, these editors mostly just sit idly, waiting for the next keystroke, not doing anything. My philosophy is completely different: burn as much CPU as you want, as long as you can give me something useful in return (and as long as you never stop responding). In other words, do whatever you can to maximize the value for the user.

You can see an example of the type of things I mean in the prompts in the above recordings:

- In the 1st recording (https://asciinema.org/a/XNbNGL38kOrok2HO7zrarrQad), around second 0:16, where I start typing a search regexp. As I type, the editor tells me things like "this would match 394 positions; in 32 buffers; and there's 2 search patterns in the search history that this matches".

- In the 2nd recording (https://asciinema.org/a/es4O4UdxPzB0vl7Tr88TKlq9N) around second 0:12, where I start typing a path (of a file to open). The editor scans the filesystem (asynchronously, obviously) and history log and tells me something like "you've typed `buffer_` so far; this matches 17 files (in all registered search paths) and 8 entries in this prompt's history".

(The key point is that all this functionality is asynchronous so it never blocks the user. If you type the next character as it is still scanning something, it just throws away those partial results (I'm somewhat simplifying; it's a bit smarter than that).)

You can probably achieve these things with extensions for Emacs/Vim, but I'd guess you'd still be somewhat limited by assumptions they make?

At the point where I'd be basically rewriting most of their source code ... I think it'd have been a significantly longer route (because I'd probably have had to care for a lot of additional things that are irrelevant to me).

Anyhow, to wrap up (sorry for the long rant!), this has been a great experience for me. I've learned a lot (e.g., I think I have more informed opinions about things like fuzz-testing, or the use of settable futures vs continuation-passing-style vs callback spaghetti) and I'm somewhat doubtful I would have been able to achieve so much through my own custom extensions for existing editors.

Thanks for asking the question. :-)

Re: Ask HN: What are your favorite developer-efficiency tips?

#414
post #333

This is a bit of a departure from the question you asked, but I'm always amazed how much people tend to hyper-tune their dev environments, when in reality, most of my time is spent thinking how not to write code. I get just as much work done on a completely vanilla macbook with VS code installed on it as my editor-obsessed peers with obsessively optimized setups can. How much actual code are you writing? I'd be reall…

It isn't so much the total LOC that I write (and delete) in the process of making a change so much as it is the friction and mental overhead of the change. The more I can focus on making the semantic change that I care about, the better.

Admittedly my vim setup doesn't even have YCM because I don't care enough to do it. But there are other minor things (swapping : and ; in control mode, mapping jk as ) that I've done that I hate working without now.

Re: Ask HN: What are your favorite developer-efficiency tips?

#415
post #360

The things I've benefited from most are not tools but practices. - Question the work Always be questioning whether the thing you're doing really needs to be done. Is there a way to not do it? Is there a way to do something better instead? - Park downhill Before putting a project or incomplete task away, make notes of what the next thing was that you were going to work on. This lets you bypass that 10 minute orientati…

Semi-related to “park downhill” is something I do at the end of the day if I’m still working on a piece of code - I’ll write a simple next task in a non-comment so it breaks the syntax. Then the next day I can dive in and “fix” the code which, at least for me, helps get in the groove.

Another variation: leave a failing unit test that will pass when you implement the next thing you were planning on doing.

Re: Ask HN: What are your favorite developer-efficiency tips?

#416

I keep two diaries, both MS Word documents. In one, I write summaries of what I read about -- papers, blog posts, books, and articles that interest me, along with the google search term, authors, URL, quotable quotes etc. In the other, I put together a free-form running log of projects I am working on, along with feature ideas, benchmark results (and the parameters used to get it),etc. Why MS Word, you ask? I am ordi…

Typora is mark down based but is WYSIWYG.

ah, thanks. I did not know about this.

I did a quick trial run, and I love it. I'd pay for it. I tried drawing quick sketches on an iPad and pasting it, I tried latex math formulae inside tables; they worked flawlessly. The UI is gorgeous. Lists don't seem to work inside tables though, and most of the keyboard shortcuts don't work for me.

In any case, for the theme at hand, I'd still go for a word processor and a single file combo. It turns out I need more primitives to organise my writing than even typora's markdown gives me, such as colors, formatted paras or lists within tables, tab stops etc. And most importantly, Word has evolved to support really large files, since I have had basically a single diary for many many years.

That said, I will try out typora in earnest for documentation and other things.

Re: Ask HN: What are your favorite developer-efficiency tips?

#417
post #360

The things I've benefited from most are not tools but practices. - Question the work Always be questioning whether the thing you're doing really needs to be done. Is there a way to not do it? Is there a way to do something better instead? - Park downhill Before putting a project or incomplete task away, make notes of what the next thing was that you were going to work on. This lets you bypass that 10 minute orientati…

Also: don't question the work. Sometimes it's already a compromise between too many people who questioned it, and nobody wants to discuss it any more. Sometimes the questioning is more work than actually doing it. Sometimes you get a reputation of only being in the way. Make sure the work has been questioned thoroughly, but that doesn't necessarily mean by you.

I agree with this to an extent but I feel you should always ask yourself 'why'. 'why is this feature valuable to the user?', 'why has this functionality been chosen over another?' etc.

At the end of the day the work you are doing has an impact on opportunity cost - if you at least internally question the work you are doing, you can potentially lower the opportunity cost and therefore help the business.

However, if you are part of a team of people who consider these things before the work gets to you, I agree it can be counter-productive to question it.

Re: Ask HN: What are your favorite developer-efficiency tips?

#418
post #360

The things I've benefited from most are not tools but practices. - Question the work Always be questioning whether the thing you're doing really needs to be done. Is there a way to not do it? Is there a way to do something better instead? - Park downhill Before putting a project or incomplete task away, make notes of what the next thing was that you were going to work on. This lets you bypass that 10 minute orientati…

I guess this means "park facing down hill" as opposed to "park down the bottom of the hill" which is what I first thought it meant but doesn't make as much sense. lol

Re: Ask HN: What are your favorite developer-efficiency tips?

#419

Learn to touch-type properly. I'm not a shit hot typist or anything, but it does make hours on a keyboard more pleasant. And (hate me) I do judge other devs on it. If someone can't be bothered to invest a few tens of hours on such a key productivity enhancement then what does that say?

Just as a shameless plug for anyone reading the replies - I'm working on creating a touch typing course for developers here: https://typeright.herokuapp.com. Still lots of work to do (hence the lack of domain name) but I hope to finish it in the next month when I have time. https://typingclub.com is great if you just want to learn to touch-type in natural language but I found it and other courses didn't help my typing skills for coding that much so I'm building one myself.

Re: Ask HN: What are your favorite developer-efficiency tips?

#420

Earlier quoted context omitted.

One of my favorite bash tricks is that I have this alias in my bashrc file: function goto { cd -P ~/.links/"$1"; } And then in the `.links` folder I have symbolic links to directories I need to go to often. Then getting to a frequently used directory is just a `goto X` away.

Cool. How does that compare with setting CDPATH?

I just looked up CDPATH and my understanding is that the difference between the two is that with CDPATH you are setting directories that you can quickly navigate to subdirectories of.

This is more of a quick link to directories themselves.

Maybe you could do something similar to the alias if you had my `~/.links` directory in your CDPATH, but then you'd still need to add the `-P`every time to get it to follow the symbolic link.

Not something I had ever thought of before honestly.

Post reply on HN