5
zemaitis
116d

Question for devs who use Intellij IDEA.

How often do you use livetemplates?

I am a new android dev with ADHD and just discovered live templates. They make my life much easier, for example I have shortcuts for generating recyclerview adapter/viewholder/implementation boilerplate code.

In that way I am able to focus on implementation, and do my coding like building blocks, rather than memorizing every detail of implementation. Also I don't need to go to stackoverflow and copypaste basic things multiple times. Even for example during live coding interview having livetemplates seems awesome, copypasting from stackoverflow would be shameful (I think). Using my own custom shortcuts for livetemplates seems the best way for how my brain functions (I suck at memorizing tiny details, but I remember general idea/flow of a pattern and I would prefer memorizing what to use and when to use, instead of all small details of implementation).

Is getting to dependent on livetemplates a good practice to get used to? Do other developers frown upon a dev who has dozens of livetemplates and relies on them instead of writing all code from memory by hand?

Comments
  • 4
    Writing code from memory by hand is not something a Developer does

    I don't know about live templates but there is no shame in using a few snippets from SO or any other website as long as we know what we do
  • 1
    I use them, they are a nice addition for productivity. Mainly they are useful when writing boilerplate code, if I find myself doing same things over and over on the project I write a live template for it (if it makes sense)

    Yet there is one that rules them all for my work:

    "_todo" template generates "// TODO (my_name) "

    line, I work in a massive code base so having todo's automated is a nice feature.

    I have many more templates and all start with "_" prefix for nice autocomplete
  • 2
    @nemetepst only thing that sucks in intellij idea is that live template's name is case sensitive. for example shortcut "_recView" wouldnt pop up if I searched it with "_recview", so I'm forced to make all shortcuts in lowercase and sometimes its uncomfortable to read them.
  • 1
    I use them occasionally, but my job doesn't include a lot of boilerplate. But I still find them useful as shortcuts for writing something with a lot of annotations or when wanting to automate stuff regarding our coding standards
  • 1
    Actually on top of Live Templates I also recommend the plugin Custom Postfix Templates. This allows you to write custom auto fills for when writing a dot after a variable. That can often save some good time too
  • 1
    @zemaitis Yea I solved this by using "_snake_case" convention for all templates, I like it this way because it intentionally goes against Java conventions. Which means when I search for live templates only they show up.

    Maybe this helps?
  • 1
    @Hazarth That sounds useful, I'll check it out. Thanks for the recommendation :D
  • 0
    I actually have never heard of live templates, so thanks I'm going to go try it
Add Comment