The Odin Project Flashcards
What are the three stages of the problem-solving process?
1) Understand the problem
To make sure any solution you come up with is going in the right direction
2) Plan
- asking questions that answering will help you move closer to solving it
- pseudocoding to confirm the logic behind the task is sound
3) Break big problems into sub- problems
What is an error?
A built- in object with name/type and message. It contains information to help us resolve issues (for example, location of code where error is occurring.)
What is the technical term for generating an error?
“throwing” an error
What is a stack trace?
a report of error messages that appears underneath the main error message, indicating all the locations where the computer is having trouble running the code
How can we copy a repo made in Github to our local directory using CLI?
git clone [ssh key]
How can we test whether a local repo is connected to GitHub and what would a successful message display?
git remote -v
it will display the URL of the repository you created on GitHub, which is the remote for your local copy
Recall the 6 principles of writing clean code
(1) CONSISTENCY
stick with one way of formatting code
(2) INDENTATION
help with parsing
(3) USE APPROPRIATE NAMES
nouns/verbs are used for variables, adjectives for functions which do something
the only time using single letters might be acceptable is in loops/callbacks
(4) ALWAYS ADD SEMI-COLONS
err on the safe side by always adding them in even though the JS compiler will insert them, in some cases not adding them causes unexpected behaviour
(5) DIVIDE AND CONQUER
formatting super long lines into shorter ones
break up large functions into small
(6) LIMIT COMMENTS
for absolutely necessary situations (e.g. why a code is used, refactor and make code as simple as possible to understand
When might single letter names for variables be appropriate?
loops/callbacks
How can we start using node.js in the terminal, how can we exit i.e what instruction should we type?
node
. exit
What is TDD and what are the benefits?
Acronym for Test Driven Development - a way to develop code by writing tests before writing code to be certain when your code works
It’s more efficient as we don’t have to test code by trial and error e.g running the code ourselves over and over, plugging in different numbers until we were sure that it was working, for larger programs like a game we have to play several games ourselves