1 / 8

Design and Implementation*

Design and Implementation*. Objective: To design and implement a program for a relatively small yet reasonably complicated problem. To introduce and review a variety of implementation languages and to have students review the pros and cons of different implementation choices and languages.

naylors
Download Presentation

Design and Implementation*

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. Design and Implementation* • Objective: To design and implement a program for a relatively small yet reasonably complicated problem. To introduce and review a variety of implementation languages and to have students review the pros and cons of different implementation choices and languages. • “Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious” – Frederick P. Brooks, The Mythical Man Month *The examples in these slides come from Brian W. Kernighan and Rob Pike, “The Practice of Programming”, Addison-Wesley, 1999.

  2. Themes • “Once the data structures are laid out, the algorithms tend to fall into place, and the coding is comparatively easy” • The choice of programming language is relatively unimportant to the overall design. • Comparing implementations demonstrates how languages can help or hinder, and ways in which they are unimportant.

  3. Topics • Problem: Generate random English text that reads well. • Program: some data comes in, some data goes out, and the processing depends on a little ingenuity. • Implementations: C, C++, Java, Perl

  4. Failed Attempts • Generate random letters (even with proper frequency. • Generate random words chosen from a dictionary • Need a statistical model with more structure (frequency of whole phrases)

  5. Markov Algorithm • set w1 and w2 to the first two words in the text • print w1 and w2 • loop: • randomly choose w3, one of the successors of w1 and w2 (in sample text) • print w3 • replace w1 and w2 by w2 and w3

  6. Sample Markov Algorithm • Input Prefix: • show your • your flowcharts • flowcharts and • flowcharts will • your tables • will be • be mystified • be obvious • Suffix words that follow • flowcharts tables • and will • conceal • be • and and • mystified. obvious. • Show • (end)

  7. Hash Table to Find Suffix Following Two Word Prefix a state: “show” pref[0] pref[1] “your” “flowcharts” suf a suffix: next word next another state: another suffix: pref[0] pref[1] word “tables” suf next next

  8. Implementation • See lecture outline for links to 4 different implementations • C (see Makefile) • C++ • Java • Perl • What are the pros and cons of the different implementations?

More Related