The First C# Code Snippets You Should Memorize (Visual Studio Code)

The First C# Code Snippets You Should Memorize (Visual Studio Code)

Code snippets are pre-written portions of code that you can summon with just a few keypresses. By automatically setting up much of the syntax required in common programming language structures, snippets speed up the mundane parts of coding.

Depending on the size of its content, a particular code snippet will save you anything from the small handful of keypresses it takes to set up the curly brackets of an if statement to the several lines of code it takes to write the skeleton of an entire class or method.

Plus, they are just plain fun to use. Look at all the code that I get “for free” here:

Read More Read More

Taming Repetitive & Hard-to-Remember Console Commands

Taming Repetitive & Hard-to-Remember Console Commands

Or, “How to Quell Your Complicated and Repetitive Command-Line Actions with Easy Aliases and Short Shell Scripts”, if you like long titles.

Sometimes I feel as if I end up typing a single handful of command-line commands over and over again all day. That’s a bit of an exaggeration, but I do spend a goodly amount of my day at the command line. As part of my workflow, I always have at least three terminal windows open in order to run the various portions of whatever web app I have my hands on:

  • One terminal running the front-end web server
  • Another running the back-end service,
  • And a third running a database inside of a Docker vm.

My little story about forgetfulness

The front-end and back-end processes can be launched once and left running for most of the day without any extra intervention. The Docker container running the database, on the other hand, needs to be stopped and re-started every time I or a coworker alters the format of the project’s database. If I don’t re-start the container, then I won’t see the changes that were made to the database.

Read More Read More

Debugging with Deftness in Visual Studio Code

Debugging with Deftness in Visual Studio Code

Here’s a short list of keyboard shortcuts for debugging in Visual Studio Code. Right now, I don’t do a good job using many of these myself, but by writing them down for you I’m reminding myself to integrate them into my workflow. These hotkeys won’t shave hours off of your debugging sessions, but they may make the experience more enjoyable.

Inserting Print Statements

Sometimes all you really need in order to discover what your code is doing wrong is a simple print statement in the middle of a complex set of operations.

Read More Read More

Should You Learn a Powerful Editor like Vim or Emacs?

Should You Learn a Powerful Editor like Vim or Emacs?

You’ve probably heard of them. They’re the text editors that real programmers use. The powerful tools that will boost your productivity into outer space if you can ever master them.

I’m talking about Emacs and Vim.

Perhaps that isn’t the way you’ve seen these two text editors presented, but when I first heard about them, I had this perception that I absolutely had to use them if I wanted to be a cool and competent programmer. They were said to have a huge learning curve yet to offer equivalently incredible editing power. I had to learn how to use at least one of them!

So are these editors worth the learning investment they present?

Read More Read More

Visual Studio Code Gets a Faster Terminal

Visual Studio Code Gets a Faster Terminal

The new version of Visual Studio Code from September’s development cycle is out now. The ample list of improvements, which includes macOS touchbar integration, regular expression highlighting, and a smarter process for extracting methods, also includes a behind-the-scenes overhaul of the integrated terminal renderer. The update claims to improve performance of the integrated terminal by 5 to 45 times over the previous version and abolishes forced frame skipping. Admittedly, I hadn’t noticed any issues or slowdown myself. But, as the update states, the newer renderer will at the very least be lighter on your laptop’s battery.

The VS Code team accomplished the performance improvements by migrating away from a memory-intensive DOM design to a single HTML Canvas element. Apparently, the old design invoked a sizable amount of garbage collection due to the number of elements being managed by the layout engine, while the new approach allows for more direct drawing via the one canvas element. Additionally, instead of re-drawing the terminal in its entirety after every change, the new renderer only draws the areas that have changed between frames.

More details can be found in the official update.

Speedy Project Navigation in Visual Studio Code

Speedy Project Navigation in Visual Studio Code

Writing code faster involves more than quick typing and editing. Programming projects often span tens or even hundreds of source code files. It’s easy to waste time browsing around in the project directory for the specific file you’re after, so it’s worth learning a few shortcuts that will grease the transition from one area of the project to another.

Thankfully, editors and IDEs like Visual Studio Code come with all sorts of niceties to help you manage the complexity of dealing with a large codebase. Here is a shortlist of the shortcuts that will shorten your programming the most.

Read More Read More

Should You Ever Use the Mouse When Programming?

Should You Ever Use the Mouse When Programming?

If you are a nerd like me and read lots of articles about keyboard shortcuts, you’ve probably come across the notion that you would ultimately be a better developer if you never touched your mouse but instead operated your computer solely with the keyboard. It’s sometimes touted as a Holy Grail of efficiency and productivity, and it presents a plausible argument. Namely, that it takes time to move your hands from the keyboard to the mouse and back again. Often, it is quicker simply to fire off a relevant key combination than to reach for the mouse, move it into position, click the button, then put your hands back on the keyboard. I can think of several scenarios where this is the case. Shortcuts such as saving a file with Ctrl-S, copying and pasting text with Ctrl-C/Ctrl-V, and launching programs via Spotlight or the Start Menu are excellent alternatives to mousing around. But is it really practical to steer clear of the mouse completely?

Read More Read More

Touch Typing Resources for Programmers

Touch Typing Resources for Programmers

My Dad was a carpenter for several years. He worked in the remodeling business, erecting walls, covering roofs, hanging drywall, installing doors, painting rooms and the like. He used to tell me that having the right tools for the job could make the difference between a building project that comes together smoothly and one that comes to completion only with lots of work and not a little frustration. He had loads of neat tools, too. Different saws for different types of cuts, special pliers for hard-to-reach areas, different drill bits for different materials, fancy air-powered nailguns for pinning boards together, and of course all manner of screwdrivers and wrenches.

But do you know what? Even with all of the fancy electric, air-powered, and specialty tools, my dad is excellent at swinging a hammer.

I can remember him giving me a hammer, a handful of nails, and an old board as a kid. It was hard to hit the nails just right so that they went straight into the wood instead of bending over. Plus, I had to hit each nail dozens of times to drive it completely into the wood.

My dad, on the other hand, could drive nail after nail with maybe two or three hammer strokes each. They almost always went straight in, and he rarely ever hit his thumb the way I always seemed to do.

There was something special about watching him use such a simple tool with masterful ease.

As silly as it might sound, I look at a programmer’s keyboard as the equivalent of a builder’s hammer. While just about anyone can manage to drive a nail into a board given a few minutes time and spare nail or two, the builder can do it effortlessly in seconds — and he will barely have to think about it.

So too, almost anyone can type with a keyboard. Computers have been around long enough that my whole generation has grown up learning to type. But that doesn’t mean you are automatically good at it.

Read More Read More

Why Write Code Faster?

Why Write Code Faster?

I don’t think anyone would object to being able to write code faster, but is text-editing really worth its own blog? I think it is.

Before I talk about why I’m interested in writing a blog about the merits of keyboard shortcuts and typing skills, let me try to convince you that text-editing is something you should care about.

I’m going to assume two things about you: First, I’ll assume that you either are a programmer or want to become one. Second, I’ll assume that you genuinely care about becoming the best programmer you can be.

Read More Read More

I Love Instructions

I Love Instructions

I’ve always been an instruction-follower.

I never questioned the adage that “the people who made it know the best way to use it,” so I of course read the instructions to every birthday toy, school assignment, and LEGO kit I owned while growing up. As a kid, my favorite websites were always the ones full of “how-to” and “do-it-yourself” articles.

Good instructions made me feel as if I could do anything. Sure, I didn’t know how to build a computer a few years ago, but with articles from How-To Geek and Tom’s Hardware at my side, I could learn which parts to look for and how to assemble them. Yes, I had no idea how to program a computer when I was a twelve-year-old, but with the DarkBASIC programming language manual in hand I could learn to get input from the keyboard, draw shapes on the screen, and make decisions based on variables. Sure, I didn’t know how to drive a car when I was 15, but with a driver’s handbook in front of me, I could learn all the laws and techniques I needed in order to pass a road test. You get the idea.

My point is this: Having actual step-by-step guides to follow enables you to confidently try new things.

Read More Read More