⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preface.html.svn-base

📁 纯C数据结构
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
projects off the ground. This usage helps students realize the enormous savingsthat reuse can bring to a project, and it often induces them to tryinterface-based design for their own parts of the project. This latter effect isparticularly valuable in team projects, because that's a way of life in the &quot;realworld.&quot;</P><P>Interfaces and implementations are the focus of Princeton's sophomore-levelsystems programming course. Assignments require students to be interfaceclients, implementors, and designers. In one assignment, for example, Idistribute Section 8.1's <CODE>Table</CODE> interface, the object code for itsimplementation, and the specifications for Section 8.2's word frequency program,<CODE>wf</CODE>. The students must implement <CODE>wf</CODE> using only myobject code for <CODE>Table</CODE>. In the next assignment, they get the objectcode for <CODE>wf</CODE>, and they must implement <CODE>Table</CODE>.Sometimes, I reverse these assignments, but both orders are eye-openers for moststudents. They are unaccustomed to having only object code for major parts oftheir program, and these assignments are usually their first exposure to thesemiformal notation used in interfaces and program specification.</P><P>Initial assignments also introduce checked runtime errors and assertions asintegral parts of interface specifications. Again, it takes a few assignmentsbefore students begin to appreciate the value of these concepts. I forbid &quot;unannounced&quot;crashes; that is, crashes that are not announced by an assertion failurediagnostic. Programs that crash get a grade of zero. This penalty may seemunduly harsh, but it gets the students' attention. They also gain anappreciation of the advantages of safe languages, like ML and Modula-3, in whichunannounced crashes are impossible. <SMALL>(This grading policy is less harshthan it sounds, because in multipart assignments, only the offending part ispenalized, and different assignments have different weights. I've given manyzeros, but none has ever caused a course grade to shift by a whole point.)</SMALL></P><P>Once students have a few interfaces under their belts, later assignments askthem to design new interfaces and to live with their design choices. Forexample, one of <A HREF="http://www.cs.princeton.edu/~appel/">Andrew Appel</A>'sfavorite assignments is a primality testing program. Students work in groups todesign the interfaces for the arbitrary-precision arithmetic that is needed forthis assignment. The results are similar to the interfaces described in Chapters17 through 19. Different groups design interfaces, and a postassignmentcomparison of these interfaces, in which the groups critique on one anothers'work, is always quite revealing. <A HREF="http://www.cs.princeton.edu/~li/">KaiLi</A> accomplishes similar goals with a semester-long project that builds anX-based editor using the <A HREF="http://www.sunlabs.com/research/tcl/">Tcl/Tksystem</A> (J.K. Ousterhout, <CITE>Tcl and the Tk Toolkit</CITE>,Addison-Wesley, 1994) and editor-specific interfaces designed and implemented bythe students. Tk itself provides another good example of interface-based design.</P><P>In advanced courses, I usually package assignments as interfaces and givethe students free rein to revise and improve on them, and even to change thegoals of the assignment. Giving them a starting point reduces the time requiredfor assignment, and allowing substantial changes encourages creative students toexplore alternatives. The unsuccessful alternatives are often more educationalthan the successful ones. Students invariably go down the wrong road, and theypay for it with greatly increased development time. When, in hindsight, theyunderstand their mistakes, they come to appreciate that designing goodinterfaces is hard, but worth the effort, and they almost always become convertsto interface-based design.</P><H2>How to Get the Software</H2><P>The software in this book has been tested on the following platforms.</P><BLOCKQUOTE><TABLE CELLPADDING="12"><TR ALIGN="LEFT" VALIGN="TOP"><TH><I>Processor</I></TH><TH><I>Operating Systems</I></TH><TH><I>Compilers</I></TH></TR><TR ALIGN="LEFT" VALIGN="TOP"><TD ALIGN="LEFT">SPARC</TD><TD>SunOS 4.1</TD><TD>lcc 3.5<BR>gcc 2.7.2</TD></TR><TR ALIGN="LEFT" VALIGN="TOP"><TD>Alpha</TD><TD>OSF/1 3.2A</TD><TD>lcc 4.0<BR>gcc 2.6.3<BR>cc</TD></TR><TR ALIGN="LEFT" VALIGN="TOP"><TD>MIPS R3000</TD><TD>IRIX 5.3</TD><TD>lcc 3.5<BR>gcc 2.6.3<BR>cc</TD></TR><TR ALIGN="LEFT" VALIGN="TOP"><TD>MIPS R3000</TD><TD>Ultrix 4.3</TD><TD>lcc 3.5<BR>gcc 2.5.7</TD></TR><TR ALIGN="LEFT" VALIGN="TOP"><TD>Pentium</TD><TD>Windows 95<BR>Windows NT 3.51<BR><SMALL>(except for Threads)</SMALL></TD><TD>Microsoft Visual C/C++ 4.0</TD></TR></TABLE></BLOCKQUOTE><P>A few of the implementations are machine-specific; they assume that themachine has two's-complement integer and IEEE floating-point arithmetic, andthat unsigned longs can hold object pointers.</P><P>The source code for everything in this book is available for<A HREF="ftp://ftp.cs.princeton.edu/pub/packages/cii">anonymous ftp</A> at<TT>ftp.cs.princeton.edu</TT> in <TT>pub/packages/cii</TT>. Use an <TT>ftp</TT>client to connect to <TT>ftp.cs.princeton.edu</TT>, change to the directory<TT>pub/packages/cii</TT>, and download the file<A HREF="ftp://ftp.cs.princeton.edu/pub/packages/cii/README">README</A>, whichdescribes the contents of the directory and how to download the distribution.</P><P>The most recent distributions are usually in files named <TT>cii</TT><I>xy</I><TT>.tar.gz</TT>or <TT>cii</TT><I>xy</I><TT>.zip</TT>. <I>xy</I> is the version number,e.g., 10 is version 1.0. <TT>cii</TT><I>xy</I><TT>.tar.gz</TT> is a U<SMALL>NIX</SMALL>tar file compressed with <TT>gzip</TT>, and <TT>cii</TT><I>xy</I><TT>.zip</TT>is a ZIP file compatible with PKZIP version 2.04g. The files in<TT>cii</TT><I>xy</I><TT>.zip</TT> are DOS/Windows text files; that is, theirlines end with carriage returns and linefeeds.<TT>cii</TT><I>xy</I><TT>.zip</TT> may also be available on America Online,Compuserve, and other online services.</P><P>Information is also available on the World-Wide Web at URL<A HREF="http://www.cs.princeton.edu/software/cii/">http://www.cs.princeton.edu/software/cii/</A>.This page includes instructions on reporting bugs.</P><H2>Acknowledgments</H2><P>I have been using some of the interfaces in this book for my own researchproject and in courses at the University of Arizona and Princeton Universitysince the late 1970s. Students in these courses have been guinea pigs for mydrafts of these interfaces. Their feedback over the years has been an importantcontribution to both the code in this book and its explanation. The Princetonstudents in several offerings of COS 217 and COS 596 deserve special thanks,because they suffered unknowingly through the drafts of most of what's in thisbook.</P><P>Interfaces are a way of life at Digital's System Research Center (SRC), andmy 1992 and 1993 summers at SRC working on the Modula-3 project erased anydoubts I may have harbored about the efficacy of this approach. My thanks to SRCfor supporting my visits, and to Bill Kalsow, Eric Muller, and Greg Nelson formany illuminating discussions.</P><P>My thanks to IDA's Centers for Communications Research in Princeton and LaJolla for their support during the summer of 1994 and during my 1995&#150;96sabbatical. The CCRs provided ideal hideouts at which to plan and complete thisbook.</P><P>Technical interactions with colleagues and students have contributed to thisbook in many ways. Even seemingly unrelated discussions have provokedimprovements in my code and in its explanation.  Thanks to Andrew Appel, GregAstfalk, Jack Davidson, John Ellis, Mary Fern&aacute;ndez, Chris Fraser, AlexGounares, Kai Li, Jacob Navia, Maylee Noah, Rob Pike, Bill Plauger, John Reppy,Anne Rogers, and Richard Stevens. Careful readings of my code and prose by RexJaeschke, Brian Kernighan, Taj Khattra, Richard O'Keefe, Norman Ramsey, andDavid Spuler made a significant contribution to the quality of both.</P><P><A HREF="./">Back to the CII home page</A>.</P><HR><ADDRESS><A HREF="http://www.cs.princeton.edu/~drh/">David Hanson</A> /<A HREF="mailto:drh@cs.princeton.edu">drh@cs.princeton.edu</A><BR>$Revision: 1.8 $ $Date$</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -