代写代考 CSI2520, – cscodehelp代写

Programming Paradigms
Discussion

• Imperative programming: the program consists of a sequence of statements to be executed sequentially

Copyright By cscodehelp代写 加微信 cscodehelp

• Logic programming: the program describes the properties of the desired solution and an inference mechanism proposes solutions that meet these criteria.
• Functional programming: the program is seen as a transformation of the input data in order to obtain the desired output.
• Object-oriented programming: the program is broken down into a set of objects interacting with each other through the exchange of messages.
• Concurrent programming: the program allows the division of the tasks to be accomplished into a set of several asynchronous processes that can be executed in parallel.

Why study programming languages?
• Facilitate the expression of ideas by using an expressive programming language for the intended application.
• Provide the knowledge enabling a programmer to choose an appropriate language.
• Use language more effectively.
• Increase the efficiency of the resulting code.
• Facilitate the learning of new languages.
• Understand the relationship that exists between an algorithm and a language.
• Provide an overview of the state the art in programming.
• To be able to compare the diffèrent existing languages.
• Give the possibility of designing a new language.

Different languages
• Anoperationcanbeexpressedindifferent languages​​andthenexecutedonthesame machine.
• Differentlanguages​​solvedifferentproblemsin different ways.
• Differencebetweentheselanguages: – syntax (shape, appearance)
– sémantic

Discussion of Paradigms
// Factorial in Java
public static double factorial (int n) {
if (n <0) return 0.0; double fact = 1.0; while (x> 1) {
fact = fact * n;
n = n – 1; }
return fact; }
// Factorial in Prolog
factorial (0,1).
factorial (N, F): – N> 0,
N1 is N-1,
factorial (N1, F1), F is N * F1.

Criteria in the evaluation of a language
Expressiveness
• Expressiveness of control and data structures.
– What is easier to read and maintain:
a long program built from simple elements? -or-
a short program built from complex elements?
– Examples of expressiveness: recursion, built-in Prolog backtracking, searching in database languages.
– Exampleoflittleexpressiveness:assemblyinstructions. CSI2520,

Criteria for choosing a language
Easy to read
• The readability of a language is essential, in particular, for purposes of evolution, maintenance, and updating of software.
• Abstraction: allow the generality of programs, procedural abstraction, and data abstraction.
• No ambiguities
• Absence of an overabundance of choices: For example, some languages​​allowyou towriteloops in severaldifferentways.

Criteria for choosing a language
Ease of writing
• Abstraction: as for reading
• Simplicity:
– Pascal is simple
– Prolog is conceptually simple, but difficult in practice. – C ++ and Java?
• Modularity: also the presence of modularization tools and the ability to be incorporated into an integrated programming environment.

Criteria for choosing a language
Orthogonality
• the absence of restrictions on how to combine language primitives.
(It is easier to see the lack of orthogonality.)
– Example: Can an array contain elements of any type?
– This results in a decrease in the number of special cases.

Criteria for choosing a language
• Ease of learning
– Small language with few restrictions • Scheme
– One (only) easy way to do things
– Few keywords • VS
– Ease of error detection • Java

Criteria for choosing a language
• Ease of use
– Easy to read, easy to write, easy to learn
– Good development tools, good documentation – Little code to write to solve a problem

Criteria in the evaluation of a language
• Simplicity: the fact of including only a limited number of components whose use is natural and consistent.
• Abstraction: the ability to represent a complex structure while ignoring details deemed non-essential.
• Portability: to what extent this language has been standardized, if several dialects of the language coexist.
• Modularity: how the program can be subdivided into coherent units.
• Robustness: early detection of errors, type checking.
• Uniformity: the language should consistently use commonly accepted notations and conventions.

Criteria in the evaluation of a language
• Translability: should allow efficient translation from language into machine code.
• Precision: the fact that the language has been clearly defined, that any sequence gives predictable results.
• Extensibility: the structure should allow to add new concepts, new options, thus allowing the language to evolve harmoniously
• Restrictability: Whether there are several ways to use the language, or a subset of it so as to limit the complexity of its use as needed.
• Support: the existence of integrated development tools.
• Appearance: the way the code looks
• Elegance: the way solutions look

Criteria for choosing a language
All programming languages ​​have:
• variables, constants, data structures • Syntax rule
• expressions
• control structures (selection, iteration) • recursion (for most languages)
• subroutines
• In Prolog and Scheme, data and programs have the same form • In Scheme, all data has the same privileges (including functions) • Java offers a wide variety of data and structures

Criteria for choosing a language
Reliability: Verification of types, handling of exceptions and errors, absence of ambiguities (and in general readability and aptitude for writing).
Cost associated with the use of language.
– Time required for development (ease of programming,
availability of code, libraries and documentation).
– Ease of implementation: (affects availability and cost of compilers). The implementation of Pascal, C, C ++ and Java has been very successful.
– Time needed to translate, and the efficiency of the resulting code. – Portability and standardization.

Criteria for choosing a language
• Each language comes with its mode of execution
– Compiled or interpreted?
– Is it running on a virtual machine?
– Is it designed to be portable? effective? expressive?

Source program
Lexical analysis (scanning)
Optimization code
Parsing (parsing)
Analysis semantics
Loader / Linker (Loader / Linker)
Generation code
Unit sequence lexical
Symbol table
Syntax tree
Abstract program (intermediate code)
Abstract program (optimized)
Executable code (object code)
Resulting program
Input data
Output data

Overall, each programming language has strengths, and weaknesses:
❑ Prolog ❑ Scheme ❑ GO
Strengths and weaknesses of a language

Choosing a programming language
Choose the best language
✓by application
•Language processing •Backspace (games) •Simulations
✓by familiarization ✓to work as a team ✓by taste☺

程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com

Posted in Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *