Page 194 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 194

Unit 9: Software Development



                          Compilers are used to translate source code from a programming language   Notes
                          into either object code or machine code. Object code needs further processing
                          to become machine code, and machine code is the central processing unit’s
                          native code, ready for execution.

                          Interpreted computer programs -in a batch or interactive session—are either
                          decoded and then immediately executed or are decoded into some efficient
                          intermediate representation for future execution. BASIC, Perl, and Python
                          are examples of immediately executed computer programs. Alternatively,
                          Java computer programs are compiled ahead of time and stored as a machine
                          independent code called bytecode. Bytecode is then executed on request by an
                          interpreter called a virtual machine.
                          The main disadvantage of interpreters is that computer programs run slower
                          than when compiled. Interpreting code is slower than running the compiled
                          version because the interpreter must decode each statement each time it is
                          loaded and then perform the desired action. However, software development
                          may be faster using an interpreter because testing is immediate when the
                          compiling step is omitted. Another disadvantage of interpreters is that at least
                          one must be present on the computer during computer program execution.
                          By contrast, compiled computer programs need no compiler present during
                          execution.

                          No properties of  a  programming  language  require  it  to  be  exclusively
                          compiled  or  exclusively  interpreted.  The  categorization  usually  reflects
                          the most popular method of language execution. For example, BASIC is
                          thought of as an interpreted language and C a compiled language, despite
                          the existence of BASIC compilers and C interpreters. Some systems use
                          just-in-time compilation (JIT) whereby sections of the source are compiled
                          ‘on the fly’ and stored for subsequent executions.
            9.1.10 Self-Modifying Programs

            A computer program in execution is normally treated as being different from the data the program
            operates on. However, in some cases this distinction is blurred when a computer program modifies
            itself. The modified computer program is subsequently executed as part of the same program.
            Self-modifying code is possible for programs written in machine code, assembly language, Lisp,
            C, COBOL, PL/1, Prolog and JavaScript (the eval feature) among others.
            9.1.11 Execution and Storage

            Typically, computer programs are stored in non-volatile memory until requested either
            directly or indirectly to be executed by the computer user. Upon such a request, the program
            is loaded into random access memory, by a computer program called an operating system,
            where it can be accessed directly by the central processor. The central processor then executes
            (“runs”) the program, instruction by instruction, until termination. A program in execution
            is called a process. Termination is either by normal self-termination or by error, software
            or hardware error.









                                             LOVELY PROFESSIONAL UNIVERSITY                                   187
   189   190   191   192   193   194   195   196   197   198   199