The document discusses programming paradigms and introduces imperative programming. It defines imperative programming as a paradigm that describes computation in terms of statements that change a program's state. Imperative programming uses commands to update variables in storage and defines sequences of commands for the computer to perform. The document contrasts structured and unstructured programming and discusses concepts like l-values, r-values, iteration, and goto statements as they relate to imperative programming.
This ppt covers the following
A strategic approach to testing
Test strategies for conventional software
Test strategies for object-oriented software
Validation testing
System testing
The art of debugging
This ppt covers the following
A strategic approach to testing
Test strategies for conventional software
Test strategies for object-oriented software
Validation testing
System testing
The art of debugging
Detail about cyclomatic complexity, formula to measure cyclomatic complexity and how this metric useful in software testing and uses of cyclomatic complexity etc.
Operating System is a collection of programs that handle many of technical details Related to using a computer. In many ways ,an operating system is most important type of computer program. Without it your computer would be useless.
Definition:-Operating system are program that manages resources, provide user interface, and run applications.
Functions Of Operating System
Features Of Operating Systems
Advantages of Linux
Not long ago, testing Ajax components meant play-testing a page by hand. Today, there are a growing number of tools we can use to simplify and automate Ajax testing.
In this session we will cover when to test, what to test and how to test Ajax components. You learn how to create automatic tests with various tools, including YUI Test, and OpenQA Selenium, and how to use Ajax testing tools with IDEs and Continuous Integration systems.
In this session, you will learn:
* When, where and how to test Ajax components;
* How to create automatic tests with various tools;
* How to use Ajax testing tools with IDEs and Continuous Integration systems.
Design for WebApp encompasses technical and nontechnical activities that include : establishing the look and feel of the WebApp, creating the aesthetic layout of the user interface, defining the overall architectural structure, developing the content and functionality that reside within the architecture, and planning the navigation that occurs within the WebApp.
This presentation will introduce you to programming languages that support different programming paradigms and to give you the knowledge of basic concepts and techniques that will allow them to differentiate between various programming paradigms.
Detail about cyclomatic complexity, formula to measure cyclomatic complexity and how this metric useful in software testing and uses of cyclomatic complexity etc.
Operating System is a collection of programs that handle many of technical details Related to using a computer. In many ways ,an operating system is most important type of computer program. Without it your computer would be useless.
Definition:-Operating system are program that manages resources, provide user interface, and run applications.
Functions Of Operating System
Features Of Operating Systems
Advantages of Linux
Not long ago, testing Ajax components meant play-testing a page by hand. Today, there are a growing number of tools we can use to simplify and automate Ajax testing.
In this session we will cover when to test, what to test and how to test Ajax components. You learn how to create automatic tests with various tools, including YUI Test, and OpenQA Selenium, and how to use Ajax testing tools with IDEs and Continuous Integration systems.
In this session, you will learn:
* When, where and how to test Ajax components;
* How to create automatic tests with various tools;
* How to use Ajax testing tools with IDEs and Continuous Integration systems.
Design for WebApp encompasses technical and nontechnical activities that include : establishing the look and feel of the WebApp, creating the aesthetic layout of the user interface, defining the overall architectural structure, developing the content and functionality that reside within the architecture, and planning the navigation that occurs within the WebApp.
This presentation will introduce you to programming languages that support different programming paradigms and to give you the knowledge of basic concepts and techniques that will allow them to differentiate between various programming paradigms.
Talks about different programming paradigms, their strengths & weakness, evolution of programming paradigms and some real life application of how companies have gained competitive advantage by using right paradigm to solve their problems.
We often miss out on the details of how open source and free software became prevalent as they are today. These slides used in a seminar session attempts to provide an overview of the history and development of free software and open source philosophy.
Also, open source licenses tend to be complex. See the factors that inevitably make them complex.
Event and signal driven programming techniquesElizabeth Smith
Given at Zendcon 2011 this is a computer theory heavy, code absent look at event driven programming design patterns and techniques in the programming community
We are going to discuss briefly the programming paradigms that are common today. I am not going to be able to give you a detailed understanding of each, but we will have a brief discussion about each and what each paradigm brings to the table in terms of software architecture.
Oplægget blev holdt ved et seminar i InfinIT-interessegruppen Højniveausprog til Indlejrede Systemer den 2. oktober 2013. Læs mere om interessegruppen her: http://infinit.dk/dk/interessegrupper/hoejniveau_sprog_til_indlejrede_systemer/hoejniveau_sprog_til_indlejrede_systemer.htm
Course: Programming Languages and Paradigms:
A brief introduction to imperative programming principles: history, von neumann, BNF, variables (r-values, l-values), modifiable data structures, order of evaluation, static and dynamic scopes, referencing environments, call by value, control flow (sequencing, selection, iteration), ...
JThermodynamicsCloud is software service for the chemical, or more specifically, the combustion research
domain. JThermodynamicsCloud service can be said to be an model driven application, where the ontology
is a platform independent model of the data and operational structures. The ontology, as used by the service,
has three distinct purposes: documentation, data structure definition and operational definitions. One goal of
the ontology is to place as much of the design and domain specific structures in the ontology rather than in
the application code. The application code interprets the ontology in the backend. The primary purpose of
the JThermodynamicsCloud is to perform thermdynamic calculations and manage the data needed to make
those calculations. The calculation itself is highly dependent on the varied types of molecular data found in
the database The complete service is a system with three interacting components, a user interface using
Angular, a (RESTful) backend written in JAVA (with the JENA API interpreting the ontology) and the
Google Firestore noSQL document database and Firebase storage. The service uses these three components
to make calculations for thermodynamic quantities based on molecular species structure. These different
platforms are united through the ontology.
JThermodynamicsCloud is software service for the chemical, or more specifically, the combustion research
domain. JThermodynamicsCloud service can be said to be an model driven application, where the ontology
is a platform independent model of the data and operational structures. The ontology, as used by the service,
has three distinct purposes: documentation, data structure definition and operational definitions. One goal of
the ontology is to place as much of the design and domain specific structures in the ontology rather than in
the application code. The application code interprets the ontology in the backend. The primary purpose of
the JThermodynamicsCloud is to perform thermdynamic calculations and manage the data needed to make
those calculations. The calculation itself is highly dependent on the varied types of molecular data found in
the database The complete service is a system with three interacting components, a user interface using
Angular, a (RESTful) backend written in JAVA (with the JENA API interpreting the ontology) and the
Google Firestore noSQL document database and Firebase storage. The service uses these three components
to make calculations for thermodynamic quantities based on molecular species structure. These different
platforms are united through the ontology.
JThermodynamicsCloud is software service for the chemical, or more specifically, the combustion research
domain. JThermodynamicsCloud service can be said to be an model driven application, where the ontology
is a platform independent model of the data and operational structures. The ontology, as used by the service,
has three distinct purposes: documentation, data structure definition and operational definitions. One goal of
the ontology is to place as much of the design and domain specific structures in the ontology rather than in
the application code. The application code interprets the ontology in the backend. The primary purpose of
the JThermodynamicsCloud is to perform thermdynamic calculations and manage the data needed to make
those calculations. The calculation itself is highly dependent on the varied types of molecular data found in
the database The complete service is a system with three interacting components, a user interface using
Angular, a (RESTful) backend written in JAVA (with the JENA API interpreting the ontology) and the
Google Firestore noSQL document database and Firebase storage. The service uses these three components
to make calculations for thermodynamic quantities based on molecular species structure. These different
platforms are united through the ontology.
ChemConnect: Poster for European Combustion Meeting 2017Edward Blurock
This is a poster presented at the European Combustion Meeting, April 2017. It explains the Reference Description Language (RDF) setup of the database and the direction and development of the ChemConnect database project as an efficient means of data retrieval and data exhange and how the project is moving towards being an Electronic Laboratory Notebook (ELN).
EU COST Action CM1404: WG€ - Efficient Data ExchangeEdward Blurock
This talk discusses the topic of data exchange within the combustion community. This is a summary of a task force on data exchange within the WG4 working group, Standard definition for data collection and mining toward a virtual chemistry of Smart Energy Carriers, within the SMARTCATS EU COST Action CM1404
ChemConnect: Characterizing CombusAon KineAc Data with ontologies and meta-‐...Edward Blurock
ChemConnect is a database that interconnects fine-grained information extracted from chemical kinetic and thermodynamic sources such as
CHEMKIN mechanism files, NASA polynomial files, and even the information behind automatic generation files.
The key to the interconnection is the Resource Description Framework (RDF) from Semantic Web technologies. The RDF is a triplet where an object item (first) is associated through a descriptor (second) to a subject item.
In this way the information of the object is connected (through the descriptor) to the subject.
In ChemConnect the object is word (text) and the subject can be text or a database item. The search mechanism within ChemConnect uses the object and subject text as search strings.
The presentation also contains an brief introduction to cloud computing.
This was presented at the COST Action 1404 SMARTCATS workshop on Databases and Systems Use Cases (http//http://www.smartcats.eu/wg4ws1dp/)
Poster: Characterizing Ignition behavior through morphing to generic curvesEdward Blurock
The qualitative notion that ignition processes have similar behavior, even over an extensive range of starting conditions, is quantitatively demonstrated through the production of a single ’generic’ ignition curve. The key to the production of the generic curve is the recognition that the basic shapes of the species and temperature profiles occurring in the ignition process differ only in their ’timing’. By ’morphing’ the time scale, the profile shapes can be made to align. From the aligned profile shapes a generic or ’average’ profile can be derived. Synchronizing chemical events modifies the ignition progress times. In addition to fixing the ignition time to have the progress value of one, intermediate ignition events (such as selected profile maxima or inflection points) that occur before ignition are also aligned to have specific ’normalized’ times.
The goal of the Very Open Data Project is to provide a software-technical foundation for this exchange of data, more specifically to provide an open database platform for data from the raw data coming from experimental measurements or models through intermediate manipulations to finally published results. The sheer expanse of the amount data involved creates some unique software-technical challenges. One of these challenges is addressed in the part of the study presented here, namely to characterize scientific data (with the initial focus being detailed chemistry data from the combustion kinetic community), so that efficient searches can be made. A formalization of this characterization comes in the form of schemas of descriptions of tags and keywords describing data and ontologies describing the relationship between data types and the relationship between the characterizations themselves. These will be translated to meta-data tags connected to the data points within a non-relational data of data for the community.
The focus of the initial work will be on data and its accessibility. As the project progresses, the emphasis will shift on not only having available data accessible for the community, but that the community itself will be able to, with emphasis on minimal effort, will be able contribute their own data. This will involve, for example, the concepts of the ‘electronic lab notebook’ and the existence and availability of extensive concept extraction tools, primarily from the chemical informatics field.
This describes a tabulation method based on computing, retaining and accessing a large, on the order of millions, number of individual kinetic time step calculations and approximations. It is essentially an extension of Pope’s In Situ Adaptive Tabulation
(ISAT) method. The primary differences lie in that not all configurations need be stored in memory and that a polynomial approximation is only calculated when enough points have accumulated within a localized area to be able to calculate the
polynomial approximation. The latter increases efficiency because no extra points are evaluated to form an approximation (as is done in ISAT). The speed up is expected to be that of ISAT.
Characterization Ignition Behavior through Morphing to Generic Ignition CurvesEdward Blurock
Presented at the International Conference of Chemical Kinetics, Ghent, Belgium, July, 2015
The qualitative notion that ignition processes have similar behavior, even over an extensive range of starting conditions, is quantitatively demonstrated through the production of a single ’generic’ ignition curve. The key to the production of the generic curve is the recognition that the basic shapes of the species and temperature profiles occurring in the ignition process differ only in their ’timing’. By ’morphing’ the time scale, the profile shapes can be made to align. From the aligned profile shapes, a generic or ’average’ profile can be derived. Synchronizing chemical events modifies the ignition progress times. In addition to fixing the ignition time to have the progress value of one, intermediate ignition events (such as selected profile maxima or inflection points) that occur before ignition are also aligned to have specific ’normalized’ times. With this additional synchronization, a single generic curve, derived from the average of the morphed curves, can be derived. This generic curve represents a kinetic modelers intuitive notion of the mechanism of the process.
Course: Programming Languages and Paradigms:
This introduces concepts related to programming languate design: abstraction, a bit of history, the syntax, semantics and pragmatics of programming languages, languages as abstraction, thought shaper, simplifier and law enforcer.program verification, denotational and operational semantics
Course: Intro to Computer Science (Malmö Högskola):
knowledge representation and abstraction, decision making, generalization, data acquistion (abstraction), machine learning, similarity
another version of abstraction
Course: Intro to Computer Science (Malmö Högskola):
A very general overview of computer science from machine, operating systems, networks, applications...
Course: Intro to Computer Science (Malmö Högskola):
A overview of computability and complexity (for non-mathematicians). definition of algorithm, turing machines, lambda, calculus and concepts of complexity
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
2. Why are there so many programming
languages?
Lecture: Programming
Paradigm
programming CIS: Edward Blruock
Human Computer Interface
The
Program
3. Why are there so many programming
languages?
Lecture: Programming
Paradigm
programming CIS: Edward Blruock
Historically, the first programs were close to the computer level
The
Program
The
Program
The
Program
Human Computer Interface
But as programming languages are evolving
Organizational structure are becoming more human
4. Lecture: Programming
Paradigm
CIS: Edward Blruock
Why are there so many programming
languages?
The
Program
Mathematical concepts
The computer
Organizational Concepts:
Program flow, data organization What influences
program language
design?
6. Algorithm
slide 6
• Abu Ja’far Muhammad ibn Musa
al-Khorezmi (“from Khorezm”)
– Lived in Baghdad around 780 – 850
AD
– Chief mathematician in Khalif Al
Mamun’s “House of Wisdom”
– Author of “A Compact Introduction To
Calculation Using Rules Of Completion
And Reduction”
Removing negative units from the equation by
adding the same quantity on the other side (“al-
gabr” in Arabic)
7. slide 7
“Calculus of Thought”
• Gottfried Wilhelm Leibniz
– 1646 - 1716
– Inventor of
calculus and binary system
– “Calculus ratiocinator”
human reasoning can be reduced to a
formal symbolic language,
in which all arguments would be settled by
mechanical manipulation of logical
concepts
– Invented a mechanical calculator
8. slide 8
Formalisms for Computation (1)
• Predicate logic
– Gottlöb Frege (1848-1925)
– Formal basis for proof theory
and automated theorem proving
– Logic programming
• Computation as logical deduction
• Turing machines
– Alan Turing (1912-1954)
– Imperative programming
• Sequences of commands, explicit
state transitions, update via
assignment
9. slide 9
Formalisms for Computation (2)
• Lambda calculus
– Alonzo Church (1903-1995)
– Formal basis for all functional
languages, semantics, type
theory
– Functional programming
• Pure expression evaluation, no
assignment operator
• Recursive functions & automata
– Stephen Kleene (1909-1994)
– Regular expressions, finite-state
machines, PDAs
10. slide 10
Programming Language
• Formal notation for specifying computations
– Syntax (usually specified by a context-free
grammar)
– Semantics for each syntactic construct
– Practical implementation on a real or virtual
machine
• Translation vs. compilation vs. interpretation
– C++ was originally translated into C by Stroustrup’s Cfront
– Java originally used a bytecode interpreter, now native code
compilers are commonly used for greater efficiency
– Lisp, Scheme and most other functional languages are
interpreted by a virtual machine, but code is often
precompiled to an internal executable for efficiency
• Efficiency vs. portability
11. slide 11
Computability
• Function f is computable if some program
P computes it
– For any input x, the computation P(x) halts
with output f(x)
– Partial recursive functions: partial functions
(int to int) that are computable
13. slide 13
Program Correctness
• Assert formal correctness statements about
critical parts of a program and reason
effectively
– A program is intended to carry out a specific
computation, but a programmer can fail to
adequately address all data value ranges, input
conditions, system resource constraints, memory
limitations, etc.
• Language features and their interaction should
be clearly specified and understandable
– If you do not or can not clearly understand the
semantics of the language, your ability to
accurately predict the behavior of your program is
limited
14. slide 14
Billion-Dollar Mistake
Failed launch of Ariane 5 rocket (1996)
– $500 million payload; $7 billion spent on development
Cause: software error in inertial reference system
– Re-used Ariane 4 code, but flight path was different
– 64-bit floating point number related to horizontal
velocity converted to 16-bit signed integer; the number
was larger than 32,767; inertial guidance crashed
16. First modern computer – first compiler
David Wheeler (1927-2004)
University of Cambridge
Exceptional problem solver: hardware, software, algorithms, libraries
First computer science Ph.D. (1951)
First paper on how to write correct, reusable, and maintainable code (1951)
(Thesis advisor for Bjarne Stroustrup )
16Stroustrup/Programming
17. slide 17
Assembly Languages
• Invented by machine designers
the early 1950s
• Mnemonics instead of
binary opcodes
push ebp
mov ebp, esp
sub esp, 4
push edi
• Reusable macros and subroutines
18. slide 18
FORTRAN
• Procedural, imperative language
– Still used in scientific computation
• Developed at IBM in the 1950s by
John Backus (1924-2007)
– Backus’s 1977 Turing award lecture (see course
website) made the case for functional programming
– On FORTRAN: “We did not know what we wanted and
how to do it. It just sort of grew. The first struggle was
over what the language would look like. Then how to
parse expressions – it was a big problem…”
• BNF: Backus-Naur form for defining context-free grammars
19. slide 19
LISP
• Invented by John McCarthy (b. 1927,
Turing award: 1971)
– See original paper on course website
• Formal notation for lambda-calculus
• Pioneered many PL concepts
– Automated memory management
(garbage collection)
– Dynamic typing
– No distinction between code and data
• Still in use: ACL2, Scheme, …
20. slide 20
Algol 60
• Designed in 1958-1960
• Great influence on modern languages
– Formally specified syntax (BNF)
• Peter Naur: 2005 Turing award
– Lexical scoping: begin … end or {…}
– Modular procedures, recursive procedures, variable
type declarations, stack storage allocation
• “Birth of computer science” -- Dijkstra
• “A language so far ahead of its time that it
was not only an improvement on its
predecessors, but also on nearly all its
successors” -- Hoare
21. slide 21
Algol 60 Sample
real procedure average(A,n);
real array A; integer n;
begin
real sum; sum := 0;
for i = 1 step 1 until n do
sum := sum + A[i];
average := sum/n
end;
no ; here
no array bounds
set procedure return value by assignment
22. Simula 67
• Kristen Nygaard (1926-2002) and Ole-Johan Dahl (1931-2002)
– Norwegian Computing Center
– Oslo University
– The start of object-oriented programming and object-oriented design
22Stroustrup/Programming
23. slide 23
Pascal
• Designed by Niklaus Wirth
– 1984 Turing Award
• Revised type system of Algol
– Good data structure concepts
• Records, variants, subranges
– More restrictive than Algol 60/68
• Procedure parameters cannot have procedure
parameters
• Popular teaching language
• Simple one-pass compiler
24. slide 24
C
• Bell Labs 1972 (Dennis Ritchie)
• Development closely related to UNIX
– 1983 Turing Award to Thompson and
Ritchie
• Added weak typing to B
– int, char, their pointer types
– Typed arrays = typed pointers
• int a[10]; … x = a[i]; means
x = *(&a[0]+i*sizeof(int))
• Compiles to native code
25. slide 25
C++
• Bell Labs 1979 (Bjarne Stroustrup)
– “C with Classes” (C++ since 1983)
• Influenced by Simula
• Originally translated into C using
Cfront, then native compilers
– GNU g++
• Several PL concepts
– Multiple inheritance
– Templates / generics
– Exception handling
26. slide 26
Java
• Sun 1991-1995 (James Gosling)
– Originally called Oak,
intended for set top boxes
• Mixture of C and Modula-3
– Unlike C++
• No templates (generics), no multiple inheritance, no
operator overloading
– Like Modula-3 (developed at DEC SRC)
• Explicit interfaces, single inheritance, exception
handling, built-in threading model, references &
automatic garbage collection (no explicit pointers!)
• “Generics” added later
27. slide 27
Why So Many Languages?
“There will always be things we wish to
say in our programs that in all languages
can only be said poorly.”
- Alan Perlis
28. slide 28
What’s Driving Their Evolution?
• Constant search for better ways to build software
tools for solving computational problems
– Many PLs are general purpose tools
– Others are targeted at specific kinds of problems
• For example, massively parallel computations or graphics
• Useful ideas evolve into language designs
– Algol Simula Smalltalk C with Classes C++
• Often design is driven by expediency
– Scripting languages: Perl, Tcl, Python, PHP, etc.
• “PHP is a minor evil perpetrated by incompetent amateurs,
whereas Perl is a great and insidious evil, perpetrated by skilled
but perverted professionals.” - Jon Ribbens
29. slide 29
What Do They Have in Common?
• Lexical structure and analysis
– Tokens: keywords, operators, symbols, variables
– Regular expressions and finite automata
• Syntactic structure and analysis
– Parsing, context-free grammars
• Pragmatic issues
– Scoping, block structure, local variables
– Procedures, parameter passing, iteration, recursion
– Type checking, data structures
• Semantics
– What do programs mean and are they correct
30. slide 30
Core Features vs. Syntactic Sugar
• What is the core high-level language syntax
required to emulate a universal Turing machine?
– What is the core syntax of C?
• Are ++, --, +=, -=, ?:, for/do/while part of the core?
• Convenience features?
– Structures/records, arrays, loops, case/switch?
– Preprocessor macros (textual substitution)
– Run-time libraries
• String handling, I/O, system calls, threads, networking, etc.
– “Syntactic sugar causes cancer of the semicolons”
- Alan Perlis
31. slide 31
Where Do Paradigms Come From?
• Paradigms emerge as the result of social
processes in which people develop ideas
and create principles and practices that embody
those ideas
– Thomas Kuhn. “The Structure of Scientific
Revolutions.”
• Programming paradigms are the result of
people’s ideas about how programs should be
constructed
– … and formal linguistic mechanisms for expressing
them
– … and software engineering principles and
practices for using the resulting programming
language to solve problems
32. Paradigms
• Programming paradigm is a fundamental
style of computer programming
• Paradigms differ in concepts and
abstractions used to represent the
elements of program
34. Major Paradigms
• Imperative
• Functional
• Declarative
• Object Oriented
• Event-Driven
• Stochastic
There are many ways to
categorize programming
paradigms.
It should also be said that
they are not mutually
exclusive.
Lecture: Programming
Paradigm
Overview CIS: Edward Blruock
36. Imperative Programming
• Derived from latin word imperare means
“to command”
• It is based on commands that update
variables in storage
• Is a programming paradigm that describes
computation in terms of statements that
change a program state.
37. Contd..
• It defines sequences of commands for the
computer to perform
• Imperative programming is characterized
by programming with a state and
commands
38. Contd..
• In imperative programming, a name may
be assigned to a value and later
reassigned to another value.
• A name is tied to two bindings, a binding
to a location and to a value.
• The location is called the l-value and the
value is called the r-value.
39. Contd..
• For example,
– X := X+2
• Assignment changes the value at a
location.
• A program execution generates a
sequence of states
40. Unstructured Commands
• The unstructured commands contains:
– assignment command,
– sequential composition of commands,
– a provision to identify a command with a
label,
– unconditional and conditional GOTO
commands
42. Iteration
• For statement
– Loop control variable
• The while loop
• while vs do-while
• do-while versus repeat-until
• Iteration using goto
43. Goto statement
Loops a GOTO (or similar) statement
The GOTO jumps to a specified location (label or address)
n!º i
i=1
n
Õ
an index involved
The index is incremented until the end is reached i=1
factorial = 1;
loop:
factorial = factorial * I
if( i=n) goto exit
goto loop
exit
44. Structured Programming
• The goal of structured programming is to
provide control structures that make it
easier to reason about imperative
programs.
45. Contd..
• an IF statement corresponds to an If
condition then command and a DO
statement corresponds to a While
condition Do command.
– IF guard --> command FI=if guard then
command
– DO guard --> command OD=while guard do
command
46. Iteration
Repetition of a block of code
n!º i
i=1
n
Õ
an index involved
The index is incremented until the end is reached
i=1
factorial = 1;
while( i <= n) {
factorial = factorial * i
i = i + 1
}
Once again involves a iteration counter
factorial = 1;
for i=1 to n {
factorial = factorial * I
}
47. Programming Paradigms: Functional
A program in this paradigm consists of functions and uses functions in a similar
way as used in mathematics
Program execution involves functions calling each
other and returning results. There are no variables in
functional languages.
Example functional languages include: ML, MirandaTM, Haskell
Advantages
Small and clean syntax
Better support for reasoning about programs
They allow functions to be treated as any other data
values.
They support programming at a relatively higher level
than the imperative languages
Disadvantages
Difficulty of doing input-output
Functional languages use more storage space than their imperative cousins
48. Possible Benefits
• The ability to re-use the same code at
different places in the program without
copying it.
• An easier way to keep track of program
flow than a collection of "GOTO" or
"JUMP" statements
49. Functional Programming
• It treats computation as the evaluation of
mathematical functions and avoids state
and mutable data.
• It emphasizes the application of functions,
in contrast to the imperative programming
style
51. Content of Recursion
• Base case(s).
o Values of the input variables for which we perform no recursive calls
are called base cases (there should be at least one base case).
o Every possible chain of recursive calls must eventually reach a base
case.
• Recursive calls.
o Calls to the current method.
o Each recursive call should be defined so that it makes progress
towards a base case.
factorial(n) {
if(n=1) return 1
return factorial(n-1)*n
}
n!º
1 n =1
n*(n-1)! n >1
ì
í
ï
îï
ü
ý
ï
þï
52. How do I write a
recursive function?
• Determine the size factor
o The number: smaller number, smaller size
• Determine the base case(s)
o The case for n=1, the answer is 1
• Determine the general case(s)
o The recursive call: factorial(n)=factorial(n-1)*n
• Verify the algorithm
(use the "Three-Question-Method")
factorial(n) {
if(n=1) return 1
return factorial(n-1)*n
}
n!º
1 n =1
n*(n-1)! n >1
ì
í
ï
îï
ü
ý
ï
þï
53. Three-Question Verification Method
1. The Base-Case Question:
Is there a nonrecursive way out of the function, and does
the routine work correctly for this "base" case?
2. The Smaller-Caller Question:
Does each recursive call to the function involve a smaller
case of the original problem, leading inescapably to the
base case?
3. The General-Case Question:
Assuming that the recursive call(s) work correctly, does
the whole function work correctly?
54. Stacks
in recursion
factorial(n)
If (n=1)
return 1
else
return factorial(n-1)
n! = n*(n-1)*(n-2)*(n-3)*……* 1
5! = 5*4*3*2*1
Factorial(5)
Factorial(4)
Factorial(3)
Factorial(2)
Factorial(1) return 1
Return 2
Return 6
Return 24
Return 120 5!=120
Deep recursion can result in
running out of memory
56. Declarative Programming
Not a recipe
Does not explicitly list command or steps
that need to be carried out to achieve the results.
Set of Declarations
separates the process of
stating a problem from the process of solving the problem.
The domain is described through a set of declarations
An external “engine” interprets these declarations to perform a task
57. Programmed Behavior
Lecture: Programming
Paradigm
Declarative CIS: Edward Blruock
Digger Wasps are predators that can sting and paralyze prey insects.
They construct a protected “nest
and then stock it with captured insects.
The wasps lay their eggs in the provisioned nest.
When the wasp larvae hatch, they feed on the paralyzed insects.
1. Dig nest
2. Place paralyzed insect at nest entrance
3. Go in and inspect nest
4. Come out
5. Take paralyzed insect in nest
58. Programmed Behavior
Lecture: Programming
Paradigm
Declarative CIS: Edward Blruock
1. Dig nest
2. Place paralyzed insect at nest entrance
3. Go in and inspect nest
4. Come out
5. Take paralyzed insect in nest
If during step 3, when the insect is inside the nest,
the researcher removes the insect
The insect will go back to step 2, retrieve the insect
and, again step 3, inspect the nest.
59. Programmed Behavior
Lecture: Programming
Paradigm
Declarative CIS: Edward Blruock
1. Dig nest
2. Place paralyzed insect at nest entrance
3. Go in and inspect nest
4. Come out
5. Take paralyzed insect in nest
Imperative View:
A recipe, step 1, before step 2, before step 3….
Fixed programming can lead to (unexpected) problems.
60. Declarative Paradigm
Lecture: Programming
Paradigm
Declarative CIS: Edward Blruock
Not a recipe for the computer
Imperative programming
Declarative Programming
Computer
Sets up a set of (reactive) states
Engine
“Recipe” Built (compiled)
Directly in Computer
States are managed
By an “engine”
Built (compiled)
Directly in Computer
61. Declarative programming
Expresses the logic of a computation
without describing its control flow.
n!º
1 n =1
n*(n-1)! n >1
ì
í
ï
îï
ü
ý
ï
þï
factorial(1,1) factorial(N,F) :-
N1 is N-1,
factorial(N1,F1),F is N*F1.
The problem is (mathematically) described
The engine takes care of the solving/using the description
Solving predicate logic is the engine
62. Declarative Programming
Lecture: Programming
Paradigm
Declarative Programming CIS: Edward Blruock
PROLOG:
Horn clause predicate:
P(X,Y,…) :=
Condition1(…),
Condition2(…),
....
If these conditions are true,
then the predicate is true
Backward chaining:
examine conditions to determine truth of predicate
(p ∧ q ∧ ... ∧ t) → u
63. Rules
• Consider the following sentence :
– 'All men are mortal'
• We can express this as :
– mortal(X) :- human(X).
• Let us define the fact that Socrate is a
human.
– mortal(X) :- human(X).
human(socrate).
64. Contd..
• Now if we ask to prolog :
– ?- mortal(socrate).
• What prolog will respond ?
• Why ?
65. Constraint Logic Programming
factorial(1,1) factorial(N,F) :-
N1 is N-1,
factorial(N1,F1),F is N*F1.
Factorial(5,F) Returns F=120
Factorial(N.120) Creates an instantiation error
PROLOG has no knowledge of Real or Integer numbers
Mathematical manipulations cannot be made
66. Constraint Logic Programming
factorial(1,1) factorial(N,F) :-
N1 is N-1,
factorial(N1,F1),F is N*F1.
Logic Programming
Constraint Logic Programming
CLP
Formulas passed to
CLP
Reduced or solved
formulas returned
Mathmatical knowledge
about the numbers used
68. Declarative Programming
Lecture: Programming
Paradigm
Declarative Programming CIS: Edward Blruock
Expert Systems (is the engine):
A set of rules.
The rule executes if the conditions hold.
Rules:
1. If X croaks and eats flies - Then X is a frog
2. If X chirps and sings - Then X is a canary
3. If X is a frog - Then X is green
4. If X is a caary - Then X is yellow
1. Fritz croaks and Fritz eats flies
Based on logic, the computer can derive:
2. Fritz croaks and eats flies
Based on rule 1, the computer can derive:
3. Fritz is a frog
Based on rule 3, the computer can derive:
4. Fritz is green.
Facts
1. Fritz croaks
2. Fritz eats flies
71. Declarative Programming
Lecture: Programming
Paradigm
Declarative Programming CIS: Edward Blruock
Environment Declaration Engine
PROLOG Horn Clause Predicate Logic: Backward chaining
Expert System A rule or fact Expert System: Forward chaining
GUI An action function GUI/Operating system
System of Agents Program within agent Internet message passing
72. Contd..
• It is a paradigm where we focus real life
objects while programming any solution.
• We actually write behaviours of our
programming objects, those behaviours
are called methods in objected oriented
programming.
73. Principal advantage
• They enable programmers to create
modules that do not need to be changed
when a new type of object is added.
• A programmer can simply create a new
object that inherits many of its features
from existing objects.
75. Main features
• Encapsulation:
– a logical boundary around methods and
properties
• Inheritance
• Re-usability
– method overloading and overriding
• Information Hiding
– is achieved through "Access Modifiers"
76. Probabilistic Algorithms
Non-deterministic
No exact control program flow
Leaves Some of Its Decisions To Chance
Outcome of the program in different runs is not necessarily the same
Monte Carlo Methods
Always Gives an answer
But not necessarily Correct
The probability of correctness go es up with time
Las Vegas Methods Never returns an incorrect answer
But sometimes it doesn’t give an answer
77. Probabilistic Algorithms
Probabilistic Algorithms in optimization:
Closer to human reasoning and problem solving
(for hard problems we don’t follow strict deterministic algorithms)
Finding
local and global
minimum
78. Probabilistic Algorithms
Classic gradient optimization find local minimum
The search path is always downhill toward minimum
Probabilistic algorithms allow search to go uphill sometimes
Randomness in the search for next step
Genetic Algorithms
Simulated Annealing to find global minimum
79. Probabilistic Algorithms
Calculate pi with a dart board
Area of square
d2
Area of Circle:
P
d
2
æ
è
ç
ö
ø
÷
2
prob =
circle
square
=
p
d
2
æ
è
ç
ö
ø
÷
2
d2
=
p
4
Probability dart will be in circle
d
number darts in circle
divided by
number of darts in total
times
Is π
Monte Carlo Method
Always Gives an answer
But not necessarily Correct
The probability of correctness goes up with time
80. Which Programming Paradigm is Best?
Which of these paradigms is the best?
The most accurate answer is that there is no best paradigm.
No single paradigm will fit all problems well.
Human beings use a combination of the models represented by these
paradigms.
Languages with features from different paradigms are often too complex.
So, the search of the ultimate programming language continues!
81. slide 81
Design Choices
• C: Efficient imperative programming with static types
• C++: Object-oriented programming with static types and
ad hoc, subtype and parametric polymorphism
• Java: Imperative, object-oriented, and concurrent
programming with static types and garbage collection
• Scheme: Lexically scoped, applicative-style recursive
programming with dynamic types
• Standard ML: Practical functional programming with strict
(eager) evaluation and polymorphic type inference
• Haskell: Pure functional programming with non-strict (lazy)
evaluation.
82. Imperative vs Non-Imperative
• Functional/Logic style clearly separates WHAT
aspects of a program (programmers’
responsibility) from the HOW aspects
(implementation decisions).
• An Imperative program contains both the
specification and the implementation details,
inseparably inter-twined.
83. Procedural vs Functional
• Program: a sequence of
instructions for a von
Neumann m/c.
• Computation by
instruction execution.
• Iteration.
• Modifiable or updatable
variables..
• Program: a collection of
function definitions
(m/c independent).
• Computation by term
rewriting.
• Recursion.
• Assign-only-once
variables.
84. Procedural vs Object-Oriented
• Emphasis on procedural
abstraction.
• Top-down design; Step-
wise refinement.
• Suited for programming
in the small.
• Emphasis on data
abstraction.
• Bottom-up design;
Reusable libraries.
• Suited for programming
in the large.