GOOD AT MATH... WE SWEAR A LOT... AS LONG AS THEY ARE SOLVABLE IN A LOGICAL WAY IT ACTUALLY HELPS! YOU’LL SEE... BUT MOST OF US STILL LIKE IT! WE DON’T LIKE THINGS FUZZY... COMPUTERS WORK IN 0s AND 1s, WHY SHOULDN’T WE?
ALL OF US ARE GOOD AT MATH... WE SWEAR A LOT... AS LONG AS THEY ARE SOLVABLE IN A LOGICAL WAY IT ACTUALLY HELPS! YOU’LL SEE... BUT MOST OF US STILL LIKE IT! SERIOUSLY! WE DON’T LIKE THINGS FUZZY... COMPUTERS WORK IN 0s AND 1s, WHY SHOULDN’T WE?
ALL OF US ARE GOOD AT MATH... WE SWEAR A LOT... AS LONG AS THEY ARE SOLVABLE IN A LOGICAL WAY IT ACTUALLY HELPS! YOU’LL SEE... BUT MOST OF US STILL LIKE IT! SERIOUSLY! WE DON’T LIKE THINGS FUZZY... COMPUTERS WORK IN 0s AND 1s, WHY SHOULDN’T WE? WE ARE MOSTLY LAZY! WHEN IT COMES TO REPETITIVE WORK!
LIKE JOKES NOT ALL OF US ARE GOOD AT MATH... WE SWEAR A LOT... AS LONG AS THEY ARE SOLVABLE IN A LOGICAL WAY IT ACTUALLY HELPS! YOU’LL SEE... BUT MOST OF US STILL LIKE IT! EVEN THOUGH, SOMETIMES ONLY WE UNDERSTAND THEM... SERIOUSLY! WE DON’T LIKE THINGS FUZZY... COMPUTERS WORK IN 0s AND 1s, WHY SHOULDN’T WE? WE ARE MOSTLY LAZY! WHEN IT COMES TO REPETITIVE WORK!
THEY RUN IN A BROWSER THEY HAVE SOME CONTENT, WRITTEN IN HTML Hyper Text Markup Language HTML IS THE STANDARD MARKUP LANGUAGE FOR CREATING WEB PAGES. WEB BROWSERS RECEIVE HTML DOCUMENTS FROM A WEB SERVER AND RENDER THEM INTO MULTIMEDIA WEB PAGES. HTML ELEMENTS (HEADINGS, TEXT, IMAGES, BUTTONS, LINKS, …) ARE THE BUILDING BLOCKS OF HTML PAGES. FURTHERMORE HTML DOCUMENTS MAY INCLUDE META DATA DESCRIBING THE WEB PAGE (I.E. A DESCRIPTION OF THE PAGE OR USED LANGUAGE). SOURCE: https://en.wikipedia.org/wiki/Hypertext_Markup_Language
THEY RUN IN A BROWSER THEY HAVE SOME CONTENT, WRITTEN IN HTML Hyper Text Markup Language THEY HAVE SOME STYLES, WRITTEN IN CSS Cascading Style Sheets CSS IS A STYLE SHEET LANGUAGE USED FOR DESCRIBING THE PRESENTATION OF A DOCUMENT WRITTEN IN HTML. CSS IS DESIGNED PRIMARILY TO ENABLE THE SEPARATION OF PRESENTATION AND CONTENT, INCLUDING ASPECTS SUCH AS LAYOUT, COLORS AND FONTS. SOURCE: https://en.wikipedia.org/wiki/Cascading_Style_Sheets
THEY RUN IN A BROWSER THEY HAVE SOME CONTENT, WRITTEN IN HTML Hyper Text Markup Language THEY HAVE SOME STYLES, WRITTEN IN CSS Cascading Style Sheets BACKGROUND COLOR OF THE WEBSITE TEXT COLOR DEFAULT SIZE OF THE FONT
WHAT IF… • … I WANT TO ADD A SECOND PAGE? • … I WANT TO ADD SOME INTERACTION (NOT JUST READING CONTENT) I HAVE TO COPY THE ENTIRE PAGE! REMEMBER: WE ARE MOSTLY LAZY! WHEN IT COMES TO REPETITIVE WORK!
WHAT IF… • … I WANT TO ADD A SECOND PAGE? • … I WANT TO ADD SOME INTERACTION (NOT JUST READING CONTENT) I HAVE TO COPY THE ENTIRE PAGE! I CAN’T! REMEMBER: WE ARE MOSTLY LAZY! WHEN IT COMES TO REPETITIVE WORK! AND WE SWEAR A LOT. SHIT!
THEY RUN IN A BROWSER THEY HAVE SOME CONTENT, WRITTEN IN HTML Hyper Text Markup Language THEY HAVE SOME STYLES, WRITTEN IN CSS Cascading Style Sheets THEY ADDITIONALLY INCLUDE SOME SCRIPTS, WRITTEN IN RUBY ON RAILS OR JAVASCRIPT OR ...
WITH DYNAMIC WEB APPS WE CAN... • … CODE FULL-BLOWN APPLICATIONS (LIKE FACEBOOK, TWITTER, …) • … REUSE COMPONENTS (LIKE HEADERS, …) ON MULTIPLE PAGES HOW COOL IS THAT!?
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! OBJECT-ORIENTED everything is an object...
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately • IN OBJECT ORIENTED PROGRAMMING (OOP), AND OBJECT MAY BE SEEN AS A CONTAINER OF DATA WITH ATTRIBUTES (DATA) AND A GROUP OF METHODS (PROCEDURES) DEFINED IN ITS CLASS. • AN OBJECT IS AN INSTANCE OF A CLASS IT IS ASSIGNED TO ALL THE ATTRIBUTES AND METHODS DEFINED IN ITS CLASS. • EVERYTHING IS AN OBJECT IN RUBY!
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately CAR (OBJECT)
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately CAR (OBJECT) 4 WHEELS (hopefully) (NUMBER OF WHEELS)
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately CAR (OBJECT) 4 WHEELS (hopefully) (NUMBER OF WHEELS) TURQUOISE (COLOR OF CAR)
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately CAR (OBJECT) 4 WHEELS (hopefully) (NUMBER OF WHEELS) ACCELERATE (SKILL: METHOD) TURQUOISE (COLOR OF CAR) FLASH (SKILL: METHOD)
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately OBJECT-ORIENTED everything is an object... CAR (OBJECT) 4 WHEELS (hopefully) (NUMBER OF WHEELS) ACCELERATE (SKILL: METHOD) TURQUOISE (COLOR OF CAR) FLASH (SKILL: METHOD) DRIVER (OBJECT)
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately WHAT ABOUT NOW? NAME SOME OBJECTS, ATTRIBUTES AND METHODS.
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! INTERPRETED instructions are executed immediately CAR (OBJECT) 4 WHEELS (hopefully) (NUMBER OF WHEELS) ACCELERATE (SKILL: METHOD) PINK (COLOR OF CAR) DRIVER (OBJECT) ANOTHER CAR (OBJECT) ANOTHER DRIVER (OBJECT)
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! OBJECT-ORIENTED everything is an object...
OF RUBY IN 1993 OPEN SOURCE EVERYBODY CAN VIEW, CHANGE AND REDISTRIBUTE THE CODE AS YOU LIKE. THIS IS ACTUALLY VERY COOL! OBJECT-ORIENTED everything is an object... SIMPLE & INTUITIVE LET’S HAVE A LOOK...
} READ THIS OUT LOUD: WHAT DOES IT DO? ANY IDEAS? IN ENGLISH SENTENCES, PUNCTUATION (SUCH AS PERIODS, EXCLAMATIONS, PARENTHESES) ARE SILENT. PUNCTUATION ADDS MEANING TO WORDS, HELPS GIVE CUES AS TO WHAT THE AUTHOR INTENDED BY A SENTENCE.
LET’S TRY ANOTHER ONE. READ IT OUT LOUD ONCE MORE: AGAIN: WHAT DOES IT DO? ANY IDEAS? HERE WE’RE DOING A BASIC REALITY CHECK. OUR PROGRAM WILL EXIT (THE PROGRAM WILL END) UNLESS THE WORD RESTAURANT CONTAINS (OR INCLUDES) THE WORD AURA.
print food.capitalize } THIS ONE IS A BIT MORE TRICKY. TRY IT ANYWAY: WHAT DOES IT DO? HINT: SOMETIMES RUBY READS AS A «SHORTER» ENGLISH. SOLUTION: WITH THE WORDS ‘TOAST’, ‘CHEESE’ AND ‘WINE’: TAKE EACH FOOD AND PRINT IT CAPITALIZED.
INTUITIVE YOU’LL CONFIRM THAT YOURSELF TONIGHT, HOPEFULLY :-) «CONVENTION OVER CONFIGURATION» REMOVES THE DULL PARTS OF CODING AND LETS US CONCENTRATE ON THE ESSENTIALS.
INTUITIVE YOU’LL CONFIRM THAT YOURSELF TONIGHT, HOPEFULLY :-) «CONVENTION OVER CONFIGURATION» REMOVES THE DULL PARTS OF CODING AND LETS US CONCENTRATE ON THE ESSENTIALS. FOLLOWS THE MVC PATTERN
the database - access to data and the logic of the application - independent of view and controller VIEW - presentation of the data and interaction with the user - only displays what is in the model MVC
the database - access to data and the logic of the application - independent of view and controller VIEW - presentation of the data and interaction with the user - only displays what is in the model CONTROLLER - the logic of the application - coordinates the interaction between the user, the view and the model - is in charge of what is happening MVC
the database - access to data and the logic of the application - independent of view and controller VIEW - presentation of the data and interaction with the user - only displays what is in the model CONTROLLER - the logic of the application - coordinates the interaction between the user, the view and the model - is in charge of what is happening MVC UPDATES FILLS WRITES NOTIFIES
RAILS SHARE A COMMON FEATURE: THEY ARE ALL ORGANISED ACCORDING TO THE SAME STRUCTURE. • THIS HELPS UNDERSTANDING OTHER DEVELOPER’S CODE EASILY. THEREFORE: DON’T CHANGE IT! EVER!
YOU START THE RAILS SERVER AND RUN COMMANDS • ON MAC: ◦ SEARCH FOR «TERMINAL» IN YOUR SPOTLIGHT • ON WINDOWS: ◦ SEARCH FOR «COMMAND PROMPT» OR «CMD» ON YOUR COMPUTER