The Ultimate Sith Lord Developer Guide
“Evil is a word used by the ignorant and the weak. The Dark Side is about survival. It’s about unleashing your inner power. It glorifies the strength of the individual.”
Drew Karpyshyn, Darth Bane: Rule of Two – Star Wars
The path to becoming a Sith Lord is a treacherous one. Many inadvertently fall into this path, but very few reach the summit.
As a true Sith Lord, employers respect you for being the only one who can maintain the project. Code reviewers thank you for the constant challenges. Project managers love you for your speed.
Sometimes junior developers do better on this path than many Sith Lords, but most ultimately fail down the line.
Are you ready to follow this path? Let’s get started.
Note: The examples here are what I have seen developers use in real projects, seriously.
Your new naming arsenal
Single-letter variables
A true Sith Lord developer displays their efficacy by keeping things short. Take this example:
function mul(a,b) {
let p = 0;
for(let i = 0; i < b; i++) {
p += a;
}
return p;
}
Yes, this is a simple multiplying function, and you may even argue why there is a need for it. But this is exactly why you have much to learn.
A prodigy at this point will look at the code and quickly find that more enhancements can be made. For example, why use the conventional loop counter name i
? We can test the code reviewer’s attention more effectively by using i
and j
as parameter names and a
as the loop counter. If you have reached this conclusion, you’re on the right path.
Abstract names
Your arsenal is not limited to single-letter variables. Unpredictability and inconsistency are inherent traits of a Sith Lord’s code.
- Use the most general word to describe what you’re dealing with. The best one for variables is
val
. For functions,func
. Other good ones aredata
anditem
. Who knows what they mean? Well, it’s now the others’ job to know that. - But wait, what if you’re running out of these awesome names? Fear not, apprentice. Add another arbitrary symbol to the name.
val2
,_val
or even__val__
. Bonus points if you use them together like so:
const val2 = ...;
const _val = ...;
const __val = ...;
Subtle changes
Show off your extensive vocabulary by making subtle, but arbitrary changes throughout your code.
For example, handling a submission? Use onSubmit
in some instances, then onSend
in others. Mix and match with also handleSubmit
and handleSend
. Someone reading your code might be confused by these subtle changes, thinking that there is an ulterior motive, but little do they know you just want to show your vocabulary prowess.
Another example could be using the amazing abstract names outlined above. Use displayFunc
for a certain function, and then displayFun
for doing a prank.
Hardcoding
The next step in becoming a Sith Lord Developer is to master the art of hardcoding. This is especially effective if another peasant developer has already written a nice little config file with all the constants.
Here’s an example of how to use secrets as a Sith Lord Developer:
fetch(`https://api.example.com?apikey=1234567890`);
Were you expecting something like this? If so, I’m proud of you.
Here’s an example of when you have a config file in that project:
// Somewhere in the root of the directory, a file called config.js
const config = {
apiKey: process.env.API_KEY,
apiUrl: "https://api.example.com"
};
// ... inside of the source
fetch(`https://api.example.com?apikey=1234`);
Just a little show of power like this from a Sith Lord developer renders all the work from the other poor developer useless. And it’s all their fault. This is because the config file cannot be trusted as the single source of truth anymore.
Your updated function guide
Side effects
As a true colleague and Sith Lord Developer, you want to make sure your fellow teammates are paying attention.
One way to achieve this is to use functions with side effects. For example, let’s take a function logResult
.
function logResult(a, b) {
let result = a + b;
console.log(result);
// Don't forget to send an email to your boss
email.send("result: " + result);
}
This is extra effective as your boss will be nagging your team (and with good reason) while you can laugh like a true Sith Lord in the background.
Return types
Who needs clear return types when you can return anything you want? This will ensure that your fellow developers never know what to expect and that they’re constantly surprised by the results. For example:
function multiply(a, b) {
if (typeof a === "number" && typeof b === "number") {
return a * b;
} else {
return "I'm feeling lucky";
}
}
A developer who comes across your code knows they’re in for a rollercoaster ride. They know they are dealing with a Sith Lord’s code.
Unnecessary complexities
Function generators
You have all this coding knowledge, and here you are changing colors and fixing styling bugs for IE9. As a Sith Lord developer, this is a no-go. Show that you are superior to others, and with that, promotions will come… Maybe.
Function generators are a great way to achieve just that. They allow you to create functions that can be paused and resumed, which is rarely needed in most applications. But not in yours. For example:
function* generateId() {
let number = 0;
while (true) {
yield number;
number++;
}
}
const numbers = generateId();
console.log(numbers.next().value); // 0
console.log(numbers.next().value); // 1
console.log(numbers.next().value); // 2
This code generates an infinite sequence of numbers every time you call it, which is sure to impress your peers.
Immediately Invoked Functions
Another way to express your aptitude is to use immediately invoked functions whenever you can. For example:
(() => {
console.log("Hello, world!");
})();
(() => {
console.log("Goodbye, nerds!");
})();
And if someone asks, here’s what you do:
Your fellow developers: “So… why are you wrapping this in an IIFE?”
You: 😂 (walks away)
Laughing is the only option here, as they clearly don’t get the big picture.
TypeScript
Finally, let’s talk about TypeScript. If you’ve been paying attention at all, you know that TypeScript is for people with no life, who instead of writing code, spend their time writing about their code. But fear not, you are here to show them how it’s done.
Using any
Type
This is a given. Make sure you use the any
type wherever you can. This will get you to where you thrive best: chaos.
function add(x: any, y: any): any {
return x + y;
}
const result = add("2", 3);
console.log(result); // "23"
Perfect.
Bringing it up at the next meeting
Why use TypeScript at all? In the next meeting, suggest migrating from TypeScript to JavaScript. Sure, you might get fired, but just imagine your project without TypeScript. The possibilities are endless. In all honesty, I believe this is the best course of action.
Conclusion
In the end, you realize you stand at the peak of the dark side, and no one else will be able to read your code or maintain it. With this, you have become a certified Sith Lord Developer and you will be able to maintain your job for as long as you want in a project, as only you will know how to work on it.
By the way, this is the first post of this type that I’ve written, and I had a blast writing it. Let me know if you enjoy this type of content!
P.S.: This post was naturally a satirical article and should be read purely for entertainment purposes.
Awesome. And too many times seen in real world.. hell, it looks like my team member is a sith lord. Blinded by dedlines i have been. For recognise i could not..