1 / 10

What's ahead in Compsci 6/101?

What's ahead in Compsci 6/101?. Software architecture and design, why Jotto has modules and how communication works We write small programs, want to understand some principles of larger programs Software design in the small and in the large: different!

Download Presentation

What's ahead in Compsci 6/101?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What's ahead in Compsci 6/101? • Software architecture and design, why Jotto has modules and how communication works • We write small programs, want to understand some principles of larger programs • Software design in the small and in the large: different! • Dictionaries: associating keys with values • Arguably the most useful method for structuring data • How does Google find 'good' sites for a query? • How do we find what region in a genome encodes a protein? • How do we determine literary/other fingerprints?

  2. Jotto: The Program Architecture • You write jottoModel.py • This is the guts, brains, state of the program • Keeps track of how the game is progressing • Functions in the module communicate via global state • We provide two views: command-line and GUI • These all you to view and control the model • Both view-controllers: jottoMain.py and jottoGui.py know about the model, but model doesn't know about them • Model-View or Model-View-Controller • Often the model knows there is/are view(s) not Jotto

  3. Maria Klawe Chair of Computer Science at UBC, Dean of Engineering at Princeton, President of Harvey Mudd College, ACM Fellow,… Klawe's personal interests include painting, long distance running, hiking, kayaking, juggling and playing electric guitar. She describes herself as "crazy about mathematics" and enjoys playing video games. "I personally believe that the most important thing we have to do today is use technology to address societal problems, especially in developing regions"

  4. Useful Computer Science • http://maps.google.com/maps?f=d&source=s_d&saddr=300+W+Morga n+St,+Durham,+NC+27701+(Blue+Coffee+Express)&daddr=2324+Duke +University+Road,+Durham,+NC+27708&hl=en&geocode=FcNJJQIdYw5 M-yGT6vAZOfvdQg%3B&mra=ls&sll=36.088126,-79.01786&sspn=1.333 898,2.11212 Blue Coffee Express Durham 2324 Duke University Road

  5. How does this work? • http://tinyurl.com/d5o8mr

  6. What is a dictionary, map, hash, table? • Abstraction: collection of (key,value) pairs • What kind of ice-cream do you like? • You are the key, ice cream is the value Robert Susan Jeff Alex Bruce Sam

  7. What does this code do? How? def fileStatsList(filename): file = open(filename) statList = [] for word in file.read().split(): found = False for pair in statList: if pair[0] == word: pair[1] += 1 found = True break if not found: statList.append([word,1]) file.close() return statList

  8. Faster, Cheaper, Totally in Control def fileStatsDictionary(filename): file = open(filename) stats = {} for word in file.read().split(): if word in stats: stats[word] += 1 else: stats[word] = 1 file.close() return stats

  9. Accessing map • Index a map by a key, using […] • Like indexing a list, but index is a string, …. not integer! • Works internally by associating a number with the key • This association is known as hashing the key • Methods for dictionaries: • .clear(), .get(key), .get(key,default) • .keys(), .values(), .items() • When using iteration or x in d, we're talking keys • Iterate over keys, query about keys, and so on

  10. Literary Fingerprint • Timing and playing with code in fingerPrint.py • How do we find out how fast this is? • How do we change the format of the output? • Can we organize output differently? • How can we find 'other' fingerprints • Shazaam, genome, images • What will be the key, what will be the value?

More Related