Exercise Is Text Only

Created by Zed A. Shaw Updated 2024-12-10 18:57:40

02: Course Motivation and Overview

The purpose of this course is to teach you JavaScript by teaching you how to make professional websites that accept money from customers. This seems like a simple task, but weirdly not many programmers actually learn how to do this. I never learned how to do it in school or at any job I worked. I had to teach myself how to do something as "simple" as accepting credit cards online. For some bizarre reason, nobody really teaches how to accept money from people online, despite the importance of payments online.

The answer you get is usually, "Just use Stripe." Even with advanced payment processors like Stripe, Adyen, Alipay, and Paypal you still have a lot of complexity in your application. What kind of payments do you need? Subscription? One-time credit card? Is this a marketplace? How do you handle refunds? How do you confirm payment? No, seriously. Have you actually tried to confirm a payment? What happens if you miss a callback? What about credit card fraud? Did you know most of these payment companies do almost nothing to stop fraud? Did you know if you get hit with a charge back that you will have to pay $15-$30 to resolve it, and you might lose the original payment too?

Everyone thinks "just use Stripe" is simple, but there's many scenarios that sabotage that simplicity. Take "pay what you want" models as an example. Let's say you want to offer up your music to people and let them choose how much to pay. They can give you zero dollars, one dollar, or one-hundred dollars. Seems easy enough right? Oh, silly person, you haven't ran into carding.

Carding is where a hacker will buy a ton of stolen credit card numbers, usually gathered from a previous data hack. This person is called a "carder" and "carding" is where they take all of the cards and try to determine if any are still viable, and remove any credit cards that have been canceled. To do this they need to conduct a large scale series of test payments in some anonymous way. They hand out the batch of cards to a bunch of accomplices, and then those accomplices hit any online retailer that offers something for $1...like your music website with it's $1 "pay what you like" model.

They hit your site, try a ton of cards with charges for $1 each, and keep any that pass. Your seemingly friendly gesture is now being exploited to filter out canceled credit cards, and the worst part is, you have to pay for it, not Stripe. The real owner of the card will report this $1 charge as fraudulent, Stripe will then charge you $15 to handle it, and no, you can't just give the money back. Too late. You're now out $16, and if you get too many of these charges Stripe will cancel your account. Oh, did I mention that "too many" is arbitrary and based entirely on if Stripe likes you or not?

"But, Zed, doesn't Stripe do some kind of advanced fraud detection...." HAHAHAHAHAHAH. No. Maybe they do some now, but they make too much money on these carders and they know it. They leave it to you to stop the carders, and if you're a small shop you can't possibly defend yourself.

What's even more stupid about this is 95% of carding could be stopped if Stripe simply blocked charges where the computer making the charge is not located in the card owners country. When I stopped using Stripe all of my fraudulent charges fit the pattern of Zip code in the US, but from a computer in Europe, Africa, or Asia. All they'd have to do is stop any charge to a US card from those countries and they'd block most carding fraud. Narrow it down to the same US state and they'd do even better. Block Tor and I think that about covers it for most carding.

This is what I mean when I say that processing a credit card is not as easy as everyone thinks it is. The actual capturing of the card's money isn't the problem. It's all of the random tangential issues that happen before and after which make it an interesting problem, and a very practical basis for learning to code.

The Money Mindset

There's a clear mental switch that happens when you go from "a website for X" to "a website that sells X". Again, it's a deceptively simple change in perspective that suddenly amplifies the importance of what you're making. Adding in money turns most programming projects into Serious Business and changes the dynamics of how you build them. You go from piling every new technology on the "stack" to, "This new thing is going to take 1 week and I ain't got time for that nonsense." Trying to earn money from your software is an excellent way to cut the junk out and focus on reality.

When you make "a free Twitter for Iguanas" there's no pressure to be efficient. Who cares if it crashes? Why not try every technology Google makes? Nobody is paying you anyway. This is a safe position to be in because anyone's criticism can be met with, "It's free. Shut up." Free attracts people because it allows them to hide behind the price and avoid criticism.

The second you try to charge for it you lose this shield and have to actually listen to customers. You also have your own real money tied to what you do, and that creates motivation for you to be efficient. When you realize that you have to automate your tests because every day your project is down is a day of real money gone, you write the tests. When your code is too complicated you see the real money cost of running it, and see how rewriting it might improve revenue.

This is Only Pretend

Think of this course like taking a boxing class for fitness. Boxing is full of many healthy activities even if you never actually fight anyone. It has running, jumping rope, speed bag, pushups, situps, and anything else to get you ready to box, but you don't need to ever do anything except study. The sport of Boxing simply acts as a way to make all the things you learn concrete. It gives the pushups, situps, and running a purpose and structure with a concrete goal explaining why you have to do them.

Obviously not everyone wants to go through the stress of running their own business, but pretending you're making a real business will help make what you learn realistic. Even if you don't plan on ever earning a single dollar online, the topic of "online small business" will still teach you so much. You'll go from learning about hashing algorithms because you're told it's "good for you" to learning about them because that's how you secure people's credit card purchase information and passwords.

Structuring the course around the goal of "charge people for a product online" improves the educational experience even if you never make a single tuppence off your code. Now when you ask, "Why do I have to learn this?" I can answer with a real reason instead of just going, "It's what everyone else learned."

Will This Get You A Job?

I believe that anyone telling you their course will make you rich is lying to you. I am not promising you any kind of employment, jobs, money, or riches at all. In fact, the statistics say you may never make any money on the things you make no matter how much I teach you and how good you are at programming. Most business success is all luck, and anyone telling you different is lying to you. Anyone promising you the secrets to this luck are definitely ripping you off.

I'm also not even bothered with whether you get a job or not. I'm now convinced that focusing entirely on getting people a gig at a FAANG is ruining programming education. When a bootcamp focuses entirely on getting you a job at a company it incentivizes them to focus on fairly useless things like algorithms and whiteboard interviews. This focus on "job acquisition behaviors" robs you of realistic education.

My real motivation for this course is to give programmers a third option of running their own small business. Programmers are convinced that there's only two options for their skills:

  1. Get a job using their skills making someone else a billionaire.
  2. Work for free on open source projects so that the billionaires from #1 don't have to pay them.

Starting your own business is always sold to programmers as something that "business people do." They're told that it takes a special kind of person to do the money making things, and so programmers should leave that to professionals and just take their paycheck and be happy about it.

I want you to learn the technical aspects of running your own business, even if you never actually make any money from it. Learning this skill can only benefit you, and it doesn't prevent you from doing things for free or getting a job working for someone else. In fact, many, many, many employers wish their employees knew more about running a business, so it can only help you.

The Problem of Ideas

"Nobody will buy my ideas." I find this statement sad for two big reasons:

  1. Why are you so down on your own ideas? Have you seen some of the crap people buy? People get investment money for some of the stupidest things ever. There's other massive trillion dollar companies that make most of their money off re-selling open source projects that the authors thought weren't good enough to charge for. If Microsoft can make all its money off just re-selling Linux, then your ideas can't be all that bad. It's mostly luck anyway, so don't say your ideas are bad. You have no idea if people will pay for them until you try.
  2. Where's the fear coming from? You're saying nobody will buy your ideas before you've even tried, and trying isn't even that risky. An online business can literally cost $5/month, and your time is educational so it's only a benefit. If you put up the absolute worst possible business idea, spend $5/month on a VPS, and it fails what did you lose? Five dollars. That's it. That's a single fancy coffee spent for an entire month of learning and education. You didn't lose anything. You made money on that attempt purely based on the experience and education gained.

Despite my answers to these two blockers I do understand that some people are deathly afraid of being humiliated, so I'm going to list some tricks to use during this course to help avoid it:

  1. It's the internet. Nobody needs to know you did it. If you're worried you'll look like a fool just adopt a fake name and nobody will know it's you. Or, don't publish anything you make. Nobody needs to see it but you.
  2. If you're worried about losing a lot of money, then don't spend a lot of money. You should be able to do this course with only your current computer. If you want to host your projects, then a $2-$5 VPS host online is more than enough.
  3. Make it obvious you're not serious by selling something imaginary. If you setup your business to sell Mystical Frobinapsingers then there's no way anyone can possibly claim you were being serious and aren't just doing this to learn. Just put up a BitCoin testnet fake purchase form and you're good to go (I show you how in the course).
  4. Make it for one person. Do it for a friend in exchange for something small like a meal or some drinks, and then take it seriously and treat them like a customer. Set a solid time frame for when it ends so you don't do it forever, but consider your "payment" the learning experience of building a real website for someone.

Ultimately you are free to do whatever you want with what I teach you. I'm only using the idea of "selling things online" as an educational device to add practicality and solidity to what I'm teaching. I do recommend you attempt to sell something so you get the full educational experience, but if all you do is make the same websites and never put them online then I'll feel I succeeded.

How It Works

With all that motivation out of the way I want to briefly explain how the course works. I want this course to be full of real projects I created to make money in some way. Either the project is actually selling something (like this course), or it's designed to bring in marketing dollars in some way. This keeps the theme of "selling things online" and gives you real actual projects to study.

The only problem with this approach is the full projects may be too complex for people just starting out. I want someone to start at the beginning of this course, learn programming and Javascript, then move on to progressively more difficult copies of my own projects to get better at the language. This won't work if the first project is a WebTorrent and Svelte based video course selling website. Almost every beginner would fall flat on their face trying to copy this full website.

The compromise I've developed is to have two kinds of projects for you to study from:

  1. Starter Projects are stripped down easy to digest versions of the original project, laid out in a fake "cooking show" style that hides all the nasty ugly bits. This lets you focus on learning how to build a simpler version of the project in a gradual structured way without being distracted by irrelevant details particular to my real project.
  2. Real Projects are the actual money making websites I based the Starter Projects on. I intend to hide nothing from you and you'll have access to the code I actually use for these projects. The Real Projects are for you to study and attempt to copy in full after you learn how to create the simpler Starter Project version. This helps you learn the valuable skill of studying other people's code while getting a miniature introduction before you dive in.

I reverse engineer the Starter Projects from the Real Projects so they're as realistic as possible but still educational. They'll contain all of the essential elements of the original, but might feature a simplified design with less special cases that are particular to my needs. For example, I had to migrate a bunch of people from a Python Django project so I have many odd database fields you don't need to understand the project.

When you're done studying the Start Project you can visit the code for the real project and start studying it and copying it. Copying other people's projects is a very effective learning technique and it's considered the foundation of web development. Each of the Real Projects will have a series of introduction videos to show you how they differ from the Start Project, and give you tips on how to start your own copy.

From Start to Finish

You'll need to learn the basics of HTML, CSS, and JavaScript before you can study these projects. You could just jump in and try to understand each project, hammering your head on them until you give up, but that's only going to work for a small group of people. Most people need to have some grounding in fundamental skills before they can begin to understand anything real.

The first set of modules will take you through HTML, CSS, and JavaScript. If you've never written code before then these modules should be at a moderate difficulty level for you. My recommendation for absolute total beginners is to do this section two or even three times. It usually takes several repetitions to understand your first programming language.

Putting it All Together

I can now put together the master plan for this course as of Feb, 2022:

  1. I'll start you off with the most basic introduction to how a computer works with the Command Line and The Turing Machine.
  2. You'll then move to HTML and CSS to learn how to make a basic web page.
  3. Once you understand HTML and CSS you'll then learn the complete basics of JavaScript ES6. This won't make you a master, but it'll teach enough to start the projects.
  4. I'll then show you how to copy websites by having you copy the stock components I include in the course called the "Bandolier". These components cover nearly every topic you'll encounter in web development, but are small and learnable.
  5. You'll then progress through a series of Starter Projects that mirror actual projects I've created and run. Each one will be about 85-95% feature complete but simplified so you can grasp them.
  6. Once you get through the start projects you can move on with your life, or move on to attempting copies and studies of my Real Project code to understand how I actually implemented these projects for my real world websites.
  7. Along the way you'll get topical modules covering subjects you need. It could be a module on Vim, administering Linux, SQL databases, and anything else I see people struggling with during the main courses.

Next Up

Hopefully this exercise has explained the course and motivated you to work on it. In the next exercise I'll cover some tips for succeeding at this course, and how to learn a programming language in general. You perfectionists out there shouldn't skip next exercise because it'll directly help anyone who gets easily discouraged at the first sign of failure.

Previous Lesson Next Lesson

Register for Learn JavaScript the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.