Toronto CSC 408F - CSC 408F/CSC2105F Lecture Notes

Unformatted text preview:

CSC 408F/CSC2105F Lecture NotesThese lecture notes are provided for the personal use ofstudents taking CSC 408H/CSC 2105H in the Fall term2004/2005 at the University of Toronto.Copying for purposes other than this use and all forms ofdistribution are expressly prohibited.cDavid B. Wortman, 1999,2000,2001,2002,2003,2004cKersti Wain-Bantin, 2001cYijun Yu, 20040Designing Portable SoftwarePortability - the ability to easily transfer a piece of software from one hardwareor software environment to anothercompare: Interoperatability - the ability to easily transfer a piece of informationfrom one software or hardware to anotherThere are many examples of good portable/interoperatable software, e.g.GNU C compiler, vi editor, many X applications, SQL queries, Javaapplet/applications, XML/SOAP, Web Services/WSDL, etc.Portability increases the market for a piece of software at a much lower costthan creating multiple independent versionsDesign for portability is generally compatible with the good design practicesdiscussed previouslyPortability generally enhances reusability Portability has to be designedinto the software (c.f. build for reuse), retrofitting portability is expensive1Portability TechniquesIsolation: Isolate all hardware/environment dependenciesParameterization via unique defining declarationsUse named constants and typesUnique declaration allows single point modificationConditional compilation and macro substitutionSubstitution at the module levelStandarization[Java: Write once, run everywhere] [XML: Write once, exchange everywhere][Web Services: Write once, call everywhere]Avoid embedded and distributed dependencies Magic numbers in thecode, Machine or system dependent programming2Portability Issues - SoftwareVariability in programming languages and compilers [Java/.NET story ... abattle behind the giants]– Manufacturer specific language extensions– Differences in run-time support libraries– Failure of compiler to adhere to language standard– Different implementation limits and system supplied defaultsPortability techniques– Program strictly according to language standard– Avoid manufacturer-dependent programming constructs– Avoid system supplied defaults– Use software tools (e.g. lint) to verify compliance with the standard– Use conditional compilation and macro expansion to isolate unavoidabledifferences3Portability Issues - SoftwareDifferences in Interface to Environment– Operating System, e.g. Unix(almost Unix, Linux, FreeBSD),DOS/Windows(3.1/95/98/NT/2000/XP/2003/Longhorn), MAC OS . . .– Input & Output, e.g. Unix, DOS/Windows, MAC, [Path separator], . . .– Database packages, e.g. dbm, Empress, SQL, . . .– Graphics, e.g. X11R?, SunView, DOS, Windows, curses, . . .– Browsers, e.g. Netscape, IE, Opera, Mozilla, Safari, Firefox . . .Portability techniques– Isolate all interfaces to external environment– Use standard internal data representations, convert on input/output– Parameterize all attributes (constants, types) affecting interface to environment– Use tables to encapsulate environment dependent information– Use conditional compilation and macro expansion to deal with unavoidabledifferences4Portability Issues - HardwareData representation– Numeric - integers, reals, IEEE vs. DEC vs IBM– Character - ASCII vs. EBCDIC, signed/unsigned, collating sequence– String - explicit length vs. null term, max length– Pointers - range & representations– Type size equivalence assumptionssizeOf(int) = sizeOf(address), sizeOf(int) = sizeOf(real)Portability techniques– Isolate all machine dependent code in separable modules– Parameterize data representation and machine specific information– Program to avoid hardware dependent constructs– Use conditional compilation and macro expansion– Use templates and application generators: e.g., generative programming,automated configuration5Portability Issues - Operating SystemsWide variety of Operating SystemsUnix-like: SunOs, System V, Ultrix, HPUNIX, AIX, IRIX, SEQUNIX, BSDOther: DOS, Windows, Next, MAC OS, OS/2, VMS, MVS,. . .File System Issues– File naming conventions– Directory structure, naming, traversing– Protection mechanisms, file attributes– Limits on concurrently open files– Physical structure of files, fixed vs. variable records– File access methods: sequential, random, byte, blockPortability techniques– Isolate all OS-specific code in separable modulesUse module level substitution– Use conditional compilation and macro expansion6Building Portable SoftwareDocument rules for customizing softwaree.g. table of optionsIsolate customization to a small number of separate files that may controlcustomization of other filese.g. Makefile, config.hTry to provide a customization tool (shell script)Make configconfigure VMS DECMIPSTry to make documentation track customization using conditional textTest customization thoroughly7Legal Issues for Software EngineersabContracts - software acquisition or custom developmentLiability and Negligence, WarrantiesIntellectual Property - Copyright, Trade Secrets & PatentsWorld Wide Web Legal IssuesaAn informed civilian’s comments on legal matters affecting software engineers.If you need real legal advice, consult a real lawyerbB. Sookman, Computer Law, CCH Publishers, 1989+annual updates8Software ContractsAgreement by customer to purchase specified piece of software from vendorNeed to precisely set out– Nature of the software being produced, requirements or detailed specifications– Other goals affecting the software, e.g. performance, reliability, compatibility, etc.– Acceptance conditions, when is software complete?– Exception handling - breaches of the agreement by customer or vendor, changesin requirements or specification, cost or schedule overruns– Warranties and guarantees provided by the vendorMethods of payment– Fixed Price– Cost plus, vendors expenses + profit– Per diem perhaps with an upper bound– Progress payments at major milestones9Contracting IssuesBuyer and vendor cooperate on developing requirementsDevelop system specifications. A complete, correct and unambiguousspecification is in the best interest of both partiesContract sets out rights and obligations of buyer and vendorContract lists deliverables and settles ownership of the software, especiallythe source code and internal


View Full Document

Toronto CSC 408F - CSC 408F/CSC2105F Lecture Notes

Download CSC 408F/CSC2105F Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CSC 408F/CSC2105F Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CSC 408F/CSC2105F Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?