DEV Community

Cover image for Developer Productivity - Dash App
Jacob Landry
Jacob Landry

Posted on

Developer Productivity - Dash App

Greetings! Every developer has his or her own challenges to work through. No developer operates in a complete silo, however we all seem to have different challengers in our day-to-day lives. One, that we all seem to share, however, is productivity.

The problem

I’m not going to quote a bunch of fake statistics here, or try to sound smarter than I am. The fact is, it’s been a minute since I did a lot of research on this topic, but facts are facts.

You can’t instantly sit down a computer and write GOOD code.
Enter fullscreen mode Exit fullscreen mode

Writing good code takes focus, which takes time. Time spent in “code mode” as I like to call it: Similar to God Mode but you clip through fewer walls, unless it’s 2AM and you’ve been hitting the whiskey while you work….
So to reach “code mode” most people need to spend an undetermined amount of time thinking about what they’re working on and getting your brain ready to talk to a computer instead of a human. It’s like the school challenge where your teacher asks you to give them instructions to make a PB&J sandwich. You can’t give them instructions like a human, because they’re being literal and won’t infer anything from their situation. Computers are the same way. They don’t consider their environment or current situation, they simply do as they’re told, so you have to be in the right scheme of mind to converse with them.

Another problem

We’re not perfect. I know YOU are, but the rest of us are not. Remembering things is hard, and every time my kid re-names one of his matchbox cars and insists that I call it that every time I see it, another code snippet that I had saved in memory is lost forever. There’s just simply not enough room in our heads for all of the information we need to live a full and healthy life, and be able to be effective at work. This comes full circle back to time, stay with me; every time I have to stop what I’m working on to look up the order of the parameters for php’s array_search function, or do a quick man-page call for all the flags for docker run, I lose development time. I also risk taking myself out of that “code mode” as I try to read content from other human beings. These slow down the development process, sometimes minimally but sometimes critically.

Yet another problem

Repetition.
Repitition.
Repitition.
It’s a problem.
It’s a problem.
It’s a problem.
On any given day I complete the following tasks:

  • Open Docker Desktop
  • Start my Kubernetes Pods for the project I’m working on
  • Pull any changes in my repository from other devs
  • Check Kubernetes pod health
  • Pull local application logs … And so much more. Each one of these tasks takes time. It may not be much, a second here, two there, but it’s time. Time that could be spent doing something else. We always check our code for these types of repetitions and create a method that we can call so we don’t have to continue to copy and paste code, so why wouldn’t we do the same with our daily actions? Create some sort of method that we can call on to do the task instead of doing it ourselves?

The Solution:

Enter Dash.
Dash for macOS - API Documentation Browser, Snippet Manager - Kapeli
Dash is an amazing tool that provides two major services: Documentation and Snippets.
First off, skip the documentation. It’s slow, and cumbersome, and always perpetually updating. It’s faster to google a function than to use Dash’s documentation function, however it does store the docs for offline use which can be helpful while traveling. But anyway, the snippets are where it’s at.
A snippet has two parts: the code executed, and the shortcut. For example, the code executed can be:

./vendor/bin/sail up
Enter fullscreen mode Exit fullscreen mode

This is a simple command to start Laravel Sail, a docker environment.
The shortcut can be:

sail
Enter fullscreen mode Exit fullscreen mode

After adding this shortcut in dash, I simply have to type “sail” in the terminal and the rest of the code will auto-replace it, allowing me to execute it quickly. Of course, this is a bad example because if you ever talk about sailing or use the word sail, it will auto-replace if you’re not paying attention, so pick your keywords or commands wisely.

This can be incredibly useful, though, in solving the major issues we discussed above.

First

You no longer have to look up commands you need. They can be stored in snippets that are easier to remember. This limits the amount of chances you have to be ripped out of Code Mode.

Second

You don’t have to remember full commands, just the shortcut. Over time, you’ll actually find that you DO remember the most commonly used ones. Even though I never type the full command to check Pod Status on my local machine, I know it by heart because I’ve seen it replaced so many times with this app.

Last

You can execute multiple lines of code with these snippets, chaining together tasks that you would normally do. In the horribly lazy example I provided above, maybe I like to do a git pull first, then start sail. So the snippet becomes:

git pull origin master;
./vendor/bin/sail up
Enter fullscreen mode Exit fullscreen mode

Suddenly both commands are run, we have fresh code and a docker instance to run.!

Pro Tip

OK, one last point before I leave. You can also supply VARIABLES to these snippets. Yes, you heard me right; VARIABLES. Amazing right? No? Hang tight, you’ll see.

git checkout __BRANCH__;
git pull origin __BRANCH__;
./vendor/bin/sail up;
Enter fullscreen mode Exit fullscreen mode

When you type “sail” now, your computer won’t just replace the word with the lines of code, it will ask you for input. It will auto-highlight the first variable, allowing you to input it, then when you hit “enter” will automatically jump to the next, allowing you to customize the snippet for your exact situation.
I know this example is incredibly simple, but I’m sure you’ll find billions of uses for this app in your daily routine.

Happy Coding!

Discussion (0)