The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

COM with Python vs C++

How is it that something as simple as

"x=win32com.client.Dispatch('InternetExplorer.Application.1')"

in Python turns into a huge tangled mess in C++?!
coder
Sunday, April 15, 2007
 
 
It's magic.
Fritz Send private email
Sunday, April 15, 2007
 
 
Somebody else did it for you.

C++ is DIY.
sgf
Sunday, April 15, 2007
 
 
It strikes me as confusing the difference between a language and a library.

It's kind of like the mish mash you get from confusing GUIs with OSs.
old.fart
Sunday, April 15, 2007
 
 
I think people make the mistake of separating the language and the library.
Java and C# (and VB?) succeed because they have excellent library support.
C++ was a pain for 10 years because there was no library.
Lisp has never caught on because of a total lack of library support.
Martin Send private email
Sunday, April 15, 2007
 
 
#import simplifies it quite a bit.

However I do understand your frustrations, having to type:

for(std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); it++)

instead of something like:

foreach(str in strings)

makes me mad.
Tony Edgecombe
Monday, April 16, 2007
 
 
CComDispatchDriver x("InternetExplorer.Application.1");

is hard?
bmm6o Send private email
Monday, April 16, 2007
 
 
Concatenating stl vectors always annoys me:
Whats wrong with:  A += B  or even A.push_back(B)
Instead of  A.Insert(A.begin(),B.begin(),B.end());
looks like someone has tried to breed from COBOL and SQL.
Martin Send private email
Monday, April 16, 2007
 
 
I wasn't aware of CComDispatchDriver.
coder
Tuesday, April 17, 2007
 
 
> Concatenating stl vectors always annoys me:
> Whats wrong with:  A += B  or even A.push_back(B)
> Instead of  A.Insert(A.begin(),B.begin(),B.end());

They aren't generic. You have to write an operator for each type B that you are going support for each sequence. So if each of vector, deque, list are going to support appending each other that's 9 functions rather than 3. If you're going support appending C arrays there's another 3 for that too. And you've stymied anyone who writes a container that want to be STL compatible that you didn't know about.

What happens if you want to insert in the start of the vector? Or the middle? (Less likely for vectors granted but not unreasonable for lists).

How about the occasions when you want something like boost::counting_iterator? Or reverse iterators?

I think I'm happy with a little more typing for a lot more flexibility.
Ian G Send private email
Wednesday, April 18, 2007
 
 
I appreciate the need for iterators, but the point of higher level langauges is to be able to do things at a conceptually higher level of abstraction like concatenating two things that happen to be vectors.
If I wanted maximum flexibility with more typing I have assembler ;-)
Martin Send private email
Wednesday, April 18, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz