Re: AfxGetApp() returns NULL



But I rarely need to find "all calls" to public methods, because the public methods are
used in very few places. For example, the public methods of a CDocument class are
typically only used by the CView, and a simple search will find those; no sophisticated
browsing information is required. There might be classes that are shared between a CView
and a CDocument derivation, but in that case, I still can find them all quickly. By not
tossing tons of public methods in to generic classes like my CWinApp-derived class, there
is no question of needing to find all of them; they exist only in the modules that can
name the class, and there are very few of those.

When I get programs that have been badly written, then a browser is useful. But I don't
need one for my own code, because I don't write things that require fully general browsers
to find them. By limiting scope and visibility, I usually can quickly find what I need.
Having a decent "grep" instead of the abomination of Find In Files that VS supplies is
also a great help! (There are so many things wrong with Find In Files that I deem it a
useless misfeature. The simplest ones, that it replaces the contents of the find window,
and that you cannot delete lines from the find window individually, already makes it so
unusable that the rest of the superficial flaws become irrelevant)
joe
On Sun, 16 Dec 2007 18:17:44 GMT, "David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx> wrote:

"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:1opam3ll4rjb924j3d5mnpmm4s3601oq2e@xxxxxxxxxx
I don't instantly need all references to functions nearly all the time,
because most
methods are called in restricted contexts. In general, it takes me less
time to find all
the uses of a function using a decent text editor than it takes to create
the browse
information on each compilation, even for source suites in the range of
400 source files
and > 100K lines. But I rarely need to find variables anywhere, because
most of them are
either member variables of small classes or local variables with limited
scope. So I can
write very complex programs with a minimum of fuss. More importantly, I
can maintain them
readily. If there are two modules that use a variable, only those two
modules can even
name it; there is no question that every module in the system could use it
because it
happens to be visible.


First of all, you don't need to compile for browse information anymore.
Visual Assist has its own background parser, and even if you don't use this,
I think the new VC.NET ClassView will let you find references without browse
info.

I was talking about finding all calls to public methods, for example.
Surely there is no way using good programming practice alone to find out
that. If you have a public method called i(), you can't intelligently grep
for it even. You would get variables called i, etc.

And even if your code could magically conform to some standard that let you
do this, what about all the inherited codebases which were written
willy-nilly? How do you grok those without advanced tools?

-- David

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.


Loading