"We're talking about boxes and lines. We're talking about the big picture."
- Getting Started
- Study Tips
- Learning Objectives
- About the Projects
- Suggested Study
- Break-Down
- Class Recordings
- Curriculum (external)
- HYF Home (external)
How to study the code in this repo.
setting up study-lenses
You will need NPM and nvm on your computer to study this material
Using a browser with good DevTools will make your life easier: Chromium, FireFox, Edge, Chrome
- Install o update the
study-lenses
package globally$ npm install -g study-lenses
(if you do not have it installed)$ npm update -g study-lenses
(if you already have it installed)- Didn't work? you may need to try:
- (mac)
$ sudo npm install -g study-lenses
- (mac)
- having trouble updating?
- try this:
$ npm uninstall -g study-lenses && npm install -g study-lenses
- try this:
- Fork and clone this repository:
- fork the HackYourFuture repository to your personal account
git@github.com:HackYourFutureBelgium/architecture.git
- clone your fork to your computer
- when there are updates to the module:
- update your fork with a PR
- pull the changes from your fork to your computer
- fork the HackYourFuture repository to your personal account
- Navigate to the module repository in terminal
$ cd architecture
- Run the
study
command from your CLI$ study
- The material will open in your default browser, you're good to go!
- you can read the
study-lenses
user guide from your browser by navigating tolocalhost:xxxx?--help
- you can read the
If you use windows and get this error:
..dy.ps1 cannot be loaded because running scripts ...
follow the instructions in this StackOverflow answer, that should take care of it ; )
install everything.
You can run tests in this repository using the test
script, it will run all the tests in the path you provide.
If you do npm run test
or npm run test -- ./
it will run every test in this repository. (there are a lot)
Pro Tip: do not use
npm run document
without a specific path, it is very slow!
This script will build a dependency graph for all the JavaScript files inside a specific /src
folder. It can be very helpful to run the document script every time you add/remove a file or change the import
/export
s in an exercise.
If you run this script at a higher directory, like ./
, it will document all of the /src
folders inside that directory.
This script will format all of the code in the path you provide.
There is no linting script in this repository. It's for practice only, no need to check every detail. Your project starter repositories will have linting scripts.
- Don't rush, understand! Programming is hard.
- The examples and exercises will still be there to study later.
- It's better to fail tests slowly and learn from your mistakes than to pass tests quickly and not understand why.
- Don't skip the examples! Understanding and experimenting with working code is a very effective way to learn programming.
- Practice Pair Programming: two people, one computer.
- Take a look through the Learning From Code guide for more study tips
If you can't finish all the material in this repository, that's expected! Anything you don't finish now will always be waiting for you to review when you need it. These 3 emoji's will help you prioritize your study time and to measure your progress:
- 🥚
:egg:
- Understanding this material is required, it covers the base skills you'll need for this module and the next. You do not need to finish all of them but should feel comfortable that you could with enough time. - 🐣
:hatching_chick:
- Do your best to start this material. you don't need to master it or finish it but getting the main idea will be helpful for taking the next steps. - 🐥
:hatched_chick:
- Have you finished all the 🥚's and started all the 🐣's? push yourself with these challenges.
There's sooo many examples and exercises in this repository, it's easy to forget of what you still need to finish or what you want to review again. Luckily VSCode is really good at searching through folders of code.
You can write hashtags in your comments while you're studying, then search for those hashtags later so you don't miss anything. Here's some ideas:
// #not-done, still a few blanks left
- search for#not-done
in VScode to find all the exercises you've started and not finished// coercion is confusing, #review this again next week
- search for#review
to find the files you need to study again- ... anything goes! Find the hashtags that work for you
If you create a fork of this repository you can open a project board in your fork to track your progress through the module. Just 3 columns can be enough: Todo, Doing, Done.
What you can expect to learn in this module
expand/collapse
- 🥚 State: You understand the concept of state as the data stored in your application at each moment. You can explain how state is rendered into a user interface, and can explain how each user interaction reads/writes from state.
- 🥚 Persistence: You can explain what persistence means and how it can be implemented in the browser using
localStorage
. When you encounter a bug in your code based persisted data, you can uselocalStorage.clear()
and a page refresh to reset your project's state. - 🥚 Data-First Development: You understand applications as data + user interactions. You can demonstrate this by starting your planning process with the data you will need and building a user interface to show that data to a user.
- 🥚 Architecture & Layers: You can explain what software architecture is and the importance of layers for testing, collaboration, and maintenance. These are the layers you will learn to use, from the "back" to the "front":
- Data Access: This layer is responsible for persisting your data, reading and writing from wherever it is stored. This layer has no fancy logic, it just gets things and puts things away again.
- Business Logic: This layer is responsible for all the important actions in your application. The Business Logic layer does not ever interact directly with the user or the user interface. Instead it takes in JS data from the Presentation layer, reads/writes state via the Data Access layer, and returns new data for the Presentation Layer to render.
- Presentation: This is the layer you studied in Separation of Concerns. It renders program state for the user, and handles their interactions. It's possible to different presentation layers for the same business logic!
- 🥚 Function Roles: You can use these new function roles while planning and developing your projects:
- Data Access: Functions that insert (create), find (read), save (update), remove (delete) entries in your saved data. These are provided for you in this module. Data Access functions can only import
utils
and other data access functions. - Business Logic: Functions that take in JS data, read/update state, and return new data. these can be called from handlers, components, or other business logic. Business Logic functions can only import
utils
,data-access
and otherbusiness-logic
functions. - Handlers: The same role as in Separation of Concerns, only now with a few more restrictions. Handlers can not use data directly or use data access functions. They can only import Business Logic, Components and Utils.
- Custom Events: Functions that return a
new CustomEvent
with your choice of.type
, and data stored in the it's.details
property. These will be very helpful for creating testable and reuseable components in your frontend. Custom Events can only importutils
- Data Access: Functions that insert (create), find (read), save (update), remove (delete) entries in your saved data. These are provided for you in this module. Data Access functions can only import
- 🥚 Development Steps: In this module you will learn to build your projects backwards from the "inside" out:
- Plan and write your data (.json file and schema)
- Plan, write and test your business logic
- Plan and write a static user interface (HTML+CSS)
- Develop interactions for the interface (listeners, handlers, components, custom events)
- 🐣 Nested Data: Given a nested data structure containing arrays, objects and primitive values, you can 1) access a given value 2) update a given entry 3) filter the data
- 🐣 Matching a JSON Schemas: You can write an object or array that matches a JSON schema.
- 🐣 Using a Library: You can select which functions from the
/data-access
library to use in your Business Logic functions. This includes reading the documentation, tests and source code to understand how the Data Access functions work. - 🐣 Stateful Testing: You can pass and write unit tests for stateful functions - using
beforeEach
to reset state before each test, and testing for the correct side-effects in state. - 🐥 TDD + Reverse Engineering: Given unit tests for the business logic and an obfuscated demo of the interface, you can build a working application that passes the tests and matches the demo.
- 🐥 Writing a JSON Schemas: You can write a JSON schema that matches several data instances.
template project for this module: architecture-starter
expand/collapse
Helpful links, examples and exercises.
expand/collapse
- Intro to Architecture - abstraction! layers!
-
- 🥚 /function-roles: learn about the function roles you will be using in this module
- 🥚 /stepped: study HTML/CSS/JS projects built up step-by-step (only examples)
- 🥚 /separated: study HTML/CSS/JS projects that have been separated by concern (only examples)
- exercises
- 🐣 /json-schemas: learn to describe JS data using a schema, and how to validate data against a schema.
expand/collapse
- Intro to Architecture - abstraction! layers!
one big group project for the whole module
Build a JS quiz! There is some starter materials for you in ./quiz-project, you can copy-paste these materials into the architecture starter:
quiz.json
andquiz.schema.json
can go in your/data
folder. This is an idea for your program's data, feel free to change it if something else makes more sense for your group.- the
backlog.md
file can og in your/planning
folder. This is a suggestion of what a user can do with your data, you can use this as a starting point for planning your group project.
There is some code already in the starter repository, it's just there so you can see how the folder structure works. Your group will want to remove the extra code before getting started (there are comments to help you find what's important to keep ).
- [ ] [repo](https://github.com/_/_) (with a complete README)
- [ ] [live demo](https://_.github.io/_)
- [ ] [Docs](https://github.com/_/_/tree/_/docs/README.md)
- [/planning](https://github.com/_/_/tree/_/planning)
- [ ] communication plan
- [ ] constraints
- [ ] backlog
- [ ] wireframe
- [ ] development strategy
- [ ] retrospective
- [ ] [project board](https://github.com/_/_/projects/1)
- Students: Here you can find recordings of this module from past classes. Enjoy!
- Coaches: When sending your PR's with links please ...
- Indicate which class you were teaching
- Which week it was (if the module is more than 1 week)
- Give your name
- and a helpful description