Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


how to unlearn a language


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 game of thought   Members   -  Reputation: 213

Like
1Likes
Like

Posted 19 September 2012 - 10:08 AM

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

Sponsor:

#2 FLeBlanc   Crossbones+   -  Reputation: 3129

Like
10Likes
Like

Posted 19 September 2012 - 10:19 AM

You don't need to start over. Just move on from tutorials to the more complicated texts that discuss more advanced and more mature usage.

The C++ Programming Language by none other than Bjarne Stroustrup himself.
Thinking in C++ by Bruce Eckel

Might also want to start learning about design patterns, and really trying to understand the patterns and how to apply them. Go back to some of your older code and see if you can refactor it in light of what you learn about patterns. Refactoring old code gives you a good opportunity to revisit past mistakes and learn the way to rectify them, an opportunity you don't get if you're always just writing new code.

You might also consider a mentorship of some sort, whether with an older and more experience co-worker or some other experienced acquaintance who can give you some advice and constructive criticism. Drawing on the experience of others is a fantastic way to learn.

Stretch, challenge yourself, read lots of code and write even more. That's the only way you'll grow.

#3 game of thought   Members   -  Reputation: 213

Like
1Likes
Like

Posted 19 September 2012 - 10:24 AM

thank you

#4 jwezorek   Crossbones+   -  Reputation: 2072

Like
4Likes
Like

Posted 19 September 2012 - 11:55 AM

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 cut-and-paste someone's code from the internet.

Edited by jwezorek, 19 September 2012 - 11:57 AM.


#5 MrDaaark   Members   -  Reputation: 3555

Like
3Likes
Like

Posted 19 September 2012 - 01:12 PM

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.

#6 Servant of the Lord   Crossbones+   -  Reputation: 22783

Like
8Likes
Like

Posted 19 September 2012 - 01:37 PM

The best book I've ever written that has taken me from messy code to clean code, is "Code Complete (2nd Edition)"
Secondarily, "The Pragmatic Programmer" is also nice and helped some, but Code Complete is even better.

You don't need to unlearn the language, you just learn a new style of writing it.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#7 superman3275   Crossbones+   -  Reputation: 2061

Like
0Likes
Like

Posted 19 September 2012 - 02:08 PM

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.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#8 alnite   Crossbones+   -  Reputation: 2327

Like
6Likes
Like

Posted 19 September 2012 - 04:05 PM

You want to step away from tutorials at this point. You need reasons why writing clean code is better than messy code. At this point, your brain can't tell the difference, and likely won't make a change unless you are running into situations where clean code is preferable than messy code.

1. Read your own code from a few months back. If you can still read it and understand it, you are in the right direction.
2. Work on a small app or game, and try to make it bug free. It's the hardest thing, and that's where your messy code will hurt you the most.
3. Then try reuse that code you wrote. Are they reusable? Is it easy to reuse them, do you have to strip off a lot of dependencies for using just one small chunk?

Repeat this process infinitely, your code will get cleaner and better, and less buggy.

Edited by alnite, 19 September 2012 - 04:06 PM.


#9 kazisami   Members   -  Reputation: 558

Like
0Likes
Like

Posted 20 September 2012 - 01:56 AM

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 Effective C++. Hope that makes your messy programs go away :D

To follow the path:

look to the master,

follow the master,

walk with the master,

see through the master,

become the master.

http://kazisami.wordpress.com/


#10 NightCreature83   Crossbones+   -  Reputation: 3303

Like
0Likes
Like

Posted 20 September 2012 - 05:52 AM

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 Effective C++. Hope that makes your messy programs go away Posted Image

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.
Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#11 kazisami   Members   -  Reputation: 558

Like
0Likes
Like

Posted 20 September 2012 - 08:37 AM

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.


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.

To follow the path:

look to the master,

follow the master,

walk with the master,

see through the master,

become the master.

http://kazisami.wordpress.com/


#12 zalzane   Members   -  Reputation: 191

Like
0Likes
Like

Posted 20 September 2012 - 11:29 AM

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





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS