Sign in to follow this  
game of thought

how to unlearn a language

Recommended Posts

for maybe a year now i have been writing very messy code in C++. I like the language but i am beginning to encounter very big problems in my code, mainly due to the way a write it and they way i have learned it. I like C++ and i would like to "relearn". How do you suggest i do that, because i don't think it is as easy as just reading the tutorials over again.

Thank you for your time

Share this post


Link to post
Share on other sites
1. I think the answer to your question depends on what sorts of problems you were seeing in your code that made you want to start over.

2. On your comment "[...] just reading the tutorials over again. [...]", you don't learn programming by reading (or cut-and-pasting) tutorials. If you have been working in C++ for a year, and you are still fooling around with tutorials about language constructs and setting up a class hierarchy or whatever (and not API's or libraries etc., which is a different story) then you are doing it wrong. I'm not saying that you should have learned the whole language in a year (which, depending on what you mean by "learning the whole language" is more-or-less impossible for C++) but you should concentrate on learning enough of the language that you can work independently on projects where step 1 is not [i]cut-and-paste someone's code from the internet[/i]. Edited by jwezorek

Share this post


Link to post
Share on other sites
Read Thinking in C++.
Check out the online C++ FAQ Lite too. http://www.parashift.com/c++-faq-lite/

Read lots of books about writing software, for fun, over time. Maybe something like CODE COMPLETE too. Don't focus on game books. You will need complete knowledge of C++ to make anything worthwhile, game or not.

Share this post


Link to post
Share on other sites
I reccomend getting a good book about C++ programming patterns and object oriented design. There is a lot of nice youtube series dedicated to solely this. Also, try to get a book updated to the neew C++11 standard and read through it. Practice every day. My goal is to make one small simulation every day that is useful using good object oriented design. Also, read the books servant of the lord mentioned. They are awesomesauce.

Share this post


Link to post
Share on other sites
Messy code means you have some code design issues, because most programming language have some very basic concepts in common. But every language has its own strengths and weaknesses. You have to play for what c++ offers you and for that you must know some design principles. Read [url="http://www.amazon.com/Effective-Specific-Improve-Programs-Designs/dp/0321334876/ref=sr_1_1?s=books&ie=UTF8&qid=1348127762&sr=1-1&keywords=Effective+c%2B%2B"]Effective C++[/url]. Hope that makes your messy programs go away :D

Share this post


Link to post
Share on other sites
[quote name='kazisami' timestamp='1348127810' post='4981956']
Messy code means you have some code design issues, because most programming language have some very basic concepts in common. But every language has its own strengths and weaknesses. You have to play for what c++ offers you and for that you must know some design principles. Read [url="http://www.amazon.com/Effective-Specific-Improve-Programs-Designs/dp/0321334876/ref=sr_1_1?s=books&ie=UTF8&qid=1348127762&sr=1-1&keywords=Effective+c%2B%2B"]Effective C++[/url]. Hope that makes your messy programs go away [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
[/quote]
Most programming languages actually share most of their concepts not just a few basic ones, it is the syntax that's different and what's considered to be part of the Standard Library that wildly changes between languages.

For example I hadn't touched Python ever two weeks ago, but I have been programming in C++ and C# for years and I feel fairly confident about my ability to solve a non trivial problem in python after two weeks. I know Python is easy to learn(and there is stuff I don't like about the language, like duck typing and no headers), but this concept goes for other languages as well. As soon as you get fairly competent in one language switching to another one that doesn't use a different paradigm should be really easy once you get the syntax of that language.

Share this post


Link to post
Share on other sites
[quote name='NightCreature83' timestamp='1348141925' post='4981992']
Most programming languages actually share most of their concepts not just a few basic ones, it is the syntax that's different and what's considered to be part of the Standard Library that wildly changes between languages.
[/quote]

No offense, but have you ever heard of Lisp, Haskell etc. They are multi-paradigm language, you can do OOP, functional, generic etc with those languages, they just have the basics of programming in common with other languages, like- variables, functions etc in common. And remember, only the core of the basics are common, like- what is a class? But every language defines its own class definitions not only by differing syntax but also changing the way of doing it. Just consider that, you are a c++ programmer and you know nothing about Java, i tell you to write a class in Java and hide its implementation like a .cpp hides the implementation of a .h. If i only give you Javadocs, it is certainly not possible to do. what about pointers in Java :D

Last word, its my opinion and i believe that some things are common but they are so basic that you need to dug a little deep in every language to do something with that.

Share this post


Link to post
Share on other sites
I had the same problem as you OP. C++ was my first language, however after using it for quite awhile I would still have issues with what I call "macro code", or code that dictates how larger parts of a program interact. For me that encapsulated how classes should interact with each other, inheritance, doing #includes correctly, and a few other tidbits. Unfortunately I have never found a text that really teaches how to create good macro code.

Here's how I dealt with it and maybe it will help you out.

Eventually what happened is I started programming in another OOP language, C#. For C#, OOP is very much more set in stone, and after programming a medium sized project with it, I learned more about OOP than I had learned in almost a year and a half with C++. However this didn't solve my issues with learning how to prevent #include circles, I eventually said 'screw it' and switched over to C# completely.

To this day I've never had to tolerate C++'s god-awful translation unit system since then.

[spoiler]I promise I dont work for microsoft[/spoiler]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this