210 likes | 311 Views
Software. Apps, code, runtime, compiled, compilers, interpreters…. Main points. Software must run as machine code (0’s and 1’s) It has to control every step of the CPU, including: what operation to do where in memory things must go how to get data in and out and stored
E N D
Software Apps, code, runtime, compiled, compilers, interpreters…..
Main points • Software must run as machine code (0’s and 1’s) • It has to control every step of the CPU, including: • what operation to do • where in memory things must go • how to get data in and out and stored • The aim is to make it easy for the user and let the computer do the work
A great divide • Operating systems • Applications
Operating systems (including BIOS) • A machine-code program that manages the computer so that it can run programs. • Examples: • Current: Windows, MacOS, IOS, Android • Past: MS-DOS, CP/M & MP/M, RSTS, VMS, GEM • A BIOS is a basic input/output system ROM that mostly manages the main circuit board. It includes a bootstrap program that loads a loader that loads the operating system, thus “pulling itself up by its own bootstraps.”
What’s in it? • An OS must: • Start the system • Offer an interface between the user and the system, e.g. a GUI/WIMP or command line • Control access to primary storage • Control input/output devices & secondary storage • Provide services for programs/applications, like multi-tasking, virtual memory and security
Applications / User programs • Can do anything the operating system allows • Must be in binary machine code (executable) • Must not interfere with each other’s memory or how they run
Computer languages : High-level • Examples are BASIC, FORTRAN, Algol, Pascal • These use a few English words in precise ways, like For, If, Then, Begin, End • They need a compiler to turn them into machine code • Or an interpreter to read them and follow them at execution time, also known as a virtual machine or a run-time-system. Early BASICs did this and it made them slow.
Computer languages – low-level • Low-level usually means machine code or assembler • Machine codes are available from the microprocessor manufacturer’s data books • You use a simple editor/debugger to put it in and run it • In some cases, you can use assembly language
Intermediate Languages • These often link machine code modules, with little attempt at optimisation, but the way they link makes them fast anyway. • Forth is a good example. • Some microprocessors have been built that run intermediate languages as their machine code, though this makes a slower, much more complicated processor.
Utilities • Media formatting • File manager (explorer) • Disk defragmenter • Antivirus/antimalware • Duplicate file detectors • Backups • Fault diagnosis • PnP (plug’n’playbuilt into some operating systems.)
Two Origins… • Custom programs • Expensive • Need skilled employees to write them • Written to fit exactly what you want • Can get outdated easily (e.g. Y2K bugs) • Can be incompatible with other programs • Off-the-shelf • Cheap • May be adaptable by the user. • General-purpose • Are usually updated, but not always backwards-compatible • Are often mutually compatible (e.g. Microsoft Office)
Two approaches… • Proprietary software • One manufacturer/manager/programming team • Consistency • Reliability/quality control • Evolution of product to maintain reputation • Open-source • Anyone can contribute • Can be developed more quickly • Changes can be inconsistent or unreliable • Contributors can be anywhere in the World
Open/proprietary • Open – Linux • Open operating systems rely on all computers working the same. • Proprietary – Unix, Windows, MacOS • Open – Open Office • Proprietary – Microsoft Office
Flowcharts Start • *Can be easy to follow • *Nearly all stages are obvious • *Can colour code • *Look pretty for presenting to customers • *Difficult to link neatly • *Little space for notes or explanations • You can spend lots of time adding and rotating graphics if you’re not careful. • Needs plenty of practice. Wet hair Work into a lather Rinse & repeat
*Pseudo-code • *English-like statements • *Easy to write what the customer says he wants and translate from that • *Plenty of space to write and continue onto next page(s) or “call” another page, to write later • Can be easy to refine the design over and over • *Can be too wordy • *Can be too high-level to create the code.
What does this pseudo code do? • Set pi to 3.14 • Ask user for radius • Print radius to power 2 times pi
More pseudocode Loop for each item in the list - 1 loop for each item in the list -1 If next < current, then swap them Loop end Loop end
More pseudocode Ask user for line length Repeat Ask user for number of sides Until number of sides >2 For I = 1 to number of sides Draw line of length line length Turn clockwise 360 divided by number of sides End for
Now you write: • Pseudocode that asks for a price, calculates the VAT (20%), then prints out the VAT and the total • Pseudocode that asks for height & radius, then calculates the volume of a cylinder - r2h
And this? Loop for I from 1 to n-1 Loop for J from 1 to n-1 If item(j) > item(J+1) Then swap them Else do nothing Loop end Loop end