1 / 31

CSCI3100 Mid Term Preview

CSCI3100 Mid Term Preview. Zachary Ling 3-3-2014. Agenda. Recap of important concepts Data Flow Diagram Finite State Machine Petri Net Logic Specification Key Points for Each Chapter. Data Flow Diagram. Describe systems as collection of data that are manipulated by functions. Function.

fell
Download Presentation

CSCI3100 Mid Term Preview

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. CSCI3100Mid Term Preview Zachary Ling 3-3-2014

  2. Agenda • Recap of important concepts • Data Flow Diagram • Finite State Machine • Petri Net • Logic Specification • Key Points for Each Chapter

  3. Data Flow Diagram • Describe systems as collection of data that are manipulated by functions Function Input / Output Output Device Data Storage Data Flow

  4. Data Flow Diagram • Function: • Let your reader know what the system do Validate ID Function A Search Video Notification

  5. Data Flow Diagram • Data Flow: • ALL data must flow between a function and something else • Data is object, you should not write a verb or action on an data flow notify user Info to notify user Borrow Video Validate ID Borrower ID Money Donald Millionaire

  6. Data Flow Diagram • Input or Output Device • Data comes from data storage or an input device or another function • Data goes to data storage, an output device or another function • Use an object as the output device Borrower Book Shelves Book Title Book Borrow Book Reception Notification Printer Notify Book

  7. Data Flow Diagram • Data storage • No need to draw data flow for the queries, e.g. “Book Title” • Just assume you can get the data directly • Only send data to data storage when we are saving data, e.g. putting a new book into bookshelves • Don’t duplicate the databases when they are actually the same Book Shelves Book Shelves User Database User Database Book Book Title Book Borrow Return Book User Data User Data Update

  8. Data Flow Diagram • Exercise: • Tang: Let’s make it fully automated by a computer system. A “voter” input his/her “choice of candidate” into the “voting” system. After that, a “ballot” will be generated and stored in a “ballot database”. When we have to “count” the ballots, we just get the “ballot” from the “ballot database” and display the “polling result” on the “screen” in the polling station. • You: So the “voter” should first present his/her HKID card to the smart card reader. The “HKID” together with “voter detail” from the “qualification database” would be used to “verify the qualification” of the voter • You: …… For security reason, I think that before we “count” the “ballot”, we should “verify the ballot” with “voter detail” from the “qualification database” once more. Then we can safely “count” the “verified ballot” in that polling station.

  9. Data Flow Diagram • Solution:

  10. Finite State Machine • Model for describing control aspects of the system • Describe how the system interact with external input rather than internal state State Input

  11. Finite State Machine • Input • Make sure that you know what are the input to the system that your diagram is going to describe • Every edge has an input • E.g. To describe the FSM Air Hockey machine A inserts coin A wins/goal 2:0 Wait

  12. Finite State Machine • State • When to create a new state? • When your current FSM can’t handle all possible input and behavior of the system • When to NOT create a new state? • When you can’t find any input that connect the states • Give the states a label for easy reading Waiting Coins Game Start Insert coins

  13. Finite State Machine • Exercise • Using FSM to model a simplified iPod mp3 player with one button, one wheel and one display. When pushing button 1 (more than 3 seconds) to turn the display bright (not playing songs right now), rotating the wheel to select songs (not playing songs right now), pushing button 1 to play/stop the song, rotating the wheel to adjust the volume (when playing songs), pushing button 1(more than 3 seconds) to turn off the display. The machine can be turn off while playing, but you can only select songs when the player is stopped. • Input? • State?

  14. Finite State Machine • Solution

  15. Finite State Machine • Exercise: • Design a finite state machine with input alphabet {0, 1}, which accepts those strings, and only those strings, that are the binary representation of a nonnegative integer that is divisible by 5. (Hint: you need at least 5 states.)

  16. Finite State Machine • Solution: • We assume MSB comes first • 1101 = 110 * 2 + 1 • 1100 = 110 * 2

  17. Petri Net • A model for specifying asynchronous system Place Transition Token

  18. Petri Net • Transition • Number on edge represent number of token to consume or produce • Transition can be fired in any sequence as long as resources are available • Deadlock – no more possible transition Consume 3 tokens, Produce 2 tokens 2 2

  19. Petri Net • Exercise: • A Petri Net is live if from any marking reached from the initial marking, there exists a firing sequence to enable any transition in the net. Determine if the Petri Net below is live. Please elaborate your answer in detail.

  20. Petri Net • Solution • The Petri Net is not live, because all possible firing sequences from the specified initial marking are subsets of the two firing sequences • t1 • t3->t4->t5->t1->t2 • After the firing of either of these sequences there exist no enabled transition.

  21. Petri Net • Exercise: • Consider two tasks J1 and J2 running on a single CPU. Model with a Petri Net the status of the CPU. You may assume that the two tasks are not preemptive. The CPU can be in one of the following three states: CPU state = {J1 running; J2 running; Idle}.

  22. Petri Net • Solution

  23. Logic Specification • A formula of a first-order theory (FOT) is an expression involving variables, numeric constants, functions, predicates and parentheses. • Logical connectives: and, or, not, implies, and • Quantifiers: exists, for all • Result of a FOT formula must be Boolean.

  24. Logic Specification • Exercise:

  25. Logic Specification • Solution • False: not end with * • False: the separating characters are not ^ • False: not have tailing ^ after the last element • False; only two words k=2 • True; k=3; m1=2, h1=1; m2=5, h2=1; m3=9, h3=1 • True; k=4; m1=2, h1=5; m2=9, h2=1; m3=13, h3=3; m4=20, h4=4;(Note that input_element specifies that an input element could have tailing digits but it does not have to.)

  26. Topic 1 • Software life cycle • The waterfall model • How cost changes in each stage

  27. Topic 2 • Understand all the vocabulary • Knowing the nature of software • Justify the quality of a software • Correctness, Reliability • Performance • User Friendliness • Verifiability • Maintainability • Reusability • Portability • Understandability • Interoperability • Productivity • Timeliness • Visibility

  28. Topic 3 • Software design principle • Understand all the vocabulary • Knowing how and why people design software that way • Rigor and Formality • Separation of Concerns • Modularity • Abstraction • Anticipation of Change • Generality • Incrementality

  29. Topic 4 • What is a good specification? • UML • DFD • FSM • PN • ER Diagram • Logic Specific • Pros and Cons for each of these

  30. This exam is closed book, open only 1 A4 page note, closed neighbors. No calculators, PDAs, cell phones, SMS devices, … • This Exam has 14 pages (don’t panic … there are lots of pictures and space for your answers). • Print your student ID number where indicated above. • For true/false questions, circle true or false in the left margin. • For the problems, draw your solutions neatly in the space provided. • All answers are to be given on these pages. Use the back sides of the pages only if necessary, with a reference as to where any extra portion of the answer is located. • The maximum score for this exam is 110 points. Each true/false question is worth 1.5 point, while other problems have varying point values as indicated near each problem. • You have 105 minutes to complete the exam – that is, until 12:15 pm. Plan your time accordingly.

  31. Good luck on the Exam! Don’t go to the wrong classroom!

More Related