11 ms·
Habits I've developed for fast and efficient programming
- davnicwil 5y agoThe dev mode only functionality in an app is a really great one - one thing I like to do is put in keyboard shortcuts to automate filling forms, populating state, doing quick navigations to nested parts of the app, etc.
- rtheunissen 5y agoThis is great. I've found "find file" to be the most useful tool. It's usually one of the first things I point out during live-coding as soon as I see someone click through the source tree.
- jpgvm 5y agoIndeed. IDEA has find by filename, find by class and find in files. Couple this with it's quick file switcher which keeps recent files in a stack allows you to quickly move between files you have recently edited (and jump back from something like "go to definition") really increases speed of code exploration.
- brabel 5y agoYep, anyone still using tabs to navigate between files: stop doing it! Learn to use the recent files switcher plus the general find-file, find-type shortcuts etc. First thing I do on a new installation of IntelliJ or VSCode: remove the stupid tabs. EDIT: emacs doesn't have tabs, obviously as it doesn't need them, but some crazies have been pushing to make the tabs package installed AND active by default so newbies can feel more familiar with it... that's incredibly backwards: newbies should learn to not rely on inferior methods of file navigation and use the appropriate tools for the jobs, as a recent-files-switcher that's present in every editor I know... in emacs do this: (require 'recentf) (recentf-mode 1) and bind `'recentf-open-files` to some shortcut.
- jpgvm 5y agoPretty much 95% of this list is why Kotlin is my primary programming language now. It's more productive because it accomplishes almost everything on this list out of the box on IntelliJ IDEA. The only bits I generally need to add on are some Gradle plugins to handle linting (spotless or kolinter) no-friction Docker images (jib) and overtime amassing a list of very high quality libraries for specific tasks (Clikt for CLIs, Jackson for serialisation, etc). Couple all this together you get incredibly productive out of the box experience that is very easy to onboard new team-members onto. Pairing with this setup is also great, Code With Me is constantly getting better (pairing tool built into IDEA), being able to teach newbies keyboard shortcuts in IDEA to make them more productive etc. I think the latter stuff is probably more important to me now as I mostly take on lead roles, my own productivity has always been high but being able to make that more scalable has been immensely more valuable.
- skohan 5y agoThe thing I’m not a huge fan of with the IntelliJ model is that it’s super tooling-dependent. I would rather work with a set of loosely-coupled tools and automate my own workflows.
- jpgvm 5y agoTo be honest I used to be the same way. Used desktop linux (gentoo then arch), tiling wm (xmonad), 3k line vimrc with every plugin you could want, tons of scripts to automate gdb/valgrind/etc. Then something happened, I'm not sure what. Maybe I just got old but I no longer derived value from it being -my- setup. I just wanted whatever got the job done most efficiently. These days I'm ultra boring. I run macOS everywhere, I still use zsh and a fairly pimped shell, but minimal vimrc and IDEA has replaced the vast majority of my dev environment. It doesn't have any of the personality it once did and tbh that doesn't bother me in the slightest.
- skohan 5y agoYeah it’s not so much about being my setup, I think its more that I’ve gotten used to working this way and I don’t want to learn a whole big tool which might not do exactly what I want. With most of my projects, I have a couple of scripts to take care of the tasks relevant to that project. When I start something new, I just copy them over from a similar project and edit where needed. Super light weight, and basically will work until the end of time. For work sometimes I need to adopt someone’s highly tooled workflow, and then you have to get the editor license, find the right plugins, make sure you’re on the same version and so on. And sometimes you dust off an old project and something broke in this big magical dependency chain and you have to do surgery to figure out what it is.
- nefitty 5y agoHave you added copilot to your workflow?
- sAbakumoff 5y agoAlternative title: Habits I've developed for fast and efficient rat race.
- the_gipsy 5y agoIt takes off a lot of frustration of the rat race. You can focus and what you actually want to get done. You may then chose to spend your time on more ratracing, or doing other stuff.
- obedm 5y agoIt's perfectly fine to enjoy a day job. I truly love mine. I enjoy working at it, and I enjoy the freedom it gives me to do other stuff after work. I enjoy the monetary reward but also the act of solving hard problems every day.
- the_gipsy 5y ago> It's perfectly fine to enjoy a day job. It is perfectly fine.
- obedm 5y agoIsn't everything a rat race if you boil it down enough? Working for yourself? Rat race Working for others? Rat race The human reward system works in a way that doing something repetitive, that is just novel enough and just challenging enough makes us feel great. There's no such thing as a non rate-race life. The point is enjoying it. Otherwise you end up feeling dread and existential anxiety. Life is meaningless, and at the same it's meaningful. It truly depends on your perspective, and a bit of self delusion.
- sAbakumoff 5y ago>> There's no such thing as a non rate-race life. There is. If you never met a Buddhist monk, I highly recommend to.
- blocked_again 5y agoPretty much agree about everything except copilot. Short term gains using copilot is good but long term it will make your brain inferior since you are by default searching for an autocomplete response from copilot. Your brain is literally an autocompleter. You are getting paid a lot because you are are very good at it. Loosing that edge by relying on an AI to do that for you and not practising your skill would make you worthless in long term.
- pieix 5y agoThis sentiment echoes Socrates' famous position regarding the written word: >If men learn this, it will implant forgetfulness in their souls. They will cease to exercise memory because they rely on that which is written, calling things to remembrance no longer from within themselves, but by means of external marks. Both his point about writing and your point about Copilot are likely true in part or in whole. Ultimately it doesn't matter — the technology is here to stay and its adoption will be determined by the utility it provides its user.
- blocked_again 5y agoI don't know. Remebering is one thing. Making Mircosoft do the thinking for you is another thing. Both are diffrent.
- pdimitar 5y agoI have respect for Socrates but this was not one of his good quotes. It reeks of "get off my lawn", very strongly. Many studies show writing things down (on a paper medium, not phones or any electronics however) is very helpful for gaining focus and regaining productivity. We're not storage media; our brains are immensely creative machines but our memory preservation is inferior so we found a good workaround.
- Nowado 5y agoI too avoid using Google services not to dull my internal something.
- jstummbillig 5y ago
- smackeyacky 5y agoLearning to type is easily his best suggestion here. Not just type, but touch type including the symbols. If you ever wondered why vi is modal and uses normal keys for navigation rather than cursor keys you won't wonder any more after you learn to touch type. It doesn't require that much practise either, a month of solid practise, 30 minutes a day will get you over the hump easily. I would recommend getting a full size keyboard for this instead of the cramped, flat garbage of a laptop. Decent keyboards can be had at charity shops for a dollar.
- maxekman 5y agoSwitching to Dvorak on a Qwerty layout is really effective. It’s way more punishing to look down at the wrong keys than to not look down. Not for the impatient though!
- HowardStark 5y agoCannot agree with this enough. All the dumb keyboard layout cargo culting aside, this is why I recommend people learn Dvorak. It has been hugely successful for everyone I’ve gotten to make the transition.
- notapenny 5y agoKeybr.com is great for this. I've been touch typing all my life, but when I started programming, I noticed that typing brackets, parens and a bunch of other symbols really slowed me down. Great to practice those as well.
- skohan 5y agoVi uses normal keys rather than cursor keys because the keyboard it was developed on had arrows printed on those keys, and no cursor keys. People continually want to attribute this to some rational design consideration, but it’s just post-hoc reasoning. If vin were authored 10 years later it would use arrow keys and there’s no reason to stick with this terrible UX.
- _dain_ 5y ago
- miccah 5y ago+1 for zsh-autosuggestions. It is the most important plugin I use because all I have to do is remember the first 2 characters of a command to get the suggestion and autofill it on the command line. It saves so much time and frees up space in my head for more important things to remember.
- agd 5y agoOne of the best changes in the last ten years (imo) has been the widespread adoption of code formatters. Particularly those officially supported by the language. It makes reading easier and writing faster. And no more time wasted on pointless formatting debates.
- agumonkey 5y agoI can't fathom how many companies filled people's brain with stuff like that. "good practice"
- skohan 5y agoOof yes I remember the first time I joined a dev team with pedantic tastes in terms of code review. It’s amazing to imagine the amount of collective time which has been wasted on trivialities over the years.
- judofyr 5y agoI like (and actively use) code formatters, but honestly I don't understand why people make such a big fuss about its impact. Weirdly formatted code impacts maybe 1% of my "reading code"-ability — at least after I accept "this is a bit messy" and stop being irrationally annoyed. > And no more time wasted on pointless formatting debates. There will always be pointless debates: Naming variables, deciding which linters to enable, using reduce() vs. a loop, classes vs functions and so on. This is a cultural problem which occur because you're not focusing enough on the things that actually matter ("is the code correct?"; "can we safely ship this to production?"; "what's the long-term effect of introducing this abstraction/feature/capability?"). I love thinking about code as art, and I have numerous side projects which explores this, but when it comes to shipping real features on a deadline we need to create something which works, not something which evokes a good feeling inside me when reading the code.
- pdimitar 5y ago> I don't understand why people make such a big fuss about its impact I don't know, ask them? We here are on board with using them. ;) I've met such problematic people. You can't reason with them, it's almost a religion. But when you sell standardized tooling to your manager plus emphasize how this will reduce internal team friction, you can elegantly eliminate them from the equation. I did it before and I plan on doing it again. We are here to write code and be productive, not to discuss aesthetics.
- RedShift1 5y agoI would add 2 things: 1) use libraries that are stable and well documented, 2) use things that work well out-of-the-box. For 2 I'd like to give you the example of Grafana. To get it up and running all you have to do is install an RPM and start the service. That's it, you can immediately start playing around with the software. The out-of-the-box configuration is fine for 90% of the use cases. Upgrades are equally smooth as well, everything is done for you. Just install the newer version and restart the service. Database is upgraded automatically. By default an SQLite database is used to store everything, but if for some reason that becomes a bottleneck you can upgrade to MySQL, at which point also some more advanced skills are needed. But that's kind of the point I'm trying to make, it works well OOTB but can be tailored to fit outside of its default configuration. I've grown to loathe software where much manual setup is needed. Creating databases, importing the schema and bootstrap data, going over a myriad of configuration options because the defaults don't work OOTB, having to configure things that could easily be auto detected by code, requiring dependencies that are not available on your distro, moving files around and setting permissions yourself... All feels needlessly complex, isn't the computer supposed to work _for me_? Over time I've started to feel that the OOTB experience is directly proportional to the quality of the software. Using tools that just straight up work and drop those that require intensive tinkering to get going has definitely improved my work experience.
- skohan 5y agoYeah I am also a big fan of using things as close to the default as possible. Highly customizable tools are great, but often I feel it’s a better time investment to learn how to use the standard configuration well. Then any thine you sit down in an unfamiliar dev environment you will generally be able to get up and running quickly without having to remember all the things you had to do to set up your tools.
- gjvc 5y agoUse the IDE as a structural editor, not a glorified text painter.
- ArchieMaclean 5y ago> In weakly typed languages like TypeScript I guess you mean JavaScript? In regards to speed, I really really recommend Vim. Macros are sorely missing in a lot of editors, and they are really a great way to skip a huge amount of repetitive work.
- cdrini 5y agoCan you give some examples of what you use macros for? I've found I don't need macros in an editor that supports (1) multiple cursors, and (2) multi-file find/replace with regex groups.
- ArchieMaclean 5y agoNow that I think about it, I'm not sure I can come up with any non-contrived example (maybe this [1]). I guess what's good is that it fits right into the rest of Vim very nicely, so I can just edit like normal, instead of fiddling with regexes. [1] https://youtube.com/watch?v=FXCitlsA7eQ https://youtube.com/watch?v=FXCitlsA7eQ
- cdrini 5y agoWhat a fun example! That's exactly the sort of stuff I use multiple cursors/regex for. Due to a bit of luck (the refs only appear once, and only appear in order of mention), that specific example ends up being quite a bit easier and faster with multiple cursors (and I believe his example also relies on that). For the more general case, multiple cursors wouldn't cut it though, so I'd have to jump out and use code. And multiple cursors definitely wouldn't scale to multiple docs! For fun, I did that same example with multiple cursors + vs code: https://www.youtube.com/watch?v=H1uvNbtqJGk https://www.youtube.com/watch?v=H1uvNbtqJGk
- brabel 5y agoWhat kind of editor/IDE made for programming is missing macros?? Must be a really shitty one if it can't even do that.
- xixixao 5y ago> Using code auto-formatters I took, and still sometimes take, a part in discussions of adapting or improving autoformatting for some language we use. It is incredible to think about programmers who have/will grow up entirely with autoformatters in all their tools. To them, the idea of manually formatting their code will seem as “ancient” and “backwards” as assembly programming feels to me. That’s a hallmark of true technological progress right there.
- gugagore 5y agoThis has been said countless times before, but it's a real shame we don't have yet have good solutions for separating content and presentation of code.
- mhd 5y agoIs this (especially the last sentence) meant sarcastically?
- xixixao 5y agoNo, I’m dead serious. Sure, the magnitude of progress is not as big as say moving from horses to cars, but it is similar in how people perceive the new vs the old.
- mhd 5y agoInteresting. Personally I didn't see many changes. We had indent before, now it's more common, mostly because of git diffs, and of course some languages got more B&D by design. But I wouldn't say that there have been huge benefits. Heck, if we're talking language-based tooling, I'd rate the influence of JavaDoc higher.
- cryptica 5y agoThese days, articles on the subject of programming productivity are extremely hit and miss. Some articles, I agree with almost everything the author says and others like this one, I just feel 'meh' because everything mentioned seems unimportant to me. These things do add some value yes, but why aren't critical things related to system architecture, high cohesion + loose coupling, keeping interfaces simple and keeping the code closely aligned with the business domain mentioned? The costs of getting these things wrong compounds over time; that's why they're orders of magnitude more important than fast typing and auto-completion. If I had to guess the author's background, based on the article, I would assume that he/she has a corporate background and very little experience building systems from scratch end-to-end. It's only when you start building systems from scratch 'end-to-end' that you actually learn what is important in programming. Sadly, developers typically cannot get this experience while working for a corporation. Most corporations are too compartmentalized to allow individual employees to see how everything fits together into the big picture of software development. Unfortunately, because of their high profile, corporate developers get a lot more attention in the industry even though they often have tunnel vision.
- brabel 5y agoIf you don't even know the basics, why do you think you can talk about more advanced things? First, learn the basics of the trade: reading and writing code efficiently and painlessly... then you can think about high level architecture or whatever makes you feel more important. I see a lot of people who think they know the former but they can't even find a definition without clicking through some GUI menus, which takes 10x more time than if they'd just learned a couple of shortcuts. This is what is really going to compound over time, as you do this hundreds of times a day. Besides, the author addressed your criticism in the second paragraph: _There's a lot more than just writing code that goes into being an effective software developer..._
- cryptica 5y agoSure, nothing against this perspective and glad that this line was mentioned. My main point is that this kind of article doesn't deserve to be front page HN since it mostly distracts people away from more important things. I find these 'productivity porn' articles to be overly superficial and limiting to the true progress of developers... I miss articles like those written by Martin Fowler, Alan Kay and others which tried to tackle the big problems. I feel that a lot of valuable programming knowledge from the past is being swept under the rug. The software industry seems to be getting dumbed down over the past decade.
- IshKebab 5y agoThis is a great list! Unfortunately I find a lot of developers are very stuck-in-the-mud about a lot of these things. For example using type hints in JavaScript / Python, ensuring your build system doesn't break IDE features, keeping compile times low, etc. I've found it really hard to persuade some people that these things are really critical, even though it seems almost so obvious that it's hard to know how to explain it. Like, how would you persuade someone that they should comment their code.. or use descriptive variable names?
- kstenerud 5y agoSome more: Have a deterministic work environment that can be set up and torn down in a single command. Use standard names in build tool configurations (buildtool clean, buildtool lint, buildtool build, buildtool test, buildtool run, etc). Set up your project such that there are only 6 steps to getting everything working: - Commands to download - Commands to install required support items that can't be automated - Single command to install everything that's needed in the right places / start your deterministic work env - Single command to build the project - Single command to run the tests - Single command to run the live app Default to running all of one thing, with options to run a subset (i.e. run ALL tests if not specified otherwise). Be an adequate typist (40wpm or so). If you're doing software development right you'll be spending around 10% of your development time typing, so after a point typing speed won't help you anymore. Know how to use your debugger. There are some problems that are simply easier to solve with a debugger than by other means. Know when to use what debugging technique. Set things up such that everything gets autoformatted automatically.
- Noumenon72 5y agoI am doing all of these things and totally agree, so maybe my top habit will appeal to you too. It's using the number keys to switch between apps. I don't waste time Cmd-Tabbing around between PyCharm, Terminal, Chrome, Slack, and Sublime Text; I just tap Opt+1, 5, 2, 8, 9. Basically as soon as I've thought of what program I want to be in, I am in it. You may switch among your top ten apps hundreds of times a day; this will be your most used shortcut. On Windows this is built in: Win+1 switches to the first app on the taskbar. On Mac I use Snap -- https://apps.apple.com/us/app/snap/id418073146?mt=12 https://apps.apple.com/us/app/snap/id418073146?mt=12.
- Ameo 5y agoThat's really good - I'm going to have to try this! Thanks
- albertzeyer 5y agoI think hot code reloading can be very effective. This extremely reduces the feedback loop, which can be very important for productivity. Unfortunately, I rarely was able to make this work in my setups, except long time ago when I used Visual Basic. Then I worked with C++, mostly game development using SDL. The last couple of years I wrote Python, mostly for machine learning with Theano and then TensorFlow. The startup time of an initial prototype might still be fast enough (couple of seconds) that you don't care too much and you are still productive. But as complexity adds up, and you add other slowdowns like slow NFS or whatever, this can reach minutes, and this already is annoying. But most development I do would probably not really allow for hot reloading, or I don't really know a good way. This is anyway not really common practice for Python, and whatever you try in that direction will probably be unstable and/or non-Pythonic. And then, you have deep learning research itself, where your feedback loop is at minimum one day, but often more like a week. I remember that I saw screencast of notch developing on some games, where he intensively used hot code reloading on some functions which defined the behavior or look of some game entities. This looked like an extremely productive and powerful tool. Just within half a second or so, he saw the result of his code change. He just played a lot around until the behavior was nice.
- dr_kiszonka 5y agoThe two largest productivity boosters for me this year were maintaining a code snippets library (I use obsidian for this) and a tools file that I import into most of my projects; the file includes functions that I use frequently, eg. conversions between various date time formats, etc.
- FractalHQ 5y agoI’d like to add Fig terminal to this list. It offers autocomplete with hovering documentation to explain what flags do. It will even search npm and autocomplete package names for you.