473,382 Members | 1,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Give me some advice about book and how to master vc and mfc!

Hi ,

I am a graduate , I have had some basic knowlege about C++ ! but
I find that I can't master it , I am disappoint for that . who give me
some advice about ways which master it and some good books 。I will
be pleasure.
Thank you in advance!
Zhang

Apr 27 '06 #1
12 2711
yuyazhang wrote:
Hi ,

I am a graduate , I have had some basic knowlege about C++ ! but
I find that I can't master it , I am disappoint for that . who give me
some advice about ways which master it and some good books 。I will
be pleasure.
Thank you in advance!
Zhang


Well, grab a good book and read it down:)

Regards,
Ben
Apr 27 '06 #2
"yuyazhang" writes:

I am a graduate , I have had some basic knowlege about C++ ! but
I find that I can't master it , I am disappoint for that . who give me
some advice about ways which master it and some good books ?I will
be pleasure.

I'm not sure anyone has ever mastered C++, the language is huge, not pure,
and not really designed to my way of thinking. This leads to quirky
effects. By not pure, I mean object orientation is tacked on to the C
language and the result is a forced fit. Obviously has been and is very
successful despite these problems.

The best way to proceed that I know of is to work with _The C++ Programming
Language_ by Stroustrup, at least the third edition. Write lots of code,
and don't keep beating the same problem over and over which I think a lot of
people do. Writing you own string class is a good exercise if you haven't
already done so.
Apr 27 '06 #3
osmium wrote:
The best way to proceed that I know of is to work with _The C++
Programming Language_ by Stroustrup, at least the third edition.


The absolute worst way to learn C++ has got to be MFC.

;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 27 '06 #4
> By not pure, I mean object orientation is tacked on to the C
language and the result is a forced fit.


Can you be more specific about why C++'s object-oriented support is a
"forced fit"?

I am under the impression that you came to this conclusion because C++
does support non-OOP paradigms. Please prove me wrong.

Regards,
Ben
Apr 28 '06 #5
benben wrote:
By not pure, I mean object orientation is tacked on to the C
language and the result is a forced fit.


Can you be more specific about why C++'s object-oriented support is a
"forced fit"?


I can. Some languages permit this (in pseudo-C++ syntax):

void foo(class & bar)
{
bar * frob = new bar;
...
}

I passed a class as an object into foo().

Because C++ must follow C's legacy compiler and linker technology, classes
are not objects. So we have two (mildly conflicting) syntaxes to do related
OO things. To pass an interface to a function, we can use inheritance. To
pass a class to a function, we must use template syntax. This is redundant -
two different systems to pass things to functions! Redundancy is a very
clear indicator of poor design.

Tip: Part of becoming fluent in programming is to let go of defensiveness
over languages. And about OO!

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 28 '06 #6

Phlip wrote:
benben wrote:
By not pure, I mean object orientation is tacked on to the C
language and the result is a forced fit.


Can you be more specific about why C++'s object-oriented support is a
"forced fit"?


I can. Some languages permit this (in pseudo-C++ syntax):

void foo(class & bar)
{
bar * frob = new bar;
...
}

I passed a class as an object into foo().

Because C++ must follow C's legacy compiler and linker technology, classes
are not objects. So we have two (mildly conflicting) syntaxes to do related
OO things. To pass an interface to a function, we can use inheritance. To
pass a class to a function, we must use template syntax. This is redundant -
two different systems to pass things to functions! Redundancy is a very
clear indicator of poor design.


That ability in other languages comes with several expenses including
type safety and runtime efficiency.

That is a fact...which is better is an opinion.

Apr 28 '06 #7
> I can. Some languages permit this (in pseudo-C++ syntax):

void foo(class & bar)
{
bar * frob = new bar;
...
}


Let's say we do something with frob other than the dot dot dot:
void foo(class& bar)
{
bar* frob = new bar;
frob->do_trick();

delete frob;
}
Well, the problem is, what if class bar doesn't have a do_trick member
function? You are moving compile-time error to runtime error, which is
equivalent to letting the end users to deal with the error instead of
you dealing it. Not a wise move.

A type-safe alternative can be achieved in C++:

template <typename bar>
void foo(void)
{
bar* frob = new bar;
frob->do_trick();
delete frob;
}

Were bar not supporting the do_trick member, the compile will tell you.

Regards,
Ben
Apr 29 '06 #8
benben wrote:
Let's say we do something with frob other than the dot dot dot:

void foo(class& bar)
{
bar* frob = new bar;
frob->do_trick();

delete frob;
}

Well, the problem is, what if class bar doesn't have a do_trick member
function? You are moving compile-time error to runtime error, which is
equivalent to letting the end users to deal with the error instead of you
dealing it. Not a wise move.
Why can't the compiler just detect the use of class& and morph it into the
template expansion system currently used for template<class>?

(Because something could call the function that the compiler can't see yet,
unlike templates which have a fixed instantiation point, etc...)

The outer problem here is simply flexibility. I think having two redundant
systems to pass things into functions (either types or objects) is _less_
flexible than one unified system. Such unifications tend to force us to
invent the _weakest_ possible primitives, which then can be assembled in
new, emergent ways that language designers never thought of.

The inner problem is your unit tests should catch the error. ;-)
A type-safe alternative can be achieved in C++:

template <typename bar>
void foo(void)
{
bar* frob = new bar;
frob->do_trick();
delete frob;
}

Were bar not supporting the do_trick member, the compile will tell you.


Can you do the Prototype Pattern with templates? The general point here is
that letting classes be objects makes many design patterns get shorter and
more trivial.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 29 '06 #9
Phlip wrote:
benben wrote:
Let's say we do something with frob other than the dot dot dot:

void foo(class& bar)
{
bar* frob = new bar;
frob->do_trick();

delete frob;
}

Well, the problem is, what if class bar doesn't have a do_trick member
function? You are moving compile-time error to runtime error, which is
equivalent to letting the end users to deal with the error instead of you
dealing it. Not a wise move.
Why can't the compiler just detect the use of class& and morph it into the
template expansion system currently used for template<class>?

(Because something could call the function that the compiler can't see yet,
unlike templates which have a fixed instantiation point, etc...)

The outer problem here is simply flexibility. I think having two redundant
systems to pass things into functions (either types or objects) is _less_
flexible than one unified system. Such unifications tend to force us to
invent the _weakest_ possible primitives, which then can be assembled in
new, emergent ways that language designers never thought of.


While whether flexibility can be improved by making classes objects is
largely a subject of debate, I would point out that flexibility give way
to program correctness when they conflict.

The inner problem is your unit tests should catch the error. ;-)
Why put an error to unit test while you could have eliminate it in the
first place?

And how are you so confident that your tests could catch all the errors?
I am not. And aren't you frustrated every time your browser pops up a
warning telling you some object doesn't support certain method? I am!
A type-safe alternative can be achieved in C++:

template <typename bar>
void foo(void)
{
bar* frob = new bar;
frob->do_trick();
delete frob;
}

Were bar not supporting the do_trick member, the compile will tell you.


Can you do the Prototype Pattern with templates? The general point here is
that letting classes be objects makes many design patterns get shorter and
more trivial.


What does prototype pattern have to do with template? It can, of course,
be done in C++ with or without templates.

Type safety is a C++ feature. It is designed to restrict you from doing
something silly or inconsiderate in the first place. If you want to by
pass the type system you have to be explicit (so that you know what you
are doing)

As I said, flexibility gives way to correctness.

Regards,
Ben
Apr 29 '06 #10
Thank you very much!

Apr 29 '06 #11
>I am a graduate , I have had some basic knowlege about C++ ! but
I find that I can't master it , I am disappoint for that . who give me
some advice about ways which master it and some good books 。I will
be pleasure.


Master vc or mfc?
Do some software yourself.
I have never used VC until I joined the present company six months ago.

Apr 30 '06 #12
benben wrote:
While whether flexibility can be improved by making classes objects is
largely a subject of debate, I would point out that flexibility give way
to program correctness when they conflict.


Making classes objects is orthogonal to the problem: Two different syntaxes
to passing things into functions. Redundancy is always a design smell.
The inner problem is your unit tests should catch the error. ;-)


Why put an error to unit test while you could have eliminate it in the
first place?


Both arguments use the fallacy of the excluded middle. Let's do both.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Apr 30 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Jeff Wagner | last post by:
I am in the process of learning Python (obsessively so). I've been through a few tutorials and read a Python book that was lent to me. I am now trying to put what I've learned to use by rewriting...
4
by: Steven O. | last post by:
I am basically a hobbyist programmer, at the moment doing a little work experimenting with some AI stuff. I learned C++, and then tried to teach myself MFC using MS Visual C++ 6.0. I swore off of...
11
by: Bernard | last post by:
Hi All, Is there a book on C/C++ by dietel and deitel? Is there a book on C/C++ by herbert schildt? Is there a book on C/C++ by Don Libes? someone said he saw a gem in one book and gave me...
4
by: Vince S | last post by:
Hello. I'm currently trying to learn programming in C++. My goal is to write Windows applications, mostly for personal use. For example, I'd like to create my own multi-threaded newsreader. ...
16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
5
by: Alfonso Morra | last post by:
Hi, I am a C/C++ developer of quite a few yesrs, although I am relatively new to Windows (Unix background). I am about to begin work on a project that would require me to develop several GUI...
0
by: yuyazhang | last post by:
Hi , I am a graduate , I have had some basic knowlege about C++ ! but I find that I can't master it , I am disappoint for that . who give me some advice about ways which master it and some...
12
by: johannblake | last post by:
First off, I am NOT a beginner. I have lots of experience developing professional web sites and am a professional software developer. Unfortunately I've been out of web site development for the...
5
by: shapper | last post by:
Hello, In this moment I am creating all my aspx pages on my vb.code at runtime. It seems nonsense to have .aspx and .aspx.vb files in my projects. I am considering creating my pages on the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.