Conclusion,and Final Exam Review
Conclusion, and Final Exam Review
What Is this course about? A course about managing complexity o Mastering functional abstraction and data abstraction o Learning trade-offs of various programming paradigms An introduction to programming o Learning how to write programs in Python,Scheme,and SQL 0( Combining multiple programming techniques in large projects o l Understanding how computers interpret programming languages A challenging course that demanded a lot of you
What Is this course about? ● A course about managing complexity ○ Mastering functional abstraction and data abstraction ○ Learning trade-offs of various programming paradigms ● An introduction to programming ○ Learning how to write programs in Python, Scheme, and SQL ○ Combining multiple programming techniques in large projects ○ Understanding how computers interpret programming languages ● A challenging course that demanded a lot of you
"Building Blocks"of Programs f4:a_plus bc [parent=Global] a 4 Primitive Expressions: 2 "he1lo!" add numbers strings names c81 bc 243 Arithmetic Expressions: 1+2 15/3 Return 247 value add(3,4) Call Expressions: max(add(2,3),5*min(-1,4)) Use a4 (6.4) Dont use a4 (2,4 (6,3) Don't use a 4 (2.31 i,total =0,0 Use a 3 Don't use a 3 while i<3: -13ua2 (2,21 Don't use a2 1=1+1 0.2) (2,1 total total i 1,1 (2. 426
“Building Blocks” of Programs
Managing Complexity nx ny nx ny dx dy dx dy nx ny nx*dy ny*dx dx dy dx dy "There are two ways of constructing a software design:One way is to make it so simple that there are obviously no deficiencies,and the other way is to make it so complicated that there are no obvious deficiencies." -C.A.R.Hoare
Managing Complexity
Representing Collections of Data 3 i=0 for elem in [8,9,10]: print(i,":"elem) 2 i+=1 sum(iterablef,start])->value e Return the sum of an iterable of numbers (NOT strings)plus the value of parameter 'start'(which defaults to 0).When the iterable is empty,return start. Note:cannot be called on strings instead must use built in string method join max(iterable[,key-func])->value OR max(a,b,c,...[,key-func])->value e With a single iterable argument.return its largest item. with two or more arguments,return the largest argument
Representing Collections of Data
Mutability x¥2 Status Effect *No nonlocal statement Create a new binding from namexto obrect 2 an the first frame of *xis not bound locally the current environment "No nonlocal statement Re-bind namex to obpect 2 in the first frame of the current 'x is bound locally environment *nonlocal x Re-bind 'x to 2 in the first non-ocal frame of the curtent "is bound in a non-local frame environment in wtuchx is boond "noniocal x is not bound in a non-local frame SyntaxEror no bindng for nonlocalfound *nonlocal x "is bound in a non-local frame SyrtaxEror.name 'x'is parameter and nonlocal "x"also bound locally Python 3.6 Frames Obyects 11st1[1,【2,3],4] Global frame Ist2-Isti 11st3m1st1[:】 30 4 41st1[0】"18 lst2 51st32】m40 st3 61st21111】30 1st2.pop(1) 1st1.append(1st3) Edit this code
Mutability
Object-Oriented Programming basic_attack damage -1n1t. speak attack receive_damage basic_attack 5W1用 fly basic_attack prob attack 2 3
Object-Oriented Programming
Languages LISP IS OVER HALFA I WONDER IF THE CYCLES THESE ARE YOUR CENTURY OLD AND IT WILL CONTINUE FOREVER. FATHER'S PARENTHESES STILL HAS THIS PERFECT TIMELESS AIR ABOUT IT. ELEGANT A FEW CODERS FROMEACH WEAPONS NEW GENERATION RE- DISCOVERNG THE LISP ARTS. FOR A MORE...CIVIUZED AGE. Read Lexer .expression value output Eval 0甲0,,。,物 Print 4。…。44都 input representation string tokens string … Parser loop
Languages
Paradigms Databases CREATE TABLE parents AS SELECT "delano"AS parent, "herbert"AS child UNTON SELECT“abraham", “barack" UNION SELECT "abraham", "clinton" UNION SELECT“fi11more“, "abraham" UNION SELECT "fillmore", "delano" UNION SELECT“fil1more“, "grover" UNION SELECT“eisenhower", "fillmore"; table dogs name fur age delano long 18 eisenhower short 7 fur avg_age eisenhower short 7 delano long 10 short 4.5 grover short 2 grover short 2 B8898388838888833888☒ long 18 fillmore curly 8 fillmore curly 8 curly 6 herbert curly 4 herbert curly
Paradigms & Databases
Final Exam Review:Agenda 1)Macros 2)Trees 3)SQL (There are review slides relating to other topics on the skipped slides feel free to view those at home!
Final Exam Review: Agenda 1)Macros 2)Trees 3)SQL (There are review slides relating to other topics on the skipped slides - feel free to view those at home!)