The specification states - you should be able to:
Describe the purpose of a computer program (source code).
Describe the main features of an integrated development environment (IDE).
Explain the process of translation.
A computer program is a specific set of ordered instructions to be performed by a computer. The program represents a solution to a problem. A computer will usually get one instruction, execute it and then get the next instruction.
Computer programs can be written in high level programming languages such as C#, Java, Visual Basic and Python. They can also be written in low level languages such as machine code and assembly language. A series of language statements (solution) are written to solve a problem, this is called the source code or source program.
[CCEA Fact File]
1. (b) During systems development, programmers are responsible for writing the source code. (i) Define the term source code. [2]
A program written in a high level language/assembly language.
… in human readable form/including comments/formatting/white space/meaningful identifiers.
It has to be translated/assembled/compiled before it can be executed.
[CCEA 2019 Q1bi]
5(b) Explain why the client is not provided with the source code. [2]
The source code could be edited by the user
… introducing errors/unauthorised changes/depriving the developer of maintenance work.
[CCEA 2022 Q5b]
Program code can be created using a text or code editor. The code is then translated into machine code. Source code cannot be executed unless it is fully compiled. If a text editor is used, the program will have to be compiled using program software. More advanced software known as an Integrated Development Environment (IDE) provides programmers with all of the facilities required to complete the development of an application from coding to testing. This means that an application can be developed fully within one application.
Typically, an IDE consists of the following elements:
Source code editor.
Compiler.
Debugger.
Graphical User Interface (GUI) builder with an associated toolbox of controls.
Solution Explorer.
[CCEA Fact File]
6 (a) An integrated development environment (IDE) enables a programmer to key in and run a computer program. Identify three other features of a typical IDE. [3]
Project file management support: directory trees and Solution Explorer.
Design tools/GUI builder.
Smart editor/syntax checker/syntax suggestions/automatic tabs/automatic comments/automatic white space/automatic line numbering
Debugging tools: breakpoints, variable inspection and tracing.
[CCEA 2023 Q6a]
Clipboard
Where the IDE can remember the last number of items copied. Programmers can rotate through the list of copied items and choose one to paste into the current file.
Code Outlining
Programmers can collapse/expand selected regions of code under their first lines. This means that long programs can be viewed in small logical sections.
Code suggestion IntelliSense
As you enter a function or statement in the Code Editor, its complete syntax and arguments are shown in a ToolTip. When items are needed to complete a statement, IntelliSense provides popup insertion lists of available functions, statements, constants, or values to choose from. This is known as IntelliSense in Microsoft Visual Studio.
Line Numbering
Line numbers help programmers to distinguish between lines in lengthy coding sections.
Syntax error assistance
As code is entered, the Code Editor will place ‘wavy lines’ beneath code that is incorrect or could cause a problem.
Many IDEs, such as Microsoft Visual Studio provide colour coded error listings. For example, the Error List displays coding problems marked with ‘wavy lines’. Programmers can click on any Error List entry to jump to the code where the problem occurs.
Red lines mark syntax errors, these lines disappear as soon as the marked code is corrected in the Code Editor.
Blue lines mark semantic errors detected by the compiler, such as a mistyped class name not found in the current context. These disappear after the marked code is corrected and then recompiled.
Green lines mark warnings. Programmers can review these messages to see if the code needs to be modified.
Compiler
The process of compiling ultimately produces an executable (.exe) file. (In some languages there may be intermediary translation processes). The code written by the programmer is compiled with any additional libraries to create a machine code version of the program. This can then be executed by the processor. Compiling is the core translation process. A program cannot be successfully compiled unless it is error free.
Graphical User Interface (GUI) builder with an associated toolbox of controls
The GUI builder allows a programmer to create windows applications by positioning controls on screen. Controls such as textboxes, combo-boxes and radio buttons can be added to forms by dragging them from a toolbox. There are usually two views: a graphical design view and a code view. Design view allows programmers to specify the location of controls and other items on the user interface.
Solution Explorer
This is a graphical representation of the entire solution. The window displays solutions, their projects, and the items in those projects. Usually, files can be opened for editing, new files can be added and item properties can be viewed.
Debugging and break points
Programs can contain logic problems which become apparent at run-time. This is where the code, although syntactically correct, is not providing the correct results. The debugger can be used to help detect and correct such problems. Programmers can set breakpoints where the program will stop during execution and allow the programmer to examine the value of different variables.
[CCEA Fact File]
Code written in a high level language can be read and understood by humans and requires translation so that the computer can execute the commands in the program.
Translators include compilers, interpreters or assemblers.
An assembler translates assembly language into machine code. Assembly language is a low-level language.
An interpreter translates source code one line at a time. The processor executes a line of code before proceeding to translate the next line of code. No version of the machine code is stored. This is generated each time the program is run.
A compiler will attempt to convert the whole program into machine code before executing it. During the first stage of translating a program, the syntax of each statement is checked. If the statements are not constructed correctly the compiler will generate a list of errors. The source code cannot be fully compiled until all syntax errors are removed from the code.
The source code is “compiled” using a language compiler and the result is called an object program (not to be confused with object-oriented programming). The object program contains the string of 0s and 1s called machine code or native code. This fully compiled version is also known as an executable version.
A compiler may perform:
Lexical analysis – converting the incoming source code into fixed length binary code items called tokens;
Pre-processing – including library code for classes and methods used within the source code;
Parsing or syntax analysis – checking the statements within the code to ensure they conform to the rules of grammar for the language;
Semantic analysis – this includes checking to see that variables are declared before being used and type checking;
Code Generation – creating the machine code version of the source code;
Code optimisation – making the executable program as efficient as possible.
[CCEA Fact File]
5. A software house develops an application for a client. The developer provides the client with the object code, but not the source code. (a) Describe how each of the following translates source code. Interpreter and Compiler. [6]
Interpreter:
Translates one line at a time.
If there is an error, translation terminates.
If there is no error, the statement is expected.
No object code is produced Interpretation can be resumed.
Compiler:
Translates the entire program into machine code
... before executing it if there are no errors.
If there are errors, an error list is produced.
[CCEA 2022 Q5a]
4 (b) Describe the main features of each of the following. A source code editor and a complier. [8]
Source code editor
Syntax checker/assistance Code/syntax suggestions/IntelliSense Automatic tabs/layout.
Comments.
White space.
Automatic line numbering.
Compiler
Converts all of the source code into machine code before executing it/ creates the machine code/intermediate code.
Performs Lexical/Syntax/Semantic analysis.
If statements are not structured properly, it generates a list of errors.
Optimises code.
[CCEA 2021 Q4b]
Many languages have been implemented using both compilers (Complete solution) and interpreters (Line by line). Some language implementations create intermediary versions of code and the machine code is then generated at run-time.
For example c#:
Compiling translates the source program into common intermediate language (CIL) and generates the required metadata. This is stored as an assembly.
At execution time, a just-in-time (JIT) compiler translates the CIL into native code. During this compilation, code must pass a verification process that examines the CIL and metadata to find out whether the code can be determined to be type safe.
The common language runtime (CLR) enables execution to take place. The code to be executed is converted to processor-specific native code.
Python and Java programs are converted into a form of bytecode before they can be executed. Bytecode is computer code that is processed by a program, usually referred to as a virtual machine rather than by the computer’s processor. The virtual machine converts each generalized machine instruction into a specific machine instruction that this computer’s processor will understand.
[CCEA Fact File] [Nothing like this has ever been asked before, as you can see it is quite complex. I would say highly unlikely to come up]