Lecture 4: Memorize Game Logic

Stanford published this video item, entitled “Lecture 4: Memorize Game Logic” – below is their description.

The series of video lectures given to Stanford University students in Spring of 2021 continues by completing the MVVM architecture in the Memorize demo by using the ViewModel to build the View. Swift’s powerful enumeration syntax is introduced, along with the specific enum Optional. The lecture concludes with using the Optional construct in Memorize as part of finishing off its game logic.

The Swift Programming Language’s semantics for enumerations is particularly powerful and contrasts with many of the languages taught in introductory Stanford computer science courses. Enumerations in Swift allow for storing data in each matching case, creating helper methods directly on the enumeration, pattern-matching in switch statements, and more. Furthermore, a vast number of standard Swift libraries utilize the enumeration Optional in their functionality, and the Swift Programming Language adds useful syntax for manipulating Optionals. Optionals also find use in graceful error-handling when an operation may or may not succeed in returning a desired value. This is applied directly in Memorize in the final demonstration, and the lecture concludes with the major features of Memorize in a working state.

Stanford YouTube Channel

Got a comment? Leave your thoughts in the comments section, below. Please note comments are moderated before publication.


About This Source - Stanford

Stanford University, officially Leland Stanford Junior University, is a private research university in Stanford, California. The campus occupies 8,180 acres, among the largest in the United States, and enrolls over 17,000 students. Stanford is ranked among the best universities in the world.

Recent from Stanford:

The movers and shakers of stanford’s earthquake center 1

The movers and shakers of Stanford’s earthquake center

Sarafan ChEM-H Vlog

Two tricks for healthier eating

Leave a Comment

We don't require your email address, or your name, for anyone to leave a comment. If you do add an email address, you may be notified if there are replies to your comment - we won't use it for any other purpose. Please make respectful comments, which add value, and avoid personal attacks on others. Links are not allowed in comments - 99% of spam comments, attempt to post links. Please describe where people may find additional information - for example "visit the UN website" or "search Google for..." rather than posting a link. Comments failing to adhere to these guidelines will not be published.