and
Word Press (legitimate huge company):
32,000+ commits
20+ active branches
500,000 lines of php
iLoveOpenSource (small open source project):
255+ commits
2 active branches
26,000 lines of code
Kuma, the project powering MDN:
10,000+ commits
30+ active branches
500,000 lines of python, HTML, CSS & JS
Enterprise FizzBuzz, a parody of architecture gone wrong:
2000 lines of Java code to complete fizz-buzz
As projects grow adding features becomes harder.
KISS: Keep It Simple, Stupid!
When you write a feature, ask yourself it could be done more simply.
DRY: Don't Repeat Yourself
If you see the same block of code more than 2 places, put it into a function and reuse it instead.
YAGNI: You Ain't Gonna Need It
If you think you might need something in the future, but you don't need it right now... You ain't gonna need it.
"a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations."
A design pattern is kind of like a cookie cutter. Any kind of delicious cookie can be cut into the same shape, but remain uniquely flavored.
"classes" and "instances" are such a popular design pattern that they've been built into many programming languages.
There are THOUSANDS of design patterns. Do some reading, common patterns for additional research are:
The Factory Pattern
The Singleton Pattern
Continuation Passing Style
Recursion :)
But these are all tabled for later.
Possibly the most well known web server design pattern
View
Controller
Model
The Data Model
View
Controller
Model
The View
View
Controller
Model
The Controller
View
Controller
Model
Layered Cake Analogy
MVC applications are like a layered cake. All three layers must be assembled before the cake is complete, and for a bite of cake to be optimally satisfying, all three layers should be eaten at once.
So, why might this be good?
View
Controller
Model
Think about the booklist application you built over the weekend.
Without writing any code, identify the components of this application as they fit into our three categories:
Model
View
Controller
Take 5 minutes to look at your own code and decide
Think about the booklist application you built over the weekend.
Take 5 minutes to discuss with your neighbor what features of your application belong in which categories. Where do you agree and disagree?
Think about the booklist application you built over the weekend.
Alright everyone, what do you think?
Think about the booklist application you built over the weekend.
We've identified some features. Lets design an application structure together that makes sense for the booklist in an MVC pattern.
Lunch rules. We're going to focus on an Express tool that helps us control our controllers after lunch, and refactor our booklists to use this tool.
if you want a preview, google: "Express Router"