looking for programming book for writing code

invisible.hippo

Arch-Supremacy Member
Joined
Nov 8, 2008
Messages
17,902
Reaction score
315
Hi, i, looking for programming book that teaches how to write efficient code. Please recommend me those that are good for beginners.
i have read c++ primer.
 

invisible.hippo

Arch-Supremacy Member
Joined
Nov 8, 2008
Messages
17,902
Reaction score
315
You may want to check out 'coursera' website for online programming courses that does provide you with lessons as well as reading material and projects to work on. Personally i find that it is much more useful than books. :)

https://www.coursera.org/courses?languages=en&query=C++

The downside is that you have to follow their timings..
Thank you :s13:, Actually i already know how to write function and stuff.

However the thing is that every time for my assignment, i am having a hard time trying to break down the programming question. So i am kind of looking for a book that teach me step by step how to write a fully program and debug it.:)
 
Last edited:

Idolmister1995

Senior Member
Joined
Sep 28, 2015
Messages
709
Reaction score
5
Have you tried the Accelerated C++ by Andrew Koenig and Barbara E.Moo? What is your project scope mainly on?
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
Thank you :s13:, Actually i already know how to write function and stuff.

However the thing is that every time for my assignment, i am having a hard time trying to break down the programming question. So i am kind of looking for a book that teach me step by step how to write a fully program and debug it.:)

Unfortunately I would suspect you are searching in the wrong direction. In my opinion, what makes a programmer good is not a matter of finding a book or a couple of them which teaches you how to code well.

There are several aspect of what makes a programmer good. Good in various aspect from able to model problems to exists solving techniques, able to apply the most appropriate technique to solving a problem, able to appreciate operational robustness and efficiencies instead of just theoretical efficiency, able to find the right tools for the right job, able to keep your effort in the right balance when tackling a piece of work within a sensible timeframe, knows how to measure your program correctness and efficiencies, knows how to program defensively, knows how to assess on the business requirements and make appropriate judgement in how to approach the problem and so solve.

As you can see, many aspect of what I have mentioned above are seldom found in books. If they do, they exists with the intention to introduce and explain, but not to explain with the intention to teach you code properly.

If I may say so, the technique which you are searching is in essence be a scientist and a detective. A detective job in a crime scene is to investigate on what went wrong, and very often you hypothesis and you deduce what could have went wrong and then you prove it using some reasonable and common sense. This job can be laborious at times and those good at it often make accurate guesses and when they test on those guesses, they most probably hit on the nail quite early. These comes with experiences and these experiences are often on the job, not in the book. There is also an aspect at which you need to be a scientist, and a scientist don't biased. Neither do they take things as-is. They often put themselves in a neutral stand and test out possibilities, even if they seems quite unlikely. There are a few times when I am debugging my work, I have to assume some very unlikely case and they did tested out to be the problem. However these cases are rare, most of the time they are rather superficial, just oversight. I do find a lot of times, amateurs developers don't learn to question their own judgement as-if what they assumed are correct or not, they just took some assumption with faith and move on debugging based on those assumptions without knowing if there are evidences or common sense to support those claims. Hence the further they dig, the more they are into the wrong direction. Diligent ones will find the root cause after a long dig in all directions, and silly ones will never find their way out.

Then there are also those too eager to start coding like they already figure out all things, but often find themselves needing to redo a lot or worse of all, not willing to redo and continue doing the wrong things, just making a simple architecture ends up messy and patchy. That is why good programmers think more than they code. With experience, one can mentally think about the problem and think about what is required and what are missing before starting work. We need smart programmers whom can grasp things mentally, not coding fast and heedlessly.

If you ask yourself what you need to program efficiently, robustly and productively. The answer is KNOWLEDGE. Knowledge in a lot of areas like understanding what data structures are available and how you use them. What API are available and do you know your SDK well ? What libraries are available and how you can fit them for your work ? How do you put things together so instead of reinventing the wheel, you are more like putting things together and orchestrate them properly.

The book you are searching for is the book in your mind, not printed elsewhere. If you are student starting out, then don't search for the silver bullet, it doesn't exist. What exists are knowledge scatter all over the place and you should learn how to gather them and put them to good use.
 

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,754
Reaction score
533
Good morning david,:D
Wall of text!:o
Are you talking about me ? :s13:
Sometimes one needs to go through it to fully understand.:s8:

@ts,
A journey begins with the first step... or something like that.
Programming as with anything, practice makes perfect. So, start hitting the keyboard. Make your codes into blocks just like lego that you can use later. As you reuse these blocks, they will become more robust. :s8: After several rounds of debugging. :o Something like going to hell and back ! :D
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
Good morning david,:D
Wall of text!:o
Are you talking about me ? :s13:
Sometimes one needs to go through it to fully understand.:s8:

@ts,
A journey begins with the first step... or something like that.
Programming as with anything, practice makes perfect. So, start hitting the keyboard. Make your codes into blocks just like lego that you can use later. As you reuse these blocks, they will become more robust. :s8: After several rounds of debugging. :o Something like going to hell and back ! :D

Peter, nope it was never directed at you. Don't be sensitive :) It happens to a lot of juniors I am coaching from time to time. The most common problem ? Too much assumption and too little testing.
 

Maeda_Toshiie

Supremacy Member
Joined
May 12, 2007
Messages
6,310
Reaction score
3
Hi, i, looking for programming book that teaches how to write efficient code. Please recommend me those that are good for beginners.
i have read c++ primer.

Read the primer but tried out the exercises? Practice makes perfect.

One of the first skills of a programmer is to take a problem and break it up into smaller problems. Then break those smaller problems into further sub problems. Break them until you can map them onto functions/subroutines available in the language you are going to program in. Visualize the flow with block diagrams and pseudo code. Only then do you fire up the IDE and start coding.

"Computer science is no more about computers than astronomy is about telescopes." - Edsger Dijkstra


To learn algorithms, get Algorithms by Robert Sedgewick (but don't be demoralized if you can't understand all of it). Corman is good but may be considered heavy for beginners. Do not reinvent the wheel unless absolutely necessary. Code your own algorithms to learn them. However, your implementation of quick sort is going slower than library function available, so use available library functions in production code.


Finally, premature optimization is the root of all evils. Take that to heart.
 
Last edited:
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top