|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all,
I have come to a point where I can comprehend C++ code much better. I will finish C++ Primer 4/e within next few days. Right now I am feeling the need to have have coding standards when I write programs and I feel I must apply some better ways to design my code e.g. all of my the programmers at my college use to write this code: for( int i=0; i <= 10; ++i ) { add elements to array; } while I used this code from C++ Primer (the book recommended by you people) for( std::vector<int>::const_iterator iter = ivec.begin(); iter != ivec.end(); ++iter ) { ivec.push_back; } and comp.lang.c++ totally pushed the things to the practical-level. One of the best examples I have is this: std::copy( std::istream_iterator<int>( std::cin ), std::istream_iterator<int>(), back_inserter( ivec ) ); no use of while-loop here while all of Post-Graduates of my college use while, arrays an pointers and have no idea about map & istream iterators. what I am trying to say that std::copy is a good coding-standard. Now as I will start writing code for real-life projects I want have a larger look at coding standards so except hanging around comp.lang.c++ I want to have an offline source. I have 2 choices: 1.) Effective C++ 3/e 2.) Effective C++ 2/e , Coding Standards (Herb Sutter et al.) Effective C++ 3/e is twice as much expansive as 2/e. With limited bud what you people advise ? or you think I need something else to do and you have some other plans for me , after all you are my teachers. I will be writing real-lifecode within next week. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
arnuld <NoSpam@NoPain.com> wrote:
> I have come to a point where I can comprehend C++ code much better. > I will finish C++ Primer 4/e within next few days. Right now I am > feeling the need to have have coding standards when I write programs and > I feel I must apply some better ways to design my code e.g. all of my > the programmers at my college use to write this code: > > > for( int i=0; i <= 10; ++i ) > { > add elements to array; > } > > > while I used this code from C++ Primer (the book recommended by you > people) > > > for( std::vector<int>::const_iterator iter = ivec.begin(); > iter != ivec.end(); ++iter ) > { > ivec.push_back; > } Note: the above loop may not work. Modifying the size of a vector while iterating through it is dangerious. > and comp.lang.c++ totally pushed the things to the practical-level. One > of the best examples I have is this: > > std::copy( std::istream_iterator<int>( std::cin ), > std::istream_iterator<int>(), > back_inserter( ivec ) ); The three loops above do completely different things. :-( But I think I understand what you are getting at. > no use of while-loop here while all of Post-Graduates of my college use > while, arrays an pointers and have no idea about map & istream > iterators. > > what I am trying to say that std::copy is a good coding-standard. Now as > I will start writing code for real-life projects I want have a larger > look at coding standards so except hanging around comp.lang.c++ I want to > have an offline source. I have 2 choices: > > 1.) Effective C++ 3/e > > 2.) Effective C++ 2/e , Coding Standards (Herb Sutter et al.) > > Effective C++ 3/e is twice as much expansive as 2/e. With limited > bud what you people advise ? I thing the C++ Coding Standards book is an excellent all around reference. I haven't read Effective C++ 3/e so I really can't you here. What does Stroustrup say? http://www.research.att.com/~bs/bs_f...oding-standard |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
> On Thu, 27 Dec 2007 08:55:13 -0500, Daniel T. wrote:
> The three loops above do completely different things. :-( But I think I > understand what you are getting at. ![]() > I thing the C++ Coding Standards book is an excellent all around > reference. I haven't read Effective C++ 3/e so I really can't you > here. thanks. I have searched the bookpool and found that 2/e was published in SEP 1997, a year before ISO C++ standard was released and 3/e was published in 2005. > What does Stroustrup say? > http://www.research.att.com/~bs/bs_f...oding-standard THNKS A LOT for that link. Stroustrup says this: -- C++ of 1990s -- C++ as of ISO standard (1998) -- C++ in 2005 he says these are 3 totally different approaches to C++ programming, hence I will go with 3/e ![]() |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> On Thu, 27 Dec 2007 08:55:13 -0500, Daniel T. wrote:
> I thing the C++ Coding Standards book is an excellent all around > reference. I haven't read Effective C++ 3/e so I really can't you > here. > > What does Stroustrup say? > http://www.research.att.com/~bs/bs_f...oding-standard thanks, now the only problem is of some OO book. I do not want any theoretical foundations of OOA/M/D. I want a book where i can understand OO ideas in terms of C++ where I can get down fast enough to do C++ coding in an OO way. any advise will be ful. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
changed the title to reflect the discussion.
|
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On 2007-12-28 14:22, arnuld wrote:
>> On Thu, 27 Dec 2007 08:55:13 -0500, Daniel T. wrote: > >> I thing the C++ Coding Standards book is an excellent all around >> reference. I haven't read Effective C++ 3/e so I really can't you >> here. >> >> What does Stroustrup say? >> http://www.research.att.com/~bs/bs_f...oding-standard > > > thanks, now the only problem is of some OO book. I do not want any > theoretical foundations of OOA/M/D. I want a book where i can understand > OO ideas in terms of C++ where I can get down fast enough to do C++ coding > in an OO way. > > any advise will be ful. If you do not already have it Design Patterns by Gamma et al. is often recommended, and there are many (all?) examples in C++, but if you understand the concepts they will be applicable in most OO languages. -- Erik Wikström |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> On Fri, 28 Dec 2007 13:33:02 +0000, Erik Wikström wrote:
> If you do not already have it Design Patterns by Gamma et al. is often > recommended, and there are many (all?) examples in C++, but if you > understand the concepts they will be applicable in most OO languages. thanks and that book is also recommended by C++ FAQs. I think that will be too dense for a beginner (like Booch is too confusing to me) |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
arnuld <NoSpam@NoPain.com> wrote:
> > Daniel T. wrote: > > > I thing the C++ Coding Standards book is an excellent all around > > reference. I haven't read Effective C++ 3/e so I really can't you > > here. > > > > What does Stroustrup say? > > http://www.research.att.com/~bs/bs_f...oding-standard > > thanks, now the only problem is of some OO book. I do not want any > theoretical foundations of OOA/M/D. I want a book where i can understand > OO ideas in terms of C++ where I can get down fast enough to do C++ coding > in an OO way. > > any advise will be ful. "Object-Oriented Design Heuristics" by Arthur J Riel. "C++ FAQs" by Marshall P. Cline, & al. |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
arnuld <NoSpam@NoPain.com> wrote:
> > Erik Wikström wrote: > > > > If you do not already have it Design Patterns by Gamma et al. is often > > recommended, and there are many (all?) examples in C++, but if you > > understand the concepts they will be applicable in most OO languages. > > thanks and that book is also recommended by C++ FAQs. I think that will be > too dense for a beginner (like Booch is too confusing to me) Design Patterns is a great book. The problem with it (from a beginner's perspective) is that it's a bunch of solutions looking for problems. A beginner still needs to learn when to apply which solution and DP doesn't go into much depth about that. That's why I recommended "Object-Oriented Design Heuristics". It gives motivation as to why a particular pattern is good so you can more easily see when to use it. The book also covers some patterns, how to transform code from one pattern to another and why you might want to. |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
arnuld wrote:
> changed the title to reflect the discussion. What discussion? I can only see the post (with the allegedly changed title "Learning OO in C++ way (was: ...") and the only line inside is your announcement about changing the title. Please consider that not some newsreader software is quite unsophisticated and only keeps the messages threaded by the _exact_ title. Changing titles means introducing new thread in such software. V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
> On Fri, 28 Dec 2007 10:18:03 -0500, Victor Bazarov wrote:
> What discussion? I can only see the post (with the allegedly > changed title "Learning OO in C++ way (was: ...") and the only > line inside is your announcement about changing the title. yes. right. If you say it is bad way, then I will not do it again. > Please consider that not some newsreader software is quite > unsophisticated and only keeps the messages threaded by the > _exact_ title. Changing titles means introducing new thread > in such software. I didn't know that. I use PAN and it is quite sophisticated. but that is not my point. My point was I do not want OOA/M/D book. I want to know some list of good books which do OOP in C++. I will try to figure out OOA/M/D later because OOA -> D -> P doe snot work for me and hence I am going the opposite way OOP > D -> A |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
arnuld wrote:
> [..] My point was I do not want OOA/M/D book. I want to > know some list of good books which do OOP in C++. I will try to figure > out OOA/M/D later because OOA -> D -> P doe snot work for me and > hence I am going the opposite way OOP > D -> A You probably prefer to learn by example. You might want to see some C++ code first, then explanation of what it models, and then what principles that model implements. AFAICS it doe snot mean it's bad or impossible to learn that way. It's just backwards. By seeing the result and then the explanation of the principles that led to that design you don't learn why the principles produce that result. What is worse, you only learn that a certain principle produces a certain result, IOW one-to-one relationship between them. Here is an analogy: in middle ages alchemists didn't have a system. They knew properties of some materials, they knew the results of some combinations, but had no idea why it was so. The progress in such case is very very very slow. Once the system was developed, it was possible to predict how elements would respond to each other and there was no need to use the "poke-and-see" method. What is better that now people know that there is more than one way to get what they want. You need to learn the system, and that's why you need to start from OOD and OOA. OOP is a mere derivative from that. You need to find a good OOD book with plenty of good examples instead of trying to understand what OOD is from the result it leads to. Trying to come up with OOD principles from C++ code is akin to trying to come up with C++ code from an watching the application [written in C++] do its thing. V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
![]() |
| Outils de la discussion | |
|
|