Mobile App Development 2021W Lecture 6: Difference between revisions
Created page with "==Video== ==Notes== <pre> Lecture 6 ------------ Domain specific languages (DSL) - versus general purpose languages - language designed to specify solutions in a specific..." |
|||
Line 1: | Line 1: | ||
==Video== | ==Video== | ||
The video from the lecture given on January 27, 2021 [https://homeostasis.scs.carleton.ca/~soma/mad-2021w/lectures/comp1601-2021w-lec06-20210127.m4v is now available]. | |||
==Notes== | ==Notes== |
Latest revision as of 19:49, 27 January 2021
Video
The video from the lecture given on January 27, 2021 is now available.
Notes
Lecture 6 ------------ Domain specific languages (DSL) - versus general purpose languages - language designed to specify solutions in a specific domain - SwiftUI can be thought of as a DSL - syntax and semantics are specific to SwiftUI, sometimes in non-obvious ways - but swiftUI is implemented in Swift - so must follow Swift syntax as well DSLs are everywhere in CS, but nowadays we tend to do APIs instead APIs are used to express solutions to a specific problem - but they don't introduce new syntax, just semantics API = application programming interface - essentially, any library defines an API forEach - used to loop, like for - but you normally specify an array and a function - the function is then run on each element of the array in turn - so it is close to map operation - but maps return an array of return values - forEach has no return value - you don't explicitly specify the number of iterations - but it is implicitly defined by the size of the array passed in - nice because you don't have to think about figuring out the size of the array Objective C - we're not covering Obj-C in class - but it is important to know about when doing iOS development Swift was designed to be a modern language, but had to interoperate with Obj-C So, what was Obj-C missing? - safety C isn't safe - unrestricted memory access - C programs segfault (crash) Obj-C isn't safe - only runtime verification of messages Objective C is C plus runtime messages (specified with [ ] syntax) - directly inspired by Smalltalk - smalltalk, everything is an object, and objects communicate through messages - "purest" of the object-oriented languages The lack of safety in Obj-C makes it very flexible, but can create problems for less experienced programmers and can cause problems at scale Modern languages try to catch as many problems at compile time as possible - hence, optional types