Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In my work, my friends always tell me, you know so much about computer science, electronics engineering,..etc. But I have difficulty in applying them and my code is crap.

How to solve that problem? Will I be better or programming isn't my career?

For example, yes I know OCTree that is used for space partitioning in games and it is used for optimization, did I implement it? No, but I know about it in principle.. Do I know algorithms like Sorting, Searching,..etc? Yes, and I know them pretty well, but didn't implement them..

When I get a task, I struggle in applying the things that I know...

share|improve this question

closed as not a real question by Walter, gnat, Robert Harvey, ChrisF Nov 4 '12 at 18:11

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Sounds like you haven't spent enough time writing code. The simple answer is, write as much code as possible and get used to it. –  Lattyware Nov 4 '12 at 12:53
maybe you would do well to practice simpler things to get familiar in your chosen programming environment and worry about implementing harder algorithims/data structures later. –  Doug T. Nov 4 '12 at 12:53
@DougT. would you mention some strategy or practice examples ? –  Moaz ELdeen Nov 4 '12 at 13:03

1 Answer 1

up vote 5 down vote accepted

TL;DR Get your text editor out, and start writing code. There's absolutely no magic involved, you need to practise.

Fundamentally, you are overlooking what programming is. Programming is giving a computer a very specific set of instructions. A computer will do exactly what you tell it to, and nothing else.

When you explain a concept to someone, you are assuming they have knowledge about something. Since you mentioned your friends: this problem is strengthened. They are probably on the same or similar courses to you, so have a lot of prerequisite knowledge that you're relying on.

Try explaining what a linked list is to a child. The first time you try, they will get very, very confused. If you turn around and explain to them how a train works (each carriage points to another carriage, and each carriage contains people) you will quickly understand where you first went wrong.

Programming is the same. No-one, not even the geniuses in the class, can convert a concept into a program without trying, failing, and learning how to recover. Like everything else in life, we learn from our mistakes. The best programmers are the ones who have spent a lot of time doing it, not the ones who are just naturally gifted. Gifts accelerate the initial learning, but nothing else.

As the comments have pointed out, you need practice. The best thing I would do is go ahead, and implement everything you know. You'll fail hard when you start, perhaps you can't even get one line down, but that is fine. In a few weeks, you'll be able to write this concept almost verbatim from memory. While you think this might be 'cheating': it's not. Why? Because write a short story. Then a week later, try and re-write the same short story, word for word. Good luck with that. The reason you can re-program the same concept again is because your brain has become attuned to writing code, not because you have simply memorised it.

Enough waffle, where would I start?

  • Become pro at "hello world". As silly as that sounds, you need to be comfortable with your editor and compiler environment before you begin attacking hard problems
  • Start with smaller structures. Do not implement garbage collection as the first thing you do. It'll be like trying to write your first poem in Shakespearian English. It just won't work.
  • Wikipedia might be a fantastic place to begin. They generally have a good outline of how concepts work, and sample implementation. For example: http://en.wikipedia.org/wiki/Linked_list
  • After you have gone through Linked Lists, Stacks, Queues, Binary Trees and the like, you can begin with your (much harder) problems.
  • After all of that, you can just Google "[language] [concept]" and go from there.
  • Consider getting a book like "cracking the coding interview". This combines explaining concepts really well, and giving you near-perfect implementations in Java.

Have lots of patience. You will not get it the first time. You will not get it the second time. Imagine you are learning French or Spanish, do not assume that because you can explain concepts really well in English, you'll be able to get a translation dictionary and be able to explain it in French or Spanish equally well.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.