C++ standards committee looking at adding Cairo to the C++ standard

S

Stefan Ram

Ian Collins said:
That's correct. I can't see how adding something to the standard makes
it easier to teach. Whether a widget is a std::widget or one from a

... non-standard ...
library, it is still a widget.

When something is announced as a »C++ course«, it is easier to
teach what actually /is/ part of C++, because people expect this
and also I myself deem this to be honest.
 
J

Jorgen Grahn

Ian Collins <[email protected]> writes:

Some extra context: SR wrote:
| Contracts are essential for modern programming, and
| contracts of classes and functions are being described in
| the documentation. So it is good when a language supports this.
There are contracts that cannot be expressed as unit tests.
For example, we might require that »for all int values i:
0 <= f( i )< 100«. Unit tests can express random examinations
of this, but they cannot directly express a universal quantification
over a very large set.

Unit tests are great! But even in Java, they do not /replace/
the contracts in the JavaDoc, but are /added/ to them.

I don't know Java, but are unit tests useful as documentation in /any/
interesting cases? Mine turn out, in the best case, as examples which
supplement the interface documentation but are rather useless if you
don't read the latter first.

/Jorgen
 
I

Ian Collins

Stefan said:
... non-standard ...


When something is announced as a »C++ course«, it is easier to
teach what actually /is/ part of C++, because people expect this
and also I myself deem this to be honest.

But you aren't teaching the library, you are using a part of it to
illustrate a concept. I assume you use a compiler in your course but
you don't consider learning how to use the compiler as part of the course.
 
I

Ian Collins

Jorgen said:
Some extra context: SR wrote:
| Contracts are essential for modern programming, and
| contracts of classes and functions are being described in
| the documentation. So it is good when a language supports this.


I don't know Java, but are unit tests useful as documentation in /any/
interesting cases? Mine turn out, in the best case, as examples which
supplement the interface documentation but are rather useless if you
don't read the latter first.

In most of my projects, they are the documentation (and implementation)
step between the user stories and the code. Unlike JavaDoc style
comments, they are always up to date!
 
S

Stefan Ram

Jorgen Grahn said:
I don't know Java, but are unit tests useful as documentation in /any/
interesting cases?

I think that some people do have this idea. For example the Wikipedia
contains this:

»using unit-tests as a design specification has one significant advantage«

. It might be possible if one first establishes a formal specification
language and then a formal and bijective mapping to unit tests.

So, to contradict what I myself wrote in my previous post, the contract

»for all i, such that P(i): Q(f(i))«

might be expressed as:

»select a random value i using a random generator G(P,i)
assert Q(f(i))«

. But while this might help to express contracts, it might not be the
best approach to write unit tests. Unit test also need to fulfill
other demands, for example, to find as many bugs as possible.
And contracts might be easier for humans to understand when
expressed using English than using unit test.
 
J

Jorgen Grahn

In most of my projects, they are the documentation (and implementation)
step between the user stories and the code.

I wonder if I would find them /useful/ as documentation too ... are
any of these projects publicly available so I could take a look?
Unlike JavaDoc style
comments, they are always up to date!

Yeah, well ... I don't understand what's so hard about keeping
documentation up to date. I frequently see people let it slip, and I
cannot figure out why. Incompetence? Mine is always up to date, but
that's because I write it to /use/ it. If I was forced to write
meaningless or superfluous documentation ("void foo() is a function
called foo which returns nothing") that would be a different issue.

/Jorgen
 
W

woodbrian77

My segmented_array container is not /better/ than deque it is just
/different/; it has different performance and invalidation
characteristics for certain operations compared with vector, deque *and*
list.

Your container is more flexible in that the user can pick the
segment size. That's better.


Brian
Ebenezer Enterprises
http://webEbenezer.net
 
W

Wouter van Ooijen

When something is announced as a »C++ course«, it is easier to
teach what actually /is/ part of C++, because people expect this
and also I myself deem this to be honest.

You can't explain C++ without examples. Examples are not part of the
standard, so why not take real-world examples from the use of a library.

I assume your course has homework or something similar? There are no
assignments in the C++ standard. So when you select/write the
assignemnets, make them do somthing simple but real. Graphics are not
the only choice, but not a bad one.

Wouter
 
Ö

Öö Tiib


'boost::intrusive' does not contain 'map'. So if someone needs
a map then 'std::map' is clearly superior for her. If someone does
not need a map then sure, why she used 'std::map'?

Note that the original intention of starters of boost was to build
libraries suitable for incorporation into the C++ language standard.
They actually have been quite successful with that. You basically
bring example from work that is meant for proposing to standard.

The major beneficial difference of intrusive containers is that
exactly same object can be in several different containers at same
time.

The other difference is that user has to manage the lifetime of
objects. Lot of users I have met have difficulties of optimal
resource management (coming from garbage collections) so that
difference can not be labeled as clearly beneficial.

I have seen cases in practice where 'boost::intrusive::set' results
with 4 times faster than 'std::set' with default allocator. 'std::set'
can be also made to perform as well as 'boost::intrusive::set' by
using custom allocator so it still does not mean it is clearly
inferior.
 
J

Jorgen Grahn

But you aren't teaching the library, you are using a part of it to
illustrate a concept.

When I was a student, it was not uncommon to have exercises based on
some library or other ready-made code. It was usually written by the
teacher or someone at the staff, and explicitly crude and simple, not
enough for real-world use.

E.g. we got the parser and the virtual machine/interpreter for free
when we did the compiler course and were supposed to focus on code
generation. We got a nice little railroad simulator (graphical, with
bells and whistles) when doing the concurrency course. And so on.

/Jorgen
 
R

Rui Maciel

Stefan said:
What works in the real world does not always work in the
classroom. First, it does not even always work in the real
world (many software project fail, are cancelled, or overdue).

I never heard of any case of a project failing due to having adopted a GUI toolkit which wasn't
included in an international standard.

Next, the classes are already much too short to teach most
of what is in the standard C++, so they only teach a selection.
Teaching a »picked library« means that there will be even
less time to teach C++ proper. While some students might
like this, others might be alienated by it.

I don't see how you get more teaching time by adding a component to the C++ standard.


Rui Maciel
 
R

Rui Maciel

Öö Tiib said:
I do not understand. Are you saying that first impression is irrelevant?

How many people got their first impression from C++ by reading the unreleased draft of the ISO
standard currently in development? Because it appears that so far with regards to first
impressions the language has been doing great so far.

My point was that C++ toolset leaves sad first impression as state of art.

If you believe that standardizing GUI toolkits has anything to do with state of the art then
your concept is not only outdated by a decade or two but it also ignores history.

C++ standard is guideline for people writing C++ compilers and standard
library implementations so it has everything to do with improving that
toolset.

Surely you must be aware that it's possible to develop components for C++ without having them
included in an ISO standard.


Rui maciel
 
R

Rui Maciel

Stefan said:
... non-standard ...


When something is announced as a »C++ course«, it is easier to
teach what actually /is/ part of C++, because people expect this
and also I myself deem this to be honest.

Do you believe that programs and/or libraries written in C++ aren't C++?


Rui Maciel
 
Ö

Öö Tiib

How many people got their first impression from C++ by reading the unreleased draft of the ISO
standard currently in development? Because it appears that so far with regards to first
impressions the language has been doing great so far.

I repeat ... I don't understand what you are saying. Explain?
A: First impression does not matter. (Then lets agree to disagreement.)
B: First impression that C++ leaves is good. (Then lets agree to disagreement.)
C: Graphics can't attract nor impress. (Then lets agree to disagreement.)
D: C++ standard can do nothing to improve C++. (Then lets agree to disagreement.)
E: ... <- Please fill it.

Where did I write that standard is meant for reading by students? I did specify
standard's audience and you quoted it below.
If you believe that standardizing GUI toolkits has anything to do with state of the art then
your concept is not only outdated by a decade or two but it also ignores history.

Unimpressive state of compilers, standard library and tools of C++ is direct result of C++
standard not requiring features that can attract or impress from those people who should
read it. Historic issues continue being issues until repaired, decades do not matter.
Surely you must be aware that it's possible to develop components for C++without having them
included in an ISO standard.

My awareness does not help at all with issue that I described. IOW it is irrelevant.

Every third newbie question is:
"what is good C++ GUI toolkit?" (first two questions are about books and tutorials)
Every second answer to that question is:
"Qt is more or less OK, but it is LGPL and it is corporately owned and it switches owners
every two years and it creates large binaries and the code of it is not really C++ and it
does take some serious hacking to get it to work on iOS or Android ...and so on."

Is it impressive?
 
R

Rui Maciel

Rui said:
I never heard of any case of a project failing due to having adopted a GUI
toolkit which wasn't included in an international standard.

Correction: a basic 2D drawing API.


Rui Maciel
 
J

Jorgen Grahn

I'm afraid not.

Ah, too bad.
I try to name my tests so they document the behaviour of the code. The
tests them selves act as both detailed descriptions and examples of how
to use the code. I think this is much easier to do well if the tests
are written first.

I can imagine that working to some extent ... especially if you
clearly separate "illustrative" tests and "tricky edge cases" tests.

But I suspect personality is involved too. For example, I learn much
better by reading about principles than from examples.
Usually time pressure!

Not when the documentation is five lines up from the place they
change. Then they're virtually shouting "I didn't bother to learn
about the /intentions/ behind this code before I changed it"[1].
Fortunately it's quite easy to catch this in review.

/Jorgen

[1] Once again, assuming the documentation is relevant to begin
with. If it's not, I'm liable to forget too.
 
C

Chris M. Thomasson

"Rui Maciel" wrote in message
It appears that Herb Sutter wants to add a 2D drawing library to the C++
standard, and he is
looking at libCairo as a base for this library.
What are your thoughts on this?

Graphics for C++, Humm. Perhaps raw bitmaps?

Then teach the students how to program their own line and circle
plotting algorithms in C++. Then go for Bezier Curves, and on and
on. Turning math into visual representations can be a powerful
method of teaching...

IMVHO, starting to learn 2d graphics from "scratch" is the essence
of the power of C++.

;^)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top