VC++ 2005 Express : Love/Hate Relationship!

P

Peter Oliphant

I have been using VC++ 2005 Express for a while now. I'm very impressed with
the language and GUI environment. But, more to the point, I pretty much
adore MANAGED programming, since trying to figure out when it is appropriate
to delete something has always been the main problem in C++ programming (in
fact, if one analyzes this, garbage collection (i.e., memory freeing) HAS to
be done at a level ABOVE the application for many situations).

But the 'hate' aspect to it comes in the difficulty I often have trying to
figure out how to do something. It is often more frustrating becuase I know
it CAN be done, and that there is likely even some aspect of the language/OS
that makes it trivially easy to do. But trying to FIND it, that's another
thing.

Recently I posted (and got a quick excellent response, thanx!) trying to
create a new Bitmap and a subsection of an existing Bitmap. I looked for
something like:

Bitmap^ sub_bm = gcnew Bitmap (source_bm( x,y,w,h ) ) ;

which seems like a good construct for this, but it doesn't work. It turns
out the answer didn't lie in the Bitmap class at all, but in the Graphics
class, using the 'FromImage' method. One uses this method to create a
Graphics object that is associated with the newly created sub_bitmap of the
approriate size, and then draw a portion of the source bitmap to the
sub-bitmap with the Graphics object.

How in hell was I suppose to figure that out using MSDN? MSDN is organized
like a dictionary : you have to know the NAME of what you are looking up to
find it! Thus, it is an EXCELLENT REFERENCE, and a terrible place to LEARN
about the possibilities. Problem is, this is all we get as external
developers to MS! As I like to describe by analogy: a book which details
every component of a car including what each part does, does not give enough
information on how to BUILD a car with said components! How components are
used and interact is not a part of the description of its parts. The whole
is MUCH greater than the sum of its parts!

I wish things were like they were back in the old days when Borland
dominated. They gave TONS of documentation, including books on language
refernece and tutorials, with EVERY language they sold! Visual Studio comes
with no documentation, just a link inside the GUI to MSDN. Instead, MS
writes excellent descriptions on how to use their language, but SELL these
via their MS Press for $100's more. And they aren't compelled to write such
books about everything, leaving some features 'invisible' to developers, and
might as well not exist (e.g., try to find a book on how to use SAPI).

My wish is that if MS sticks with this method (no doco except MSDN), that
they take the time to go over MSDN over-and-over and keep adding TUTORIALS
ans PLEASE, PLEASE, PLEASE more CODE examples (there are tons of pages with
no descriptions or code exmples) in ALL of the languages (yes, MS wants to
push C# since they own it, but C++ examples are necessary if they keep
SELLING C++. makes sense, doesn't it?).

I often write telling MS about pages missing details and any code exmples
(some pages even say 'code example follows' followed by nothing), but I get
no response and the pages never change. So I'm at a loss of what I'm
'suppose' to do...

But, like I said, MS VC++ 2005 Express is my favorite language right now,
just wish I didn't have to research each new aspect I want to use, sometimes
for weeks at a time, before getting the info I need to use it (I'm trying to
get some clear SAPI information, which seems quite scarce)...

[==Peter==]
 
B

Brian Muth

I normally don't editorialize, but I can't help note that you sure want a lot for something that's free.

Most of us occasionally cough up some money and buy the appropriate book. You can do the same. It also helps support those experts
who go through months of work to prepare such books, if that's any consolation while standing at the till.

(Sorry, Peter, not much sympathy from this corner.)

Brian
 
E

Eberhard Schefold

Peter said:
How in hell was I suppose to figure that out using MSDN? MSDN is organized
like a dictionary : you have to know the NAME of what you are looking up to
find it! Thus, it is an EXCELLENT REFERENCE, and a terrible place to LEARN
about the possibilities.

MSDN has the reference, some introductory articles and tutorials, but if
you actually wanted to learn something, you had to get a book (from MS
Press, Wrox, Addison Wesley etc.). It's no consolation if you expected
otherwise, but it has always been that way. I don't see that MS has
plans to change that.
 
P

Peter Oliphant

"Most of us occasionally cough up some money and buy the appropriate book.
You can do the same. It also helps support those experts who go through
months of work to prepare such books, if that's any consolation while
standing at the till."

The first part of my post was how much I appreciate and enjoy the product. I
said this first to make it clear I'm not just complaining. I happen to use
Express because it satisfies all my needs, so why buy the full version? More
on this later...

As for books, ironically, today I just got "MS Speech Server" from Amazon,
and I bought "C++/CLI The Visual C++ Language for .NET" a few weeks ago. I
buy books all the time, including from MS Press if they happen to be
available for what I need. Books alone, I've likely spent at least a few
tens of thousands of dollars on just technical books over time. I have a
technical book collection I've paid at least $3000 for the books included
currently. I'm kind of a technical book junky, if it satisfies my needs for
the applications I do. Over time, I've also probably paid tens of thousands
of dollars for MS products (software and hardware), applied and got a job at
Microsoft in Washington to write testing software (but turned it down for my
current job), so I'm not exactly reistant to buying stuff and feel somewhat
justified to make the observations I've made (I've been programming for 38
years).

How does which version I use or buy of VS VC++ 2005 change the development
knowledge available to me? That is what I'm criticizing. Recently I'm trying
to add speech recognition via SAPI. I have posted in various approriate
newsgroups my desire to find a good source of information, specifically
asking for a good BOOK I would buy. I've also mentioned I'd be willing to
hear about 3rd party speech recognition packages if they exist, but SAPI
seems logical since it is built in and likly quite compatible with MS
products for some reason (hehe). In fact I'm buying every book I can find
that looks remotely close to saying something about SAPI. I bought "Speech
Server" for $35 because it has ONE chapter on SAPI (since I just got it I
can't say if it will help, but it looks promising).

So I'm the farthest thing from a cheapskate in terms of my motivation. I'd
buy a good book if it specialized on developing SAPI applications using C++
managed code (possibly with a CD with good code examples and tools) for
almost any reasonable price right now if you can point me to it!

If you do a google search for SAPI you will find info on how to download new
and old SDK's with SAPI in it. But very little on how to use it. In fact,
many of the resulting links are to other people noticing the lack of
information and asking for such things as code examples, with little or no
responses. [I have some leads on some good websites, but I've been casually
looking for such information for a few weeks now, and feel the process
should be easier than that].

I don't see why it is unreasonable for me to ask that the one official
source for information on how to use a language contain information
sufficient to use features it contains for the first time. This can be done
with tutorials, but good well-documented code examples often do the best
job. And such example code must exist if they tested the featrue of the
language (and since I was offered a job at MS to write testing code, I'm
guessing it exists...hehe).

Sure there are lots of topics with code examples, but why is there so many
without? Whoever worked on each feature or tested it should be made
responsible for making sure their hard work gets the exposure required to
maximize its value by making sure clear information is available and easy to
find which might be needed in order to use it for the first time. MSDN is a
great REFERENCE, but is not a very good source of HOW-TO. Using my analogy
from my other post, I sometimes look at MSDN as being given access to a Pep
Boys stock and being expected to be able to build a car simply by first
finding the parts needed, without even knowing what they are called or
exaclty how they are organized, and with lots of similar looking parts, or
parts with the same name that don't fit (different version).

Now, if you tell me that if I buy the full version of VC++ 2005 I get some
'pass' or 'secret entrance' to a more description of how-to use the features
in VC++ managed, especially SAPI, I have plenty of money to buy it. But I'm
not going to buy it out of some sense of charity for MS or its employees.
Having myself been given a job offer from MS I know they likely have roofs
over their heads and food on the table (and some have Ferrari's in the
garage and one happens to be the richest guy in the world), and last I heard
the MS company isn't too close to declaring backruptcy.

So you might not have much sympathy for me, but I'm not going to lose any
sleep taking advantage of exactly what MS has made free, since they know it
is symbiotic for me to develop with THEIR tools. I'm not just going to buy
something from MS to reward them. Especially since they benefit just fine
from the products I develop, as people have to buy THEIR operating system to
run them (and I've heard Windows is doing quite well in the
marketplace...hehe)....

Make sense?

[==Peter==]
 
B

Brian Muth

I understand what you are saying, Peter, and I'm quite certain Microsoft is listening. Your complaint about wanting more sample code
and better documentation with the sample code has been raised before at various Microsoft conferences and MVP summits (along with
some other complaints regarding better navigation and the elimination of dead links).

I tend to look at it from the "the glass is half-full" perspective. It wasn't too many years ago that the only access to the MSDN
library was through a subscription. I remember it was a big deal when this was released into the public domain. Moreover in recent
years, I've noticed a vast improvement in both the quality and the volume of the MSDN library, including sample code that is often
coded three times: VB.NET, C# and C++. I can only imagine that this compilation of material must take hundreds of writers, reviewers
and editors to put together.... all for free. This is indeed remarkable.

Although the contribution of code snippets and "how-to" topics have greatly improved the library, and still remains exactly what you
say... a reference library. It many aspects it complements other resources very nicely: textbooks, CodeProject and related sites,
newgroups etc.
If you do a google search for SAPI you will find info on how to download new and old SDK's with SAPI in it. But very little on how
to use it.

A couple of Google clicks took me to

http://msdn2.microsoft.com/en-us/library/ms720151.aspx

which immediately took me through a tutorial comprised of how to setup up SAPI, and 7 sample applications. I also see three
additional tutorials in the following section. And,

http://msdn2.microsoft.com/en-us/library/ms717038.aspx

has 16 white papers on the subject.

I went to CodeProject and searched for SAPI, and got 27 hits, many of which appear relevant on cursory inspection.

Granted, I'm not a SAPI specialist, but this looks like a fairly rich area of material right here. I do note that you are looking
specifically for .NET managed code. SAPI is essentially a COM interface, so it's not surprising that many of the examples (but not
all) are unmanaged code. But COM plays very nicely with .NET code. It's really just an Interop exercise isn't it?
MSDN is a great REFERENCE, but is not a very good source of HOW-TO. Using my analogy from my other post, I sometimes look at MSDN
as being given access to a Pep Boys stock and being expected to be able to build a car simply by first finding the parts needed,
without even knowing what they are called or exaclty how they are organized, and with lots of similar looking parts, or parts with
the same name that don't fit (different version).

That's probably not a bad analogy. I wouldn't try to build a car from reading a parts book either. I'd take a course or two. I would
attend lectures. I would talk to other people who have already built a car.

Best of luck with your SAPI project. Sounds like an interesting area.

Brian
 
P

Peter Oliphant

Thanx Brian, the links are very helpful too! :)

Just to be really clear, I'm pretty much blown away that MS gives away the
EXPRESS languages, even though I see how doing so also benefits them. They
are amazing languages, and I absolutely love doing managed object-oriented
programming in C++. Taking the 'garbage collecting' to the outer level
solved so many problems (figuring out when memory was no longer needed made
it very difficult to figure out when one can delete something, and more
importantly, removed most memory leaks). In fact, there are situations where
this is almost required (my favorite example is sharing textures amongst
different things, like walls and characters and items, in on-line RPG's -
how does any one object type know when the texure is no longer needed and
just wasting space? Managed code solves this problem!).

My only real complaint might be that in many cases when the language was
upgraded my old code didn't work. But this is getting much better. Going
from unmanaged to manage was tough, but not that bad. Going from 2005 manage
to 2008 managed (beta 2) required ZERO changes, it worked the first time!

It has been interesting (so far) to see how code development has changed
over the years, and likely will keep changing. I predict the day will come
we don't 'write' code, we 'speak' design! Stay tuned... :)

[==Peter==]
 
B

Ben Voigt [C++ MVP]

Peter Oliphant said:
Thanx Brian, the links are very helpful too! :)

Just to be really clear, I'm pretty much blown away that MS gives away the
EXPRESS languages, even though I see how doing so also benefits them. They
are amazing languages, and I absolutely love doing managed object-oriented
programming in C++. Taking the 'garbage collecting' to the outer level
solved so many problems (figuring out when memory was no longer needed
made it very difficult to figure out when one can delete something, and
more importantly, removed most memory leaks). In fact, there are
situations where this is almost required (my favorite example is sharing
textures amongst different things, like walls and characters and items, in
on-line RPG's - how does any one object type know when the texure is no
longer needed and just wasting space? Managed code solves this problem!).

Actually, managed code does nothing for this problem (if I'm understanding
it right), because the garbage collector is lazy (waits until there is a
shortage of memory) and also doesn't track GPU memory. So as long as you
have free main memory, the GC won't run, the texture finalizers won't run,
and GPU allocations can be failing continually. And naively extending GC to
the GPU won't help, because:

(1) It's very expensive, because you have to trace references from main
memory to graphics textures... which means transferring a lot of data across
the bus and forces CPU/GPU synchronization (busy waits)

(2) It's bursty. For realtime graphics you want each frame to have
deterministic (at least upper bounded) render cost, even if the average cost
is a little higher as a result.

The best you could hope for would be to do a mark-and-sweep algorithm on
each frame as its drawn -- if no sprite in that frame needed a texture it's
unused... but that's way too aggressive, textures representing something
just behind you or muzzle flash or something like that are going to be
needed soon, and needed fast (you really want to lag the game when someone
starts shooting at the player?).
 

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

Top