Lecture 10

The End

  • We’d like to thank everyone who helped make CS50 possible:
    • Office for the Arts at Harvard, Memorial Hall / Lowell Hall Complex
    • Harvard FAS’s Education Support Services
    • CS50’s own production team behind the cameras
    • CS50’s staff and course assistants
  • And you may have noticed a few puppets around the theater, to add some interest to some shots in our lecture videos.
  • Don’t forget that, ultimately:

    what ultimately matters in this course is not so much where you end up relative to your classmates but where you end up relative to yourself when you began

  • Recall that we started by printing out characters in the shape of a pyramid from the Super Mario Bros. games, then progressed to analyzing the readability of sentences, implementing algorithms for elections, and applying filters to images.
  • Then, we learned about data structures, building hash tables and tries to search for data quickly. Finally, we learned several new languages, Python, SQL, HTML, CSS, and JavaScript to build our own web application.
  • We’ve learned some first principles:
    • computational thinking, where we think more logically and methodically
    • using algorithms to solve problems, by taking some input and producing some output
  • And now, with all the tools and skills we’ve learned, we hope that in the future we’ll consider whether we, and others, should be building (and using) programs and applications, just because we can.
  • We’ve learned to evalute our work on the axes of correctness, design, and style.
  • We can also use the concept of abstraction to break down a complex problem into layers and solve them one at a time.
  • We aspire to be precise, too, in our instructions, whether in our programs or other humans.
    • We ask a volunteer to come on stage. They are able to see a drawing of a cube that the audience can’t, and give a series of verbal instructions to the audience for how to draw it themselves. Since everyone interpreted each instruction slightly differently, the final drawings all ended up very different.
    • We could have used abstraction to just say, “draw a cube,” but that wouldn’t include details about its size or angle. We could have been more precise by saying, “draw a line at 45 degrees,” but that would be tricky to follow as well.
  • We have another volunteer come on the stage, and the audience now tells the volunteer to draw a stick figure saying “Hi.”

Tools

Quiz Show

  • We host a quiz show with the audience, with the following questions:
    • What does CSS stand for?
      • Cascading Style Sheet
    • Which best describes the role of a compiler?
      • Turn source code into machine code
    • What is the type of argc?
      • int
    • What is the searching efficiency of a Balanced Binary Search Tree?
      • \(O(\log n)\)
    • What was the CS50 Duck’s Halloween costume?
      • Vampire
    • In C, how can we unify several variables of different types into a single, new type?
      • Structs
    • In Python, which of the following statements is false?
      • Arrays in Python are of a fixed size
    • What does strcmp return in C?
      • An integer
    • What does David Malan’s phone number [949-468-2750] play when you call it?
      • Never Gonna Give You Up
    • From which of the following places does malloc get free memory for a memory to use?
      • heap
    • Suppose I have an unsorted list of items (store receipts, perhaps). Should I sort the items before searching for an element?
      • If you will be searching the list many times, then yes, you should sort first
    • When you run the “CREATE INDEX” command in SQL, what type of data structure do you create?
      • B-trees
    • What HTTP status code means “I’m a teapot”?
      • 418
    • What is an example of a SQL injection attack?
      • When someone submits malicious SQL commands via a web form
    • How are the elements of an array stored in memory?
      • Contiguously
    • Which SQL query would allow you to select the ID of a specific movie star (Zendaya) in a table of movie stars?
      • SELECT id FROM moviestars WHERE name = 'Zendaya'
    • Why is a hash table faster to search than a linked list, even though the runtime for both is \(O(n)\)?
      • The hash table creates shorter linked lists to search rather than one long linked list
    • Game of thrones is a…
      • All of the above (Comedy, Drama, Historical, Fantasy, Documentary, Romance, Sci-Fi)
    • Which of the following is a golden rule when allocating memory?
      • All of the above (Every block of memory that you malloc must be freed, Only memory that you malloc should be freed, Do not free a block of memory more than once)
    • What do the binary bulbs on stage spell today?
      • ❤️

Emoji

  • In week 0, we talked about representing numbers and letters with ASCII. Emoji, too, might be represented with four bytes, like 11110000 10011111 10011000 10110111.
  • And you may have noticed that there are occasionally new emoji, governed by the Unicode Consortium.
  • Today we’re joined by Jennifer 8. Lee, ‘99, one of David’s former classmates, who has been involved in many endeavors, but particularly for advocating for emojis across cultures and groups of people:
    Emoji including hijab emoji with Rayouf Alhumedhi, sauna emoji with the Finnish government, red envelope emoji with Baidu, Dumpling emoji through Kickstarter, broccoli emoji with vegetarians, and DNA emoji with GE and the American Chemical Society
  • Jennifer took CS50 in 1994, and one of her classmates was the first intern for Netscape. In fact, Google did not exist when she was an undergrad.
  • A few years ago, Jennifer was texting her friend, Yiying Lu, when they both realized that a dumpling emoji doesn’t exist. So her friend, who is a designer, came up with her own image of a dumpling, and Jennifer was inspired to investigate who controls emoji.
  • She discovered the Unicode Consortium, a non-profit organization based in California, with technology companies and other organizations as voting members.
  • It turns out that, for $75 a year, individuals can become non-voting members who can attend meetings. Jennifer signed up and attended a meeting which was run by just a few people around a table.
  • So with her friend, Jennifer founded Emojination, a group with the motto “Emoji By The People, For The People.”
  • After running campaigns to gain popular support, they created a proposal for the emoji subcommittee in the Unicode Consortium. Once the proposal is approved, it is voted on.
  • There are also objective factors for whether an emoji is included:
    • Popular demand, or frequent requests
    • Multiple usages or meanings
    • Visual distinctiveness, or easily recognizable at small sizes
    • Whether they complete some gap, such as an orange heart among red, yellow, green, and blue hearts
    • Existing vendor compatibility, such as if one company already unofficially supports it
  • Factors that are considered against an emoji’s inclusion:
    • Too specific, or narrow
    • Redundant, or too similar to an existing emoji
    • Not visually discernible, like a cave
    • No logos, brands, deities, celebrities
    • No more flags
  • Once the proposals for new emoji are voted on, which happens once a year, then the companies that build operating systems and software add them to their devices and apps.
  • Emoji came about as little symbols popular in Japan many years ago, and as smartphones became popular as well, there needed to be a standard for all the software and devices that people use.
  • And the Unicode Consortium’s mission is to “enable people around the world to use computers in any language”.
  • So the Unicode Consortium has three main projects:
    • Encoding characters (including, but not limited to emoji), with over 100,000 now
    • Localization resources, like a repository of currencies or date and time formats for different countries
    • Programming libraries, so developers can localize their software more easily
  • In 2010, the Unicode 6.0 standard included the first emoji.
  • A Unicode code point is a unique number assigned to each Unicode character.
  • And some emoji might still be ambiguous, like 🙃.
  • It turns out that anyone can propose a emoji, as well, and many individuals and organizations have created proposals that were ultimately accepted, with the help of Emojination.
  • Jennifer personally cares about emoji because she grew up speaking Chinese, and many emoji and Chinese characters have similarities in representing objects or being combined to represent another concept.
    • The Chinese character for a forest is the character for a tree, right next to another character for a tree.
    • The character for “house” or “home” is a roof over the character for pig, as though a home is where your pigs are.
    • The character for “good” is the character for a woman next to a character for a child, which might be problematic by today’s standards.
  • These examples, and more, will be in The Hanmoji Handbook, coming out next year.
  • It turns out that the Unicode Standard also allows for a special character, the zero-width joiner, that combines multiple emoji. An emoji for an occupation, such as a farmer or chef, might be a man or woman emoji combined with a tractor or frying pan.
  • Skin tones, too, are combinations of existing emoji and certain colors.
  • It turns out that the face with tears of joy emoji, 😂, is almost 10% of all emoji usage. Almost all of the rest are used relatively infrequently, since there are so many.
  • Next year, there will be more new emoji, including hearts with more colors, birds, flowers, animals, food, objects, and even a shaking face.
  • Perhaps you, too, will come up with a new emoji proposal that can impact billions of people!