The software engineer's katana
09 Jan 2023A software engineer is to his editor as a Samurai is to his sword
Who says I can’t make analogies from the software engineer to the legendary Japanese warrior?
Nobody!
Alright I admit maybe it’s a stretch, but without a doubt there are similarities of the warrior wielding his sword to fulfill his purpose to a software engineer using his editor to fulfill his or hers.
Yes, that’s right. I’m talking about the code editor, the thing the software engineer uses to write software. If you’re wondering the difference between other terms for this type of tool such as text editor, integrated development environment, source code editor and debugger fear not as you’re not alone and many of these terms are often thrown around recklessly.
At the simplest form a software engineer writes code with a keyboard just like a primary school student may write an essay with a word processor like Google Docs. In fact, there’s nothing stopping a software engineer from writing code in a barebones text editor such as TextEdit for Mac. Some folks even do! However they’d be missing out of the more powerful features that could be harnessed by more sophisticated tools. This is where code editors (or source-code editors) come into play. These tools such as Emacs, Sublime Text, and TextMate make writing code easier by utilizing some of the following tricks to make the life of a software engineer easier…
1. Syntax Highlighting
The text in code isn’t as free flowing as text you may see from reading a novel or essay. Rather, text from code is often dictated by keywords that have special symbols that have special meanings. Take the following example from my most recent project…
for (let i = 0; i < formattedOptions.length; i++) {
await client.reactions.add({
channel,
name: REACTION_NAMES[i],
timestamp: ts,
});
}
As you can see here, some of the keywords are a different color as they have special meaning in the code. In this case for
, let
and await
are all keyboards that the programming language treats differently from other words. These keywords are reserved and the syntax highlighting makes it easier on the eyes to identify them.
2. Code completion
Let’s say I declare a variable in my code…
const name = "Adriel";
I’ve declared a variable called name
to be "Adriel"
. Similar to keywords described above, now name
has a special reserved purpose since every time I refer to it I know it has the value
Adriel. What would be very nice is if my code editor would autocomplete this variable for me as I start typing. That’s an example of what code completion does. So the next time I start typing na...
then the code editor will suggest name
to be and I can easily select that value with the tab key as I’m typing. This greatly reduces the change that I’ll make a typo while referencing a variable or a keyword for that matter.
3. Code search
Searching for text is a very common editing code or even browsing a web page. We all know the drill. Use your keyboard shortcut to start the search and get a list of places where the code is being used. However, code search within a code editor can be more fine tuned and specific to make sure you’re getting exactly what you’re searching for. For example, you may be searching for something that is case sensitive, a word isolated on its own, or for a specific piece of code only showing up in specific file types. With a code editor you can specify which file types to include your search and which file types to exclude. If you found the piece of code or exported function used across apps and how to change it that brings me to my next powerful tool…
4. Refactoring
Say you found the exported function that you were looking for, now it’s time to change the name of it. You could do a find and replace from the old string to the new string… but that could have negative side effects if you have another exported function in some other file with the same name. Instead, do a refactor to ensure that only the correct function is renamed and the other unrelated one remains the same.
What about Integrated Development Environments? How do they fit in?
Integrated Development Environments (IDE’s) such as JetBrain’s Webstorm, IntelliJ are also very powerful tools to write code and generally go above and beyond text editors and code editors combined with the services it offers. It offers built in tools such as debuggers so a user can step through they’re code while executing and version control integrations so the developer can easily reference the cloud hosted source of the code repository on platforms like Github. While these tools are powerful and useful, they can be expensive, resource intensive, and can pose a steep learning curve. Those that seek a free, delightful, incredibly flexible platform to develop code may benefit from using my favorite and very popular coding tool…
Visual Studio Code
Developed by Microsoft in 2015, this free code editor offers it all. While technically not an IDE, it can pretty much offer all an IDE has to offer since it has an extensive marketplace of addons called extensions. So if you download Visual Studio Code on its own, you will have what is very close to a barebones text editor, but if you take advantage of all the incredibly useful extensions that Visual Studio Code has to offer, you have access to all the tools you need to build great software with ease!