{module 6}
What to learn next
How programs talk to each other20 min read
What you will be able to do
- Say plainly what you can build now, and what you cannot build yet and why.
- Choose a next step from the paths in this lesson, and find a source for it that costs nothing.
- Write a plan for the next four weeks as data, and show it on a page with a loop.
Why it matters
Maple Shack makes maple syrup on a family farm near Québec City, Canada. Olivier Tremblay, the owner's son, finished a free course like this one and built the farm's page, with its prices and the weather for the sugaring season.
Then he stopped making progress. For two months he started a new tutorial every few days, because each one looked better than the last. He finished none of them and built nothing new. When his mother asked what he had learned that month, he could not say.
What he lacked was not another tutorial. He needed an honest picture of where he stood, one direction, and a plan small enough to finish. This lesson, the last of the course, gives you those three things.
The idea
What a developer does in a day
Most of a developer's day is not spent typing new code. A typical day contains some of each of these:
- Reading: other people's code, documentation, and error messages, as you have done since module 1.
- Small changes, each one tested before the next, as in every lesson here.
- Debugging, with the same loop: read, reproduce, one guess, test, search the official documentation.
- Reviewing changes that colleagues made, and answering their questions about yours.
- Writing: status messages, READMEs, notes on decisions, questions to a client.
The tools differ from yours. A developer works in a terminal, a window where you type commands instead of clicking. They save every change with Git, a program that keeps the history of a project. You did both on GitHub's website, by clicking.
What you can build now
You can write a page in HTML and style it with CSS so that it reads well on a phone. You can put it online and send the link. You can write JavaScript that reads what a visitor types, calculates with it and changes the page. You can call a public API, show its data, and say something true while it loads, when it is empty and when it fails. You can read an error message and find its cause.
That is a real base. Many useful pages are made of nothing more.
What you cannot build yet
Each of these needs something that a page in a browser does not have:
- Keeping what a visitor sends. A booking form needs a program on a server to receive it, as you learned in module 2.
- Accounts and sign-in. Checking a password must happen on a server, never in the page.
- Taking payments. That needs a server and a payment provider.
- Keeping data for later. Orders and bookings live in a database, a program that stores data and finds it again quickly.
- Keeping secrets. Anyone can read the JavaScript of your page in the developer tools. So an API that needs a secret key cannot be called from a page alone.
The paths from here
These four come in this order, because each one needs the one before it:
- The terminal. Moving between folders, creating files and running programs with commands.
- Git. Saving changes and sending them to GitHub from the terminal.
- A server. A program, often written in JavaScript with Node.js, that receives requests and sends responses. You have been the client all along. Here you write the other side.
- A database. Storing data and asking questions of it with SQL, the language most databases understand.
These sources cost nothing, and you can start them today. MDN's "Learn web development" covers all four paths in order, and its "Command line crash course" is a first step into the terminal. The Odin Project is a free course whose Foundations path teaches the terminal and Git. freeCodeCamp offers free courses with exercises in the browser. The book "Pro Git" is free online and explains Git from the start. The links are in "Go deeper".
Leet School also has a full programme, Software Engineering. It starts with the terminal and ends with a product of your own on a server you control, through an orientation and sixteen modules. It asks for 10 to 20 hours a week for 4 to 8 months. If you go on there, the lessons, checks and projects will work the way they did here. If you go on elsewhere, or stop here, what you built is still yours.
Keep learning in public
Whatever you choose, keep the habits of this course. Write your learning log every day you work. Give each project its own repository with a README. Publish a short article when you understand something new, because explaining it is how you find out whether you do.
Worked example
A plan you can see is easier to keep. This page shows a four-week plan from an array of objects, with the loop from module 4. Make a folder called next-four-weeks and create index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>My next four weeks</title>
<script src="plan.js" defer></script>
</head>
<body>
<main>
<h1>My next four weeks</h1>
<ol id="weeks"></ol>
<p id="total"></p>
</main>
</body>
</html>Then plan.js:
const plan = [
{ week: 1, focus: "The terminal", build: "Make and move files with commands only", hours: 5 },
{ week: 2, focus: "Git", build: "Push a change to my Tonga page from the terminal", hours: 5 },
{ week: 3, focus: "JavaScript", build: "Rebuild the deposit calculator without looking", hours: 6 },
{ week: 4, focus: "A first server", build: "Follow one tutorial and change what it answers", hours: 6 },
];
const list = document.querySelector("#weeks");
let totalHours = 0;
for (const step of plan) {
const item = document.createElement("li");
item.textContent = `Week ${step.week}, ${step.focus}: ${step.build} (${step.hours} hours)`;
list.append(item);
totalHours = totalHours + step.hours;
}
document.querySelector("#total").textContent = `In all: ${totalHours} hours over ${plan.length} weeks`;Save both and open index.html. The page shows:
My next four weeks
Week 1, The terminal: Make and move files with commands only (5 hours)
Week 2, Git: Push a change to my Tonga page from the terminal (5 hours)
Week 3, JavaScript: Rebuild the deposit calculator without looking (6 hours)
Week 4, A first server: Follow one tutorial and change what it answers (6 hours)
In all: 22 hours over 4 weeksEach week has one focus and one thing to build. "Learn Git" cannot be finished. "Push a change to my Tonga page from the terminal" can, and you will know when. The hours are a promise to yourself that fits your real week.
Lines 1 to 6 are the plan as data. Lines 11 to 16 build one list item per week and add up the hours. To change the plan, you change the data and nothing else.
Common mistakes
for...in instead of for...of
In loop-in.js, line 11 says for (const step in plan). The page shows:
My next four weeks
Week undefined, undefined: undefined (undefined hours)
Week undefined, undefined: undefined (undefined hours)
Week undefined, undefined: undefined (undefined hours)
Week undefined, undefined: undefined (undefined hours)
In all: NaN hours over 4 weeksfor...in gives the positions, "0", "1" and so on, not the objects. A position has no focus, so each value is undefined, and adding undefined to a number gives NaN, "not a number", which you met in module 4. Use for...of to get the items of an array.
Numbers written as text
In hours-as-text.js, the hours are in quotes, such as hours: "5". The total line shows:
In all: 05566 hours over 4 weeksWith text, + joins instead of adding: 0 and "5" make "05", then "055", and so on. The list itself looks right, which is why this is easy to miss. Write numbers without quotes. Data that arrives as text, such as what a visitor types, needs Number() first, as in module 4.
Think it through
Sipho, a learner, has about 5 hours a week, and wants to learn the terminal, Git, a server and a database in the next four weeks.
Understand. In: 20 hours, and four subjects that come in a fixed order. Out: a plan he can finish, with one thing to build each week.
Break down. How long does each subject need? Which one depends on which? What will he build to prove each one?
Plan. He reads the first pages of each source to judge its size. The terminal and Git look like a week each. A server alone looks like more than two weeks. A database needs a server first.
Build. He writes weeks 1 and 2 for the terminal and Git, and weeks 3 and 4 for a first server. He moves the database to the next plan.
Test. He checks each week against his calendar, and the hours add up to 20. For an odd case, he imagines a week with only 2 free hours. His plan has a smaller task he can do in that time, so one bad week does not end it.
Reflect. His first draft had all four subjects, and it would have failed by week 2. Cutting the plan to fit the hours was the most useful step.
At work
Feedback you can use starts with a question someone can answer. "Is my page good?" gets "Looks nice", which helps nobody.
Olivier sent his farm page to a developer he knew, and asked:
Could you spend five minutes on this page? It is for visitors to our farm, who open it on a phone. Two questions: can you find the opening hours and today's weather within ten seconds? And what is the first thing you would change? I am not asking about the colours yet.
He said who the page is for, how long it will take, what to look at and what to leave out. The answer he got named two real problems, and he fixed both that week.
Your tasks
Task 1: Build the plan page
Build the worked example.
You are done when the page shows four weeks and a total of 22 hours.
Task 2: Make it your plan
Change the data to your own next four weeks. Choose one path from this lesson, one source from "Go deeper", one thing to build each week, and hours that fit your real week.
You are done when the page shows your plan, every week names something you can finish, and the total matches the time you really have.
Task 3: Ask for feedback you can use
Publish the plan page on GitHub Pages, as in module 1. Then send the link to one person, or post it with your learning log, with two questions that can be answered in one line each.
You are done when your message names who the plan is for, the two questions, and how long reading it takes.
Task 4: Mark the weeks that are done
Add done: false to each week. Show "(done)" after each week whose value is true, and a line below the list such as "1 of 4 weeks done".
You are done when changing one week to done: true adds "(done)" to that week and changes the count, and the hours total stays the same.
Recap
- A developer's day is mostly reading, small tested changes, debugging and writing, in a terminal and with Git.
- You can build pages that respond and show live data. Keeping data, accounts, payments and secrets need a server.
- The paths from here go in order: the terminal, Git, a server, a database.
- A plan you can keep has one thing to build each week, in hours that fit your life.
- Ask for feedback with a specific question, and keep learning in public.
Go deeper
- MDN: Learn web development is a free course from the first page to servers, in order.
- MDN: Command line crash course is a first step into the terminal.
- The Odin Project: Foundations is a free course that teaches the terminal, Git and more JavaScript.
- freeCodeCamp: Learn lists free courses with exercises you do in the browser.
- Pro Git is the free book about Git, from the first command.
- MDN: Server-side website programming explains what a server does, with a first server in Node.js.