473,666 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++: 4 paradigms?

I've perused the FAQ, found some mention of paradigm, but didn't really find
an answer to my question.

What is meant by "C++ is a 4 paradigm language?" What are the 4 paradigms
of C++ and what makes them paradigms? Is C++/CLI the 5th paradigm of C++?
why/why not?

thanks,
crichmon
Jul 22 '05 #1
26 3190
crichmon wrote:
I've perused the FAQ, found some mention of paradigm, but didn't really find an answer to my question.

What is meant by "C++ is a 4 paradigm language?" What are the 4 paradigms
of C++ and what makes them paradigms? Is C++/CLI the 5th paradigm of C++?
why/why not?


- procedural. Programs control flow directly
- OO. Programs control flow indirectly, thru virtual methods
- generic. Like OO but bound at compile time

- declarative.

The last one is like SQL. You arrange elements in the shape of the result
you want, pull the rip cord, and the elements drive an engine to produce the
result.

I have no idea how that should work in C++ or if it's what they meant.

I have never learned a reason to distinguish these paradigms. Just write.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces
Jul 22 '05 #2
crichmon wrote:
I've perused the FAQ, found some mention of paradigm, but didn't really find
an answer to my question.

What is meant by "C++ is a 4 paradigm language?" What are the 4 paradigms
of C++ and what makes them paradigms? Is C++/CLI the 5th paradigm of C++?
why/why not?

Yes C++ is a multiparadigm language and currently supports 4 paradigms.
The procedural paradigm (functions etc), the modular paradigm
(namespaces), the object oriented paradigm and the generic programming
paradigm (templates). Each paradigm is supported well with optimal space
and time efficiencies.

Regarding C++/CLI, I have not seen anyone else call it as the 5th
paradigm except me. Perhaps you have seen it in my pages where I write
"We can dare to say that C++/CLI is the fifth paradigm of C++". However
I do not if this has much scientific basis, and I am going to remove
that line if I get many complaints about it. :-)


Regards,

Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #3
* Ioannis Vranos:
crichmon wrote:
I've perused the FAQ, found some mention of paradigm, but didn't really find
an answer to my question.

What is meant by "C++ is a 4 paradigm language?" What are the 4 paradigms
of C++ and what makes them paradigms? Is C++/CLI the 5th paradigm of C++?
why/why not?


Yes C++ is a multiparadigm language and currently supports 4 paradigms.
The procedural paradigm (functions etc), the modular paradigm
(namespaces), the object oriented paradigm and the generic programming
paradigm (templates). Each paradigm is supported well with optimal space
and time efficiencies.


I didn't know that.

But certainly it's not something everyone agrees on.

For example, I absolutely do not agree that C++ "supports" modular
programming, since there _is_ no module concept in C++. However,
C++ allows you to fake some of it by strictly following some set of
conventions (header file guards etc.). That's in the same spirit
as assembler language supports object-orientation (even old TASM).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #4
Alf P. Steinbach wrote:
Yes C++ is a multiparadigm language and currently supports 4 paradigms.
The procedural paradigm (functions etc), the modular paradigm
(namespaces ), the object oriented paradigm and the generic programming
paradigm (templates). Each paradigm is supported well with optimal space
and time efficiencies.

I didn't know that.

But certainly it's not something everyone agrees on.

For example, I absolutely do not agree that C++ "supports" modular
programming, since there _is_ no module concept in C++. However,
C++ allows you to fake some of it by strictly following some set of
conventions (header file guards etc.). That's in the same spirit
as assembler language supports object-orientation (even old TASM).


I have seen what I said above in TC++PL3 . In chapter 2 BS explains the
paradigms supported and you can find the modular paradigm on page 26 (2.4).


Regards,

Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #5
* Ioannis Vranos:
Alf P. Steinbach wrote:
Yes C++ is a multiparadigm language and currently supports 4 paradigms.
The procedural paradigm (functions etc), the modular paradigm
(namespaces ), the object oriented paradigm and the generic programming
paradigm (templates). Each paradigm is supported well with optimal space
and time efficiencies.


I didn't know that.

But certainly it's not something everyone agrees on.

For example, I absolutely do not agree that C++ "supports" modular
programming, since there _is_ no module concept in C++. However,
C++ allows you to fake some of it by strictly following some set of
conventions (header file guards etc.). That's in the same spirit
as assembler language supports object-orientation (even old TASM).


I have seen what I said above in TC++PL3 . In chapter 2 BS explains the
paradigms supported and you can find the modular paradigm on page 26 (2.4).


Well I doubt that Bjarne says C++ supports modular programming in a
sense different from OO (e.g. like Modula or Pascal or Ada), but if he
really does then I for one disagree! ;-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #6
Alf P. Steinbach wrote:
Well I doubt that Bjarne says C++ supports modular programming in a
sense different from OO (e.g. like Modula or Pascal or Ada), but if he
really does then I for one disagree! ;-)


Have you read the paragraph I provided you? In case you do not have this
book here is how it starts:

[It is placed after the procedural paradigm explanation and the topics
are placed in historical ordering].

"2.4 Modular Programming

Over the years, the emphasis in the design of programs has shifted from
the design of procedures and toward the organization of data. Among
other things, this reflects an increase in program size.

A set of related procedures with the data they manipulate is often
called a module. The programming paradigm becomes:
Decide which modules you want;
partition the program so that data is hidden within modules."

Then it has some more.

Regards,

Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #7
* Ioannis Vranos:
Alf P. Steinbach wrote:
Well I doubt that Bjarne says C++ supports modular programming in a
sense different from OO (e.g. like Modula or Pascal or Ada), but if he
really does then I for one disagree! ;-)
Have you read the paragraph I provided you?


Nope, cause you didn't provide it... :-)

In case you do not have this book
I don't. I have the first edition, though.

here is how it starts:

[It is placed after the procedural paradigm explanation and the topics
are placed in historical ordering].

"2.4 Modular Programming

Over the years, the emphasis in the design of programs has shifted from
the design of procedures and toward the organization of data. Among
other things, this reflects an increase in program size.

A set of related procedures with the data they manipulate is often
called a module. The programming paradigm becomes:

Decide which modules you want; partition the program so that
data is hidden within modules."


Hum, well, that could refer to just about anything, including OO, and
it doesn't say that C++ supports _whatever_ it is, so as usual I think
Bjarne has not overstated the case, but here is being misinterpreted.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #8
Alf P. Steinbach wrote:
Have you read the paragraph I provided you?

Nope, cause you didn't provide it... :-)


I was talking about this: "In chapter 2 BS explains the paradigms
supported and you can find the modular paradigm on page 26 (2.4)."

"2.4 Modular Programming

Over the years, the emphasis in the design of programs has shifted from
the design of procedures and toward the organization of data. Among
other things, this reflects an increase in program size.

A set of related procedures with the data they manipulate is often
called a module. The programming paradigm becomes:

Decide which modules you want; partition the program so that
data is hidden within modules."

Hum, well, that could refer to just about anything, including OO, and
it doesn't say that C++ supports _whatever_ it is, so as usual I think
Bjarne has not overstated the case, but here is being misinterpreted.


OO paradigm is mentioned later and in this paragraph namespaces are
mentioned for implementing the paradigm:
"
[...]

C++ provides a mechanism for grouping related data, functions, etc.,
into separate namespaces. For example, the user interface of a Stack
module could be declared and used like this:
namespace Stack{ // interface
void push(char) ;
char pop() ;
}
void f()
{
Stack: :push(´c´) ;
if (Stack: :pop() != ´c´) error("impossib le") ;
}
The Stack:: qualification indicates that the push() and pop() are those
from the Stack namespace. Other uses of those names will not interfere
or cause confusion.

The definition of the Stack could be provided in a separately-compiled
part of the program:
namespace Stack{ // implementation
const int max_size = 200;
char v[max_ size] ;
int top = 0;
void push(char c) { /* check for overflow and push c */ }
char pop() { /* check for underflow and pop */ }
}

The key point about this Stack module is that the user code is insulated
from the data representation of Stack by the code implementing
Stack::push() and Stack::pop(). The user doesn’t need to know that the
Stack is implemented using an array, and the implementation can be
changed without affecting user code.
[...]

"

Anyway it is an excellent book and I think every C++ programmer should
buy and *read* it.


Regards,

Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #9
* Ioannis Vranos:

Anyway it is an excellent book and I think every C++ programmer should
buy and *read* it.


Yes, I agree.

In fact it's even stronger: if you like the book then you're probably
a good C++ programmer or C++ programmer material, and if not, then
likely not. ;-)

And yes, as shown (I snipped that example) it's possible to implement
Modula/Pascal/Ada-like modules in C++, by use of conventions. Some
features are not possible to implement though. For example, transparent
module initialization requires language _support_. And in a language
with module support you get automatic checking of module dependencies
and such, which must be faked via brittle include guards in C++. Etc.

Cheers,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
1741
by: John Benson | last post by:
Hi, I see a lot of posts asking about "the best Python book." In my experience, there is no such thing, but there are a lot of good books that will help you along in different ways, and at different times. First of all, I'd like to clarify my position on learning: I subscribe to the adobe hacienda school of autodidactic technology, to wit: "If you throw enough adobe at the side of the hacienda, some of it will stick"
0
1222
by: MPOOL'03 Organizers | last post by:
We apologize if you receive this CfP multiple times * Please distribute ! -------------------------------------------------------------------------- CALL FOR PAPERS Workshop on MULTIPARADIGM PROGRAMMING WITH OO LANGUAGES (MPOOL'03) at the Conference on
0
1259
by: MPOOL'03 Organizers | last post by:
We apologize if you receive this CfP multiple times * Please distribute ! -------------------------------------------------------------------------- CALL FOR PAPERS Workshop on MULTIPARADIGM PROGRAMMING WITH OO LANGUAGES (MPOOL'03) at the Conference on
0
1445
by: Jörg Striegnitz | last post by:
We apologize if you have received this CfP multiple times. -------------------------------------------------------------------- SECOND CALL FOR CONTRIBUTIONS AND PARTICIPATION Workshop on MULTIPARADIGM PROGRAMMING WITH OO LANGUAGES (MPOOL 2004) (June 14 or 15, TBD) at the EUROPEAN CONFERENCE ON OBJECT-ORIENTED PROGRAMMING (ECOOP 2004)
65
4249
by: Roger Smythe | last post by:
A means for the progressive decomposition a problem space into increasingly simpler component parts such that these component parts represent higher levels of conceptual abstraction, and are completely independent of each other except for their well-defined interfaces. This was an attempt to explain the gist of OOP to programmers accustomed to the structured programming paradigm. I tried to explain OOP in terms of ideals that can be...
22
1574
by: Corey C. Carter | last post by:
I am new to programming. Over the years I have "tried" many langauges such as basic, pascal(yea yea, I know, out of date), python and C. I was under the impression that one must lean C before moving on to C++. Is that true, or can I just begin with C++?
0
789
by: Jo Blow | last post by:
Hi All, I have a client that has written a specification for a Database system comprising of 9 seperate MS Access Applications distributed throughout a group of Hospitals. I have proposed that a single central web based application would be more economically viable, scalable, secure, maintainable etc. However I need to write a document to reflect this. Its not that hard but with time constraints I was wondering if anyone knows of online...
109
4512
by: jacob navia | last post by:
A recent article on CNN described the problem that phone makers are facing. (http://www.cnn.com/2006/TECH/biztech/05/29/cellphone.usability.ap/index.html) Most people are rejecting the new "supercharged" cell phones because they just do not want to learn the incredible complex menus and stuff that you need to use them. The new phones are just too complicated to use.
2
1093
dmjpro
by: dmjpro | last post by:
I have a confusion to understand the two basic terms .... programming paradigms and programming technology. I need the technical differences. plz help. kind regards. dmjpro.
0
8355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8638
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.