DevChat #2: Piracy, corporations, and pretty JavaScript strings
Published: 2021-02-16 18:20:46

## We've made it to number two!

*This is an archive of a DevChat newsletter, a weekly dive into gamedev, webdev, and entrepreneurship by Adam Coster (CTO of [Butterscotch Shenanigans](https://www.bscotch.net/about)). To get the next one early, and in your inbox, [sign up](/telegrams?subscribe=dev)!*

Two weeks, two consecutive editions. I did it. Though I made that promise in the first one, so I guess it's only been one week. Still. I'm sure you're impressed.

Though you did sign up for this newsletter (otherwise you wouldn't be getting it), here's a quick reminder of what it's all about: The Dev Chat is a weekly newsletter assembled by yours truly (Adam Coster, CTO & webslinger at Butterscotch Shenanigans). It's an evolving thing, but the goal is to get deeper into stuff than we do in our [podcast](https://bscotch.net/podcast) and [regular blog](https://bscotch.net/blog). The last one is [up on our site](https://beta.bscotch.net/post/devchat-1?topics=devchat) if you missed it.

Let's get into it, shall we? Topics of the week:

- **Piracy**. Scary!
- GameStop short squeeze
- The legal lifecycle of a company
- String beautification in JavaScript and Typescript
- New blog incoming

## BUSINESS

### Piracy: Does it matter?

Last Monday I looked over my ever-growing list of article topics, and the one on piracy got my mind going. I sat down after work to write an outline, and ended up writing the whole thing instead. I pitched it to GamesIndustry.biz, they picked it up, and on Thursday it was the top feature on their site! So that was neat.

Piracy is something that every maker of digital goods has to deal with. For our studio, in the beginning we let the emotional impact of people stealing our stuff take the reigns. But we should have, and now do, treated piracy as a business problem. For business problems you always have to ask, "What's the cost?" In the article I dig into how you would evaluate that, and if and when piracy will matter to you. Read the whole article on [our dev blog](https://beta.bscotch.net/post/does-piracy-matter?topics=devchat) or [on GamesIndustry](https://www.gamesindustry.biz/articles/2021-01-27-piracy-does-it-matter).

### GameStop: Feeling the squeeze

If you looked at pretty much any source of news (or news-shaped information) last week, you saw that GameStop stock prices were a big deal. Why? Well, I'm not a finance guru so I'll let other people explain it. [Cory Doctorow](https://pluralistic.net/2021/01/28/payment-for-order-flow/#wallstreetbets) had one of the best explanations I read, and in our upcoming podcast episode Seth gets into the guts of it (out Wednesday, [go subscribe](https://bscotch.net/podcast)). Before starting our studio, Seth became a Certified Financial Analyst, so he knows what he's talking about.

The most important things to remember for your own investing:

+ Don't try to time the market. It's only possible if you're cheating, and cheating is illegal unless you're rich.
+ Your investments should be boring.
+ Never short sell a stock. Ever. Under any circumstances.

### Healthy business partnerships

Speaking of stocks and corporations, we revisited our studio's Buy-Sell agreement last week. Doing so reminded me of the trap we've seen so many people fall into: starting a business venture without the partners having agreed on explicit terms. People avoid doing so because it feels dirty, or because it's a legal thing and they don't want the cost of lawyers, or because they think they won't need to. That can cost you everything in the future.

All along the business partnership journey you need to make sure that everything is open and explicit. What would that look like if done correctly (or almost correctly) from the start?

Let's go on an entrepreneurial journey.

*(Note that the details are for businesses in the United States, but the same *idea* will likely apply in some form wherever you're at.)*

You start a project with some friends and, after a while, declare, "We should do this for a living!". Everyone is on board. You talk openly to make sure that everyone has the same overarching goals. You decide to form a  Limited Liability Company (LLC) to protect your personal finances. You consult a lawyer, who helps you and your co-founders create an agreement about company ownership, who is responsible for what, and what happens if someone wants out. The experience is intense, since you didn't realize just how many ways there were for your partnership to go wrong, nor did you realize that everyone's goals weren't as similar as they first appeared.

One of your friends can't come to consensus agreement. Their goals and preferences are just too different. They decide not to participate, and leave. You get lucky: that person is reasonable and signs an agreement saying they won't come after your company for money in the future, perhaps with some compensation for their prior work.

Despite some sadness from your friend leaving, you know that this is a Good Thing. You know that everyone must be completely aligned or everything will eventually collapse. And collapse at enormous financial and interpersonal cost.

With your remaining co-founders, you sign all the paperwork. You are now a co-founder of an LLC! You get to work building your business.

Time goes by. Your idea had a market and your team was able to bring that idea to fruition. Things go well. The money starts coming in and OH GEEZ a lot of it is going into taxes. You talk to your accountant (regularly, since you are wise), who says, "It's time to turn your LLC into an S-Corporation."

You look at your accountant blankly.

They go on to explain: "You'll pay *way less* in taxes that way."

"Say no more!" you exclaim. As you hang up the phone, you hear your accountant trying to indeed say more. You don't care, because your accountant and some lawyers can figure out the details. That's what they're for, after all.

A week later, a huge packet of documents arrive. It's a bunch of things your lawyers want you to know, agree to, and *do*. You and your co-founders read all of it with great care. There are many details to work out than there were with the LLC. How many "shares" does the company have (you get to choose -- everything is imaginary)? How many do each of you have (equal shares?)? Do you have investors that you owe shares to? Is that even how it works (you ask your lawyer)?

One of those documents is something called a "Buy-Sell" agreement. Your lawyer tells you that this agreement sets the rules for what happens when a shareholder transfers their shares to some other entity. Their shares are assets, after all. If a co-founder goes bankrupt, creditors could end up with their shares. If the shareholder dies their estate gets the shares. If they get divorced their spouse probably gets half of the shares. And what if a co-founder just wants out someday? Or wants to make a quick buck by selling their shares to an investor?

After a long discussion, you and your co-founders settle on a Buy-Sell agreement that is consistent with your goals and personal beliefs: Shares can only be voluntarily transferred by unanimous shareholder agreement. If someone wants out or has their shares involuntarily transferred, the other shareholders will buy those shares, or can decide to liquidate the company. The agreement explains exactly how your company's value will be estimated, and how the payouts will work.

Your lawyer signs off, and everyone takes a cathartic sigh of relief. It wasn't too stressful because you went through something similar when you started your partnership with an LLC. You're all in perfect alignment, again. You sleep soundly, knowing that your company's shares will stay with the founders no matter what, and that if it's you who decides to, or has to, leave then you'll be compensated fairly without leaving behind a financially crippled company for the remaining shareholders.

Which is all to say: business partnerships need lots of explicit agreements, and everyone needs to be aligned. That doesn't mean agreement on everything, it means alignment on the overarching plan and goals. Most importantly, have agreements *about the money* (under what conditions will you pay out profit distributions? how are your salaries set?) and *how decisions are made* (who gets to sign contracts on behalf of the company?).

If you have a business without such explicit agreements, it's time to sit down and work toward alignment. You'll be surprised by how many wrong assumptions you've made about your partners and their preferences. You have to go into that discussion honestly, but don't let it get adversarial! Find out *why* everyone is doing this, and what they hope to achieve with and within your company. You don't need to know what's going to happen 5 years from now, but you do need to know what everyone thinks is important *right now*.

## WEBTECH

### String beautification in JavaScript and Typescript

Strings in code are super annoying, because they can get long or span multiple lines. Normally you have to sacrifice the appearance of your code to handle that, in some fashion or another. A while ago I got tired of this and put together some functions that take advantage of JavaScript "Template Literals" to make sure I never had to deal with hideous strings ever again.

I wrote up [an article on the topic](https://beta.bscotch.net/post/oneline-undent), complete with examples and code. Never look at ugly strings again.

### New blog incoming!

When I built our [current blog platform](https://bscotch.net/blog) I needed it done *quickly* since I had to make a bunch of storage APIs for Levelhead. Games always take precedence, since they're how we stay alive as a business. So I used a system that I had already built, something I called "Crates".

Crates are a generic storage solution. Each Crate has its own setup for permissions (who can upload, who can view, etc) and other details, but generally have the same feature set. You may be amused to find out that [Levelhead](https://bscotch.net/games/levelhead) community levels use the same storage system that our blog uses.

Yes, that *does* mean I can put leaderboards on blog posts!

Having generic systems like this is nice, especially in a pinch. It lets you get a project out into the world fast, even if it has some rough edges. Maybe it isn't as efficient as you want, or maybe some features are impossible to add. But hey, you've got something! Eventually, when you have time (you probably won't), you can redo things with something more specific.

Over time, I've added more and more ways for Crates to have more-specific functionality. I did this by borrowing the "hook" concept from things like Git. That will make a good story for another day. The point of this story right *now* is that there was one fundamental thing with Crates that is permanently incompatible with what I want for our blog: searchability.

Crates were designed around the idea of having a bunch of functional metadata, plus a data "blob" of arbitrary size. For a Levelhead level, the metadata includes all the stuff you see on level cards, while the blob is the binary file that describes how to construct the level. For blog posts, the metadata includes the title, author, and stuff needed for SEO, while the blog is the actual post.

Those blobs are all stored in Amazon S3, which you can think of as a hard drive in the cloud that has infinite space. The consequence of this is that the post content is completely unsearchable. Or, more accurately, would be very slow and expensive to search.

So I decided to finally build a new blog platform. This weekend was Global Game Jam, for which I decided to tackle this problem. I finished all the backend stuff, including full-text search, but didn't get to the frontend. Bummer. I was hoping to have everything running by the time this newsletter went out.

Building a blog is an interesting challenge. Once it's up and running I'll put together an in-depth post on the topic.

Probably.

No promises.

## Next time

That wraps the DevChat #2!

Last time, I asked for feedback on the length of the newsletter. Those who gave feedback said the same thing: MORE. Well, this one had more. Maybe too much. I'll be impressed by anyone who can complete the whole thing (no cheating, you gotta hit the linked stuff too).

[Give me feedback!](https://twitter.com/costerad/status/1356013027343147019) Specifically, which part of this edition did you like the most?

Share with others by forwarding or link directly to the [archived post](https://www.bscotch.net/post/devchat-2).

*(Replies don't go to me (yet), so [use Twitter](https://twitter.com/costerad/status/1356013027343147019) for now!)*

Have a great week!

&#x2764; Adam