Tuesday, February 16, 2016

Digest for comp.lang.c++@googlegroups.com - 25 updates in 6 topics

Cholo Lennon <chololennon@hotmail.com>: Feb 16 09:58AM -0300

On 02/11/2016 02:28 PM, K. Frank wrote:
> CRTP to define interfaces? If not, do you think that
> using the CRTP as a place to define an interface is
> worth the hassle?
 
If you want a real usage example of CRTP please see these 2 libraries
from Microsoft: ATL (Active template library) and WTL (Windows Template
Library). The last one is open source nowadays. They make heavy usage of
CRTP in order to implement static 'virtual' dispatching.
 
ATL: https://msdn.microsoft.com/en-us/library/3ax346b7.aspx
WTL: http://wtl.sourceforge.net/
 
Regards
 
 
--
Cholo Lennon
Bs.As.
ARG
"K. Frank" <kfrank29.c@gmail.com>: Feb 16 06:40AM -0800

Hi Cholo!
 
On Tuesday, February 16, 2016 at 7:58:22 AM UTC-5, Cholo Lennon wrote:
> CRTP in order to implement static 'virtual' dispatching.
 
> ATL: https://msdn.microsoft.com/en-us/library/3ax346b7.aspx
> WTL: http://wtl.sourceforge.net/
 
Could you give a short explanation of the usage of the
CRTP in ATL and/or WTL?
 
(Note, you've responded to my post about using the CRTP
to define "pure" interfaces, but I also posted a companion
question about the CRTP when there is "real code" in the
base class -- which I understand to be the more common
usage.)
 
I drilled down some into your ATL link. I got as far as
 
https://msdn.microsoft.com/en-us/library/f7c98h7e.aspx
 
... > ATL COM Desktop Components > Concepts Window Classes >
Implementing a Window > Message Handler Functions
 
but didn't see anything that was obviously relevant. (The
MSDN can be a bit inefficient to read at times.)
 
Do ATL and/or WTL go beyond the CRTP structure I outlined
in my two posts, or do they use those basic ideas, but in
an obviously more substantive concrete setting?
 
 
> Cholo Lennon
> Bs.As.
> ARG
 
 
Thanks.
 
K. Frank
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 16 07:36PM +0100

On 2/16/2016 3:40 PM, K. Frank wrote:
 
> Do ATL and/or WTL go beyond the CRTP structure I outlined
> in my two posts, or do they use those basic ideas, but in
> an obviously more substantive concrete setting?
 
There's nothing really interesting to find. WTL was based on ATL so
they're not really two different libraries. ATL used
base-class-as-template-parameter to define a most derived class that
implemented the COM IUnknown interface, that is, reference counting and
interface access by id.
 
I wouldn't really call it CRTP.
 
There's a bit of TP, but the the R, for Recurring, does not match the
designs in ATL/WTL.
 
 
Cheers & hth.,
 
- Alf
Cholo Lennon <chololennon@hotmail.com>: Feb 16 04:17PM -0300

On 02/16/2016 03:36 PM, Alf P. Steinbach wrote:
>> an obviously more substantive concrete setting?
 
> There's nothing really interesting to find. WTL was based on ATL so
> they're not really two different libraries.
 
Beyond its relationship, they are two different libraries (at least in
their final objective). ATS is for COM programming and WTL is for GUI
programming (ATL windowing is rudimentary compared with WTL. The last
one has abstractions for controls, dialogs, printings, ddx, support for
message maps, etc)
 
 
 
> I wouldn't really call it CRTP.
 
> There's a bit of TP, but the the R, for Recurring, does not match the
> designs in ATL/WTL.
 
Well I disagree, just grep for "static_cast<T*>(this)" in both libraries...
 
 
Regards
 
--
Cholo Lennon
Bs.As.
ARG
"Öö Tiib" <ootiib@hot.ee>: Feb 16 11:25AM -0800

On Tuesday, 16 February 2016 20:37:11 UTC+2, Alf P. Steinbach wrote:
 
> I wouldn't really call it CRTP.
 
> There's a bit of TP, but the the R, for Recurring, does not match the
> designs in ATL/WTL.
 
Not always but some class templates in ATL and majority of class
templates in WTL are CRTP and virtual functions are avoided. As contrast
in MFC all cases where base class of library needs to call methods of
derived class (by you or library) are handled with virtual functions.
 
CWindowImpl: https://msdn.microsoft.com/en-us/library/h4616bh2.aspx
IOleControlImpl: https://msdn.microsoft.com/en-us/library/a2w18t1x.aspx
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 16 12:07AM

On 15/02/2016 23:40, Jens Thoms Toerring wrote:
> good it will get some good rankings in search engines and may
> end up linked to by wikipedia after some time. It's a bit of
> work, admittedly, but it's the honest way to go.
 
He isn't listening: he is still vandalizing that page with his spam. He
certainly is a stubborn cunt.
 
/Flibble
Jerry Stuckle <jstucklex@attglobal.net>: Feb 15 07:55PM -0500

On 2/15/2016 7:07 PM, Mr Flibble wrote:
 
> He isn't listening: he is still vandalizing that page with his spam. He
> certainly is a stubborn cunt.
 
> /Flibble
 
Does it help to report his spam to wikipedia? I don't know - I've never
seen a spammer so determined.
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
Daniel <danielaparker@gmail.com>: Feb 15 04:59PM -0800

On Monday, February 15, 2016 at 4:37:21 PM UTC-5, woodb...@gmail.com wrote:
woodbrian77@gmail.com: Feb 15 08:13PM -0800

On Monday, February 15, 2016 at 5:40:36 PM UTC-6, Jens Thoms Toerring wrote:
> not for you as the author to decide if it's important enough to
> be mentioned, no matter how good or beneficial for others you
> may consider it to be. It's up to a happy user to add it if
 
I'm also a happy user.
 
> (s)he feels it's important enough.
 
Well, it supports automating the creation of serialization
functions. The serialization library in Boost doesn't do that.
 
It's also an on line approach. So most of the changes
are made to the code generator and users don't have to
patch their installations. In that sense it minimizes
the amount of code that has to be downloaded by users.
 
It's been on line since 2002. Back then the value of
what I wrote above wasn't clear to some people, but I
think it's increasingly obvious today.
 
> except maybe when asked by someone else for details) that
> mentions any of your work (or you personally) - even if you
> feel the treatment to be wrong or unflattering.
 
I'll make it clear that the user that's recommending
it is also the author.
 
> good it will get some good rankings in search engines and may
> end up linked to by wikipedia after some time. It's a bit of
> work, admittedly, but it's the honest way to go.
 
What about the 16 lines of boring text about Java
serialization on that Wikipedia page? Do you support that
being reduced to 5 or 6 lines?
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
 
Jerry Stuckle <jstucklex@attglobal.net>: Feb 16 10:09AM -0500

>> feel the treatment to be wrong or unflattering.
 
> I'll make it clear that the user that's recommending
> it is also the author.
 
It's still spam.
 
 
> What about the 16 lines of boring text about Java
> serialization on that Wikipedia page? Do you support that
> being reduced to 5 or 6 lines?
 
Strawman argument. It has nothing to do with your spam.
 
But then I guess it doesn't make any difference anyway since you can't
seem to keep your site up.
 
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 15 10:42PM +0100

On 2/15/2016 8:32 PM, Christian Gollwitzer wrote:
> search that Brian's software is nothing widely known/applied.
> Unfortunaly, I don't have much experience with Wikipedia's processes,
> how do you call in an admin?
 
I don't know.
 
Wikipedia appears to have evolved to the kind of half-closed society
where an unreasonable investment of time and effort is required just to
get into it.
 
https://en.wikipedia.org/wiki/Serialization
 
Looks clean now but I notice in the edit history Brian is really
persistent about promoting his software there.
 
As if there's no listing of C++ libraries anywhere, not even one
automatically posted to the newsgroups every month.
 
 
Cheers,
 
- Alf
jt@toerring.de (Jens Thoms Toerring): Feb 15 11:40PM

> Sorry if you find it spam. I think it's a case
> of "One man's trash is another man's treasure."
 
If you add your own stuff to wikipedia it's clearly spam. It's
not for you as the author to decide if it's important enough to
be mentioned, no matter how good or beneficial for others you
may consider it to be. It's up to a happy user to add it if
(s)he feels it's important enough. If you want to get some
exposure go and buy some advertisement space somewhere - mis-
using wikipedia for that is spam as clearly as it gets - it
ticks all the boxes.
 
Never ever touch a page (or have any part in changing it,
except maybe when asked by someone else for details) that
mentions any of your work (or you personally) - even if you
feel the treatment to be wrong or unflattering.
 
What about writing an excellent article about serialization
(that may mention your library in some form) that is helpful
to others, and publish it on your own web site? If it's really
good it will get some good rankings in search engines and may
end up linked to by wikipedia after some time. It's a bit of
work, admittedly, but it's the honest way to go.
 
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 16 05:25PM

>> feel the treatment to be wrong or unflattering.
 
> I'll make it clear that the user that's recommending
> it is also the author.
 
That will make absolutely no difference: myself and others will continue
to remove your edits because your software is not notable enough to be
in an encyclopaedia and what you are writing is simply spam promoting
your software.
 
/Flibble
Ian Collins <ian-news@hotmail.com>: Feb 16 10:25AM +1300

Paavo Helde wrote:
> (incremental) linking), so the TDD steps must inevitably be larger. The
> upper limit is set by the abilities of the programmer - how large chunks
> he can manage without "losing the track".
 
My usual answer to that problem is "throw more hardware it"! My trip
point for a hardware boost is usually around 30 for a full build...
 
--
Ian Collins
Wouter van Ooijen <wouter@voti.nl>: Feb 15 10:40PM +0100

Op 15-Feb-16 om 10:34 PM schreef Paavo Helde:
 
> And that's why there is also the refactoring step in TDD so that when
> you have obtained some more insight after implementing cases 1, 2 and 3
> you are now (hopefully) able to rewrite them as "n+1".
 
But why aren't I allowed to do that in the first place?
 
> simpler approach which only works in limited cases.
 
> I am certain there are people and projects where TDD is not useful, but
> I am also sure there are people and projects where it makes sense.
 
That I can totally agree on. But Uncle Bob doesn't seem to admit that
there are *any* projects where TDD is not useful. Or am I
misunderstanding him?
 
Wouter
Paavo Helde <myfirstname@osa.pri.ee>: Feb 15 11:45PM +0200

On 15.02.2016 23:33, Ian Collins wrote:
 
>> My usual answer to that problem is "throw more hardware it"! My trip
>> point for a hardware boost is usually around 30 for a full build...
 
> .. 30 seconds ..
 
The MSVC linker is single-threaded so adding more CPU cores would not
help, and clock speeds are not doubling each 18 months any more
unfortunately.
 
Not that I am blaming the MSVC linker though, we should really split up
that 100MB DLL behemoth.
Vir Campestris <vir.campestris@invalid.invalid>: Feb 15 11:11PM

On 15/02/2016 21:33, Ian Collins wrote:
>> My usual answer to that problem is "throw more hardware it"! My trip
>> point for a hardware boost is usually around 30 for a full build...
 
> .. 30 seconds ..
 
My last employer but one our tests took a couple of weeks to run on the
server farm.
 
But then, we knew they weren't comprehensive ;)
 
Andy
Paavo Helde <myfirstname@osa.pri.ee>: Feb 16 01:40AM +0200

On 15.02.2016 23:40, Wouter van Ooijen wrote:
>> you have obtained some more insight after implementing cases 1, 2 and 3
>> you are now (hopefully) able to rewrite them as "n+1".
 
> But why aren't I allowed to do that in the first place?
 
In my book, you can take as large pieces as you are comfortable with and
as long as you are confident that all important functionality gets
sufficiently covered by tests. If Uncle Bob feels himself comfortable
with testing each one-line edit separately then that's his business.
 
 
> That I can totally agree on. But Uncle Bob doesn't seem to admit that
> there are *any* projects where TDD is not useful. Or am I
> misunderstanding him?
 
No idea, I haven't followed him much. What I do know is that TDD is a
tool, not a goal, and that a tool can always be misused or overused.
Juha Nieminen <nospam@thanks.invalid>: Feb 16 09:09AM

> I am, and I am sure many others are, quite capable of creating
> appropriate abstractions without using TDD.
 
You are missing the point.
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Juha Nieminen <nospam@thanks.invalid>: Feb 16 09:12AM

> design/development method that pays attention to testability. (And on
> top of that, any design method that pays attention to abstraction and
> re-use).
 
How many of those methods actually induce you to both increase the
abstraction of your designs and create tests for your modules at
the same time?
 
Why this hate of TDD? I don't understand.
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
"Öö Tiib" <ootiib@hot.ee>: Feb 16 03:08AM -0800

On Tuesday, 16 February 2016 11:12:56 UTC+2, Juha Nieminen wrote:
> abstraction of your designs and create tests for your modules at
> the same time?
 
> Why this hate of TDD? I don't understand.
 
I think that it is like always when some sort of process, method,
technique or tool is too inconvenient, badly supported, misapplied
and/or overused somehow.
 
To be more concrete:
* They do not do not test units in isolation (typically because testing
framework is weak).
* They handwrite (or manually correct) lot of mocks, fakes and dummies
(typically because testing framework is weak).
* The tests look like cryptic garbage (typically because testing framework
used has verbose and complex setup interface).
* One test checks too several things so it is hard to say what it tests
without using word "and" several times (typically because of one or
more from previous issues).
* TDD (as silver bullet tool and design process) is valued over
individuals and interactions within organization.
* Unit test code coverage (as the holy metric of quality) is valued over
working software within organization.
* and/or other such issues.
 
These are called as strawmen but are likely real issues because It can take
time, debates, work and effort to get corrected. Only few (one?) of such
issues is plenty for someone to become toxic.
Wouter van Ooijen <wouter@voti.nl>: Feb 16 05:16PM +0100

Op 16-Feb-16 om 10:12 AM schreef Juha Nieminen:
> abstraction of your designs and create tests for your modules at
> the same time?
 
> Why this hate of TDD? I don't understand.
 
TDD is just a term/word/phrase, nothing to hate or love. What I don't
like is the set of 3 rules. (And the implied 4'th rule, that someone who
doesn't always use TDD is not a professional.) If that is different from
TDD, please interpret my objections (or even hate) as directed to those
3 rules. But if those 3 rules are essential to TDD, yes, *then* I hate TDD.
 
I have no objection to TDD as a suggestion of how to organise your work,
alsongside other suggestions like (rapid) prototyping, waterfall (yes!),
agile, scrum, peer programming, egoless programming, and a long list of
others. As always, the job of an engineer is to choose the right tool
for the job at hand.
 
Wwouter van Ooijen
Juha Nieminen <nospam@thanks.invalid>: Feb 15 09:49PM

As a contrast to the recent "TDD is harmful" thread, I would like to
recount something I thought of recently in regards to a situation
where TDD doesn't actually achieve what you want, but can still make
your code better regardless.
 
Suppose you have a problem like this: You have made a small class
that opens a file (for example an image file) and does something with
it. One of the things you want to test is that the class actually ends
up closing the file (at the latest when it's destroyed). How would you
test this?
 
Since you are TDD-conscious, mock objects come to you naturally.
Therefore the solution seems to be clear: You have to make a mock
object that behaves like a file handle. To do this, you have to change
the class so that it takes a more abstract file handle than eg. a FILE*
or a std::istream. Once this is done, you can easily create a test to
make sure that your file-handling class ends up eventually closing the
file (by creating a mock file handler object that makes this check and
giving it to the class.)
 
However, there's a problem here: How do we now test that this abstract
file handle (which itself uses eg a FILE* or a std::istream) ends up
closing the file (at the latest when it's destroyed)? We realize that
all we have done is just transfer the problem to another class, and we
have ended up in an ouroboros situation. How could we test this? Create
yet *another* abstract file handle which we can mock? That wouldn't make
much sense since we just did exactly that, and it didn't really help.
We would just be in a vicious cycle.
 
So TDD didn't actually help us solve the actual problem we were trying
to solve.
 
*However* TDD *did* help us, in a natural way, to make our original class
better. That's because now it's more abstract and flexible. We have
changed it from being hard-coded to use a standard file handle into
being abstract, which makes it more flexible. (After all, it now supports
other types of input for the data it needs to read. We can now make
all kinds of abstract "file handle" objects that feed it data from
whatever other resource that might not be a file.)
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 16 09:28AM +0100

On 2/16/2016 3:15 AM, Stefan Ram wrote:
> else than an int-expression between the parens
> (which could be »()«, »{}«, »[]«, or »<>«) and the
> semantics are those of »::std::isalpha«?
 
Yes, you can make it a template and use SFINAE like `std::enable_if`
(or, shameless plug, [1]`cppx::If_`, which provides a more clean and
more readable conventional "if-else" notation for the same).
 
Using a template is a general solution to avoid various kinds of
argument type decay.
 
In particular it's a solution to the problem of providing overloads
where one accepts pointer and the other accepts array.
 
 
Cheers & hth.,
 
- Alf
 
Notes:
[1] <url:
https://github.com/alf-p-steinbach/cppx/blob/plutonium/core_language_support/tmp/If_.hpp>
wij@totalbb.net.tw: Feb 15 09:44PM -0800

I am happy to announce that project Xnod is created.
https://sourceforge.net/projects/systemnode/
 
Xnod tries to develop a more uniform language or scaffolding, or kind
of program deployment to reduce efforts for nearly every programming
tasks.
 
Xnod is currently based on Xarg, and has to be a collabrated project.
So, consider join this project in this initial stage helping ourselves
by sharing your know-how.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: