SlideShare a Scribd company logo
Cp3--
Modular programming support
for C++
Baltasar García Perez-Schofield
SI1
Faculty of Computer Science
University of Vigo
http://webs.uvigo.es/jbgarcia/prjs/
C++ for lecturing programming
● The trend of using programming languages
designed for teaching, such as Pascal, has
vanished.
● Nowadays, it is expected to lecture
programming by means of a programming
language used in the industry.
● Of course, this raises some problems. Many
of these languages are not ideal for lecturing.
Some others hide too much the internals of
programming.
Approaches for lecturing
programming
● Firstly the imperative paradigm, then the
object-oriented paradigm.
– Typically, first C, then C++
● Objects first
– Typically Java. Sometimes the course is
introduced by a learning environment such as
BlueJ.
● Pure approaches: Lisp or Scheme.
Modular programming
● When should modular programming be
taught?
– For some programming languages, like Java,
you have to mandatorily create one file for each
class, many environments automatize this.
– For many others, specially C-like, modular
programming is an obscure, hand-crafted art.
● Students are either unaware of using
modular programming, or haven't been
taught to use it, due to its complexity on
some programming languages.
Modular programming in C++
for computer science students
● Many programming
language
characterstics
constantly get in the
way.
● Many faculties just
use a single .cpp file
for all exercises.
// math_module.h
#ifndef MATH_MODULE
#define MATH_MODULE
const double PI = 3.14;
double sqr(double x);
#endif
// math_module.cpp
#include “math_module.h”
double sqr(double x)
{ return x * x; }
Modular programming in C++
for seasoned programmers
● Seasoned programmers repeat the same
process again and again, though it is error-
prone and does not improve productivity.
● The only reason this is done this way is due
to the old roots of the C++ programming
language. Linkers that time were not
specially sophisticated.
● New languages such as Java, C#, or even D
(a successor of C++) does not ask you to
divide your code in interface and
implementation.
Is it possible to solve this?
● The standard comitee has in modular
programming one of its interests for new C+
+.
● However, it will not make it in the so called
C++0x.
● The proposal is a radical change in syntax
and use, a la Modula - 2.
Is it still possible to solve this?
● It is possible to precede compilation from
another program, just a preprocessor,
translator or compiler that does the job.
● It will be perceived as a preprocessor for the
language.
● There have been many attempts, like
Preprocess, though they intentionally
change the programming language, or are
complex to use.
Are we using modern languages?
Cp3
--
● It is a compiler that sits before the
compilation of a C++ program.
● It is able to divide the code in the appropriate
files, create macro guards, etc.
● It is even able to be more or less strict in
aspects of what is allowed on each module,
which is useful for teaching.
● It can be either added to the compiler
toolchain, or used a code generator.
● Existing files do not need to be modified.
Cp3
--
● Code snippets like
the previous ones
are extremely
simplified.
// math.mpp
namespace Math {
const double PI = 3.14;
double sqr(double x)
{
return x * x;
}
}
Cp3
--
● Code for
classes is also
simplified.
● Modifiers are
now more
homogeneous.
// point.mpp
class Point {
inline
Point(double a, double b)
: x(a), y( b) {}
double getX()
{ return x; }
private:
double x;
double y;
};
Cp3
--
// point.h
class Point {
Point(double a,
double b)
: x(a), y( b) {}
double getX();
private:
double x;
double y;
};
// point.cpp
#include “point.h”
double Point::getX()
{ return x; }
Cp3
--
● The strictness
level can be
chosen from
command line
switches.
● For example,
in level 3 no
globals are
allowed.
// point.mpp
class Point {
//...
inline double getX()
{ return x; }
private:
double x;
double y;
};
Point p1; // ERROR
Conclusions
● It is possible to simplify modular
programming, make it become more
declarative. Syntax does not need to be
changed at all.
● Kowledge about modular programming is
desirable for students.
● Simplification of modular programming is
desirable for programmers.

More Related Content

What's hot

Unified Parallel C - IK
Unified Parallel C - IKUnified Parallel C - IK
Unified Parallel C - IK
Ilgın Kavaklıoğulları
 
Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...
Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...
Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...
Benoit Combemale
 
Reifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specificationsReifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specifications
Benoit Combemale
 
The Behavioral Coordination Operator Language (BCOoL)
The Behavioral Coordination Operator Language (BCOoL)The Behavioral Coordination Operator Language (BCOoL)
The Behavioral Coordination Operator Language (BCOoL)
Benoit Combemale
 
A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...
A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...
A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...
Benoit Combemale
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingAlpana Gupta
 
Cross curricular scratch
Cross curricular scratchCross curricular scratch
Cross curricular scratch
JEcomputing
 
C language
C languageC language
C language
Rohit Singh
 
IP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG ProgrammeIP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG Programme
SAFAD ISMAIL
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programming
soni_nits
 
C interview questions for experienced
C interview questions for experiencedC interview questions for experienced
C interview questions for experienced
MYTHILIKRISHNAN4
 
Ics2311 l00 overview of computer graphics
Ics2311 l00 overview of computer graphicsIcs2311 l00 overview of computer graphics
Ics2311 l00 overview of computer graphics
bridgekloud
 
Intro of C
Intro of CIntro of C
Intro of C
rama shankar
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsClarkTony
 
Programming introduction
Programming introductionProgramming introduction
Programming introduction
Explore Skilled
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
NIDA HUSSAIN
 
Lesson 12 two dimensional array
Lesson 12 two dimensional arrayLesson 12 two dimensional array
Lesson 12 two dimensional array
MLG College of Learning, Inc
 
C Language
C LanguageC Language
C Language
TodayTutoring
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Sivant Kolhe
 
Intro to cprogramming
Intro to cprogrammingIntro to cprogramming
Intro to cprogramming
skashwin98
 

What's hot (20)

Unified Parallel C - IK
Unified Parallel C - IKUnified Parallel C - IK
Unified Parallel C - IK
 
Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...
Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...
Engineering Executable DSMLs (xDSMLs ) for model executability, animation and...
 
Reifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specificationsReifying the concurrency concern into xDSML specifications
Reifying the concurrency concern into xDSML specifications
 
The Behavioral Coordination Operator Language (BCOoL)
The Behavioral Coordination Operator Language (BCOoL)The Behavioral Coordination Operator Language (BCOoL)
The Behavioral Coordination Operator Language (BCOoL)
 
A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...
A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...
A Tool-Supported Approach for Omniscient Debugging and Concurrent Execution o...
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Cross curricular scratch
Cross curricular scratchCross curricular scratch
Cross curricular scratch
 
C language
C languageC language
C language
 
IP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG ProgrammeIP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG Programme
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programming
 
C interview questions for experienced
C interview questions for experiencedC interview questions for experienced
C interview questions for experienced
 
Ics2311 l00 overview of computer graphics
Ics2311 l00 overview of computer graphicsIcs2311 l00 overview of computer graphics
Ics2311 l00 overview of computer graphics
 
Intro of C
Intro of CIntro of C
Intro of C
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddings
 
Programming introduction
Programming introductionProgramming introduction
Programming introduction
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Lesson 12 two dimensional array
Lesson 12 two dimensional arrayLesson 12 two dimensional array
Lesson 12 two dimensional array
 
C Language
C LanguageC Language
C Language
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Intro to cprogramming
Intro to cprogrammingIntro to cprogramming
Intro to cprogramming
 

Similar to Cp3-- A module support tool for C++

Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
maiktoepfer
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++
KurdGul
 
C++ language
C++ languageC++ language
C++ language
Elizabeth Pisarek
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
Danielle780357
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
AnassElHousni
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
AKR Education
 
Programming of c++
Programming of c++Programming of c++
Programming of c++
Ateeq Sindhu
 
Modern c
Modern cModern c
Modern c
Stanley Ho
 
Chapter 1 - Overview of C
Chapter 1 - Overview of CChapter 1 - Overview of C
Chapter 1 - Overview of C
Munazza-Mah-Jabeen
 
Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...
Baltasar García Perez-Schofield
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
bhargavi804095
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentals
ChaithraCSHirematt
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
bhargavi804095
 
Ayush oops
Ayush oopsAyush oops
Ayush oops
Ayush Pandey
 
Object oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpObject oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpAbefo
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
Ankur Pandey
 
Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1
University College of Engineering Kakinada, JNTUK - Kakinada, India
 
C++ book
C++ bookC++ book
C++ book
mailmerk
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 

Similar to Cp3-- A module support tool for C++ (20)

Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++
 
C++ language
C++ languageC++ language
C++ language
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Programming of c++
Programming of c++Programming of c++
Programming of c++
 
Modern c
Modern cModern c
Modern c
 
ewili13_submission_14
ewili13_submission_14ewili13_submission_14
ewili13_submission_14
 
Chapter 1 - Overview of C
Chapter 1 - Overview of CChapter 1 - Overview of C
Chapter 1 - Overview of C
 
Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentals
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 
Ayush oops
Ayush oopsAyush oops
Ayush oops
 
Object oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpObject oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharp
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1
 
C++ book
C++ bookC++ book
C++ book
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 

More from Baltasar García Perez-Schofield

Presentación ESEI para IES Lauro Olmo
Presentación ESEI para IES Lauro OlmoPresentación ESEI para IES Lauro Olmo
Presentación ESEI para IES Lauro Olmo
Baltasar García Perez-Schofield
 
Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...
Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...
Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...
Baltasar García Perez-Schofield
 
Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...
Baltasar García Perez-Schofield
 
Curso de doctorado Tecnología de Objetos: Persistencia.
Curso de doctorado Tecnología de Objetos: Persistencia.Curso de doctorado Tecnología de Objetos: Persistencia.
Curso de doctorado Tecnología de Objetos: Persistencia.
Baltasar García Perez-Schofield
 
Post-graduate course: Object technology: Persistence.
Post-graduate course: Object technology: Persistence.Post-graduate course: Object technology: Persistence.
Post-graduate course: Object technology: Persistence.
Baltasar García Perez-Schofield
 
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Baltasar García Perez-Schofield
 
Prototype-based programming with PROWL.
Prototype-based programming with PROWL.Prototype-based programming with PROWL.
Prototype-based programming with PROWL.
Baltasar García Perez-Schofield
 
Prototype-based, object-oriented programming
Prototype-based, object-oriented programmingPrototype-based, object-oriented programming
Prototype-based, object-oriented programming
Baltasar García Perez-Schofield
 
Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008
Baltasar García Perez-Schofield
 
Charla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistenciaCharla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistencia
Baltasar García Perez-Schofield
 

More from Baltasar García Perez-Schofield (10)

Presentación ESEI para IES Lauro Olmo
Presentación ESEI para IES Lauro OlmoPresentación ESEI para IES Lauro Olmo
Presentación ESEI para IES Lauro Olmo
 
Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...
Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...
Curso de doctorado de Tecnología de Objetos: Sistemas Orientados a objetos y ...
 
Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...
 
Curso de doctorado Tecnología de Objetos: Persistencia.
Curso de doctorado Tecnología de Objetos: Persistencia.Curso de doctorado Tecnología de Objetos: Persistencia.
Curso de doctorado Tecnología de Objetos: Persistencia.
 
Post-graduate course: Object technology: Persistence.
Post-graduate course: Object technology: Persistence.Post-graduate course: Object technology: Persistence.
Post-graduate course: Object technology: Persistence.
 
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
 
Prototype-based programming with PROWL.
Prototype-based programming with PROWL.Prototype-based programming with PROWL.
Prototype-based programming with PROWL.
 
Prototype-based, object-oriented programming
Prototype-based, object-oriented programmingPrototype-based, object-oriented programming
Prototype-based, object-oriented programming
 
Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008
 
Charla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistenciaCharla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistencia
 

Recently uploaded

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 

Recently uploaded (20)

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

Cp3-- A module support tool for C++

  • 1. Cp3-- Modular programming support for C++ Baltasar García Perez-Schofield SI1 Faculty of Computer Science University of Vigo http://webs.uvigo.es/jbgarcia/prjs/
  • 2. C++ for lecturing programming ● The trend of using programming languages designed for teaching, such as Pascal, has vanished. ● Nowadays, it is expected to lecture programming by means of a programming language used in the industry. ● Of course, this raises some problems. Many of these languages are not ideal for lecturing. Some others hide too much the internals of programming.
  • 3. Approaches for lecturing programming ● Firstly the imperative paradigm, then the object-oriented paradigm. – Typically, first C, then C++ ● Objects first – Typically Java. Sometimes the course is introduced by a learning environment such as BlueJ. ● Pure approaches: Lisp or Scheme.
  • 4. Modular programming ● When should modular programming be taught? – For some programming languages, like Java, you have to mandatorily create one file for each class, many environments automatize this. – For many others, specially C-like, modular programming is an obscure, hand-crafted art. ● Students are either unaware of using modular programming, or haven't been taught to use it, due to its complexity on some programming languages.
  • 5. Modular programming in C++ for computer science students ● Many programming language characterstics constantly get in the way. ● Many faculties just use a single .cpp file for all exercises. // math_module.h #ifndef MATH_MODULE #define MATH_MODULE const double PI = 3.14; double sqr(double x); #endif // math_module.cpp #include “math_module.h” double sqr(double x) { return x * x; }
  • 6. Modular programming in C++ for seasoned programmers ● Seasoned programmers repeat the same process again and again, though it is error- prone and does not improve productivity. ● The only reason this is done this way is due to the old roots of the C++ programming language. Linkers that time were not specially sophisticated. ● New languages such as Java, C#, or even D (a successor of C++) does not ask you to divide your code in interface and implementation.
  • 7. Is it possible to solve this? ● The standard comitee has in modular programming one of its interests for new C+ +. ● However, it will not make it in the so called C++0x. ● The proposal is a radical change in syntax and use, a la Modula - 2.
  • 8. Is it still possible to solve this? ● It is possible to precede compilation from another program, just a preprocessor, translator or compiler that does the job. ● It will be perceived as a preprocessor for the language. ● There have been many attempts, like Preprocess, though they intentionally change the programming language, or are complex to use.
  • 9. Are we using modern languages?
  • 10. Cp3 -- ● It is a compiler that sits before the compilation of a C++ program. ● It is able to divide the code in the appropriate files, create macro guards, etc. ● It is even able to be more or less strict in aspects of what is allowed on each module, which is useful for teaching. ● It can be either added to the compiler toolchain, or used a code generator. ● Existing files do not need to be modified.
  • 11. Cp3 -- ● Code snippets like the previous ones are extremely simplified. // math.mpp namespace Math { const double PI = 3.14; double sqr(double x) { return x * x; } }
  • 12. Cp3 -- ● Code for classes is also simplified. ● Modifiers are now more homogeneous. // point.mpp class Point { inline Point(double a, double b) : x(a), y( b) {} double getX() { return x; } private: double x; double y; };
  • 13. Cp3 -- // point.h class Point { Point(double a, double b) : x(a), y( b) {} double getX(); private: double x; double y; }; // point.cpp #include “point.h” double Point::getX() { return x; }
  • 14. Cp3 -- ● The strictness level can be chosen from command line switches. ● For example, in level 3 no globals are allowed. // point.mpp class Point { //... inline double getX() { return x; } private: double x; double y; }; Point p1; // ERROR
  • 15. Conclusions ● It is possible to simplify modular programming, make it become more declarative. Syntax does not need to be changed at all. ● Kowledge about modular programming is desirable for students. ● Simplification of modular programming is desirable for programmers.