Thread: Coding Tips

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh

    Coding Tips

    Hey guys,
    I see a few of coders here have learn't a some what sloppy way of coding, Apoc91 made a post about this, and I have to agree with him, I don't code in C++ like most of you guys but I want to offer just a couple of small tips in general programming which has made my life easier and hopefully should make it easier for you guys..

    Tips

    * Name your Variables or Constants with a meaning
    For example we want a integer variable, I always name it with a "i" to indicate that this variable is an integer.. example iLoop then when used in code I can see thats its a type interger, Same goes for a Dword , example dwAddress, or a boolean bOnOff, or even a string sMyString... but also remember to name it with some meaning even after you have the first letter(s) indicating what type it is.

    * Name your controls with a meaning also, instead of Button1, use something like btnSendData, which you now can clearly see its a button(btn) and it sends data..


    * If you use a block of code more than twice turn it into a Function or Procedure.. This will make your over all code smaller and you can use that function/procedure in your next project

    * Think about faster methods that would produce the same thing..
    A good example and what I have seen a lot is If.. Then...Else repeated over and over again, When a Simple Case statement(Switch in C++) would be alot more faster and easier to read..

    * Take the extra time to add comments in your code, because it will help you with two things... first it will help you understand it and second if you have not worked on that project for awhile it will bring you upto speed on how you where thinking at the time you originally wrote it... Also a 3rd would be if you needed someone to check your code they wont have to spend all day trying to work out whats going.. So yes comments are a good thing to use

    * Name your project files with a meaning, file1.cpp means nothing to you or anyone else but Injection.cpp would mean something and could be used later on in another project.

    * Don't be scared to use multiple .cpp files (.pas files in delphi) because if you can split your functions up they might come in handy in another project and saves you time rewriting the whole function/procedure again

    * Try and keep your project folder organized

    * If you have a snippet in a project that you are not using anymore, save it to text file or database(lots of snippets database programs around) so you might be able to use it later without having go through the whole process of coding out again.

    * If you ripp code from other projects(I seen a lot have) please try and understand the code and whats happening before you paste it into your own, this will save you the embarrassment when you come back to forum asking why your code is not working.

    * Dont be ashamed if you don't know something, Belive it or not you probably know something else that one of "pro" coders doesn't know. There is no such coder any where that knows everything, So do not be shy to ask how and why(don't ask give me this give me that)..

    * Come to reality and realize you wont learn to code over night, But saying that don't listen to idiots that say "Go and Learn C++" because its obvious they have no idea them selfs... just take your time and practice and you will be doing more and more advanced coding without you even realizing it.

    * Last and final tip... Have fun while coding, its pointless to code if your not enjoying it, Think out side the box because coding hack for CA doesn't make you awsome........


    //Edit
    I just found this link to CPP style standards, I suggest reading this if you code in C++
    https://geosoft.no/development/cppstyle.html

    Also if you have any other useful tips of your own you would like to share, then post them up so others can benefit from your knowledge.
    Last edited by Departure; 12-02-2010 at 02:43 AM.

  2. The Following 9 Users Say Thank You to Departure For This Useful Post:

    ac1d_buRn (12-02-2010),Apoc91 (12-02-2010),freedompeace (12-02-2010),NOOB (12-02-2010),Nubzgetkillz (12-02-2010),UGodly (12-02-2010),whit (12-02-2010),why06 (12-02-2010),_Fk127_ (12-02-2010)

  3. #2
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Love you! Repped, and...

    And, "try and keep your project folder organized".. I try but stop trying almost instantly. xD

  4. #3
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh
    lol yeah its one of things.. we all know we should keep it organized but most of the time we don't (well for me anyway).

  5. #4
    Apoc91's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    59
    Reputation
    10
    Thanks
    35
    My Mood
    Twisted
    Just a quick tip, you could also mention that the notation you're using where you prefix names with a letter based on their datatype (e.g. szString, bOnOff, etc) is called Hungarian Notation.

    Hungarian notation - Wikipedia, the free encyclopedia

    Aside from that, thanked and repped! Great work =)

  6. #5
    DoubleDutch's Avatar
    Join Date
    Sep 2007
    Gender
    male
    Location
    Koning
    Posts
    11,346
    Reputation
    1179
    Thanks
    1,199
    My Mood
    Bored
    That's not really organised.

  7. #6
    Apoc91's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    59
    Reputation
    10
    Thanks
    35
    My Mood
    Twisted
    Quote Originally Posted by DoubleDutch View Post
    That's not really organised.
    What's not organized =/ He just gave tips on what to do when you program.

  8. #7
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    GOod job I agree also. THANKed/REPPED

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  9. #8
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,404
    Reputation
    157
    Thanks
    4,003
    My Mood
    Flirty
    Very good thread
    Everybody should read this. Will help out alot of new coders on the forum.

  10. #9
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by ac1d_buRn View Post
    Very good thread
    Everybody should read this. Will help out alot of new coders on the forum.
    This helped me. Since I started coding like 2 months ago and I am still in the beginning stages of learning. So I hope alot of the people that want to learn look at this thread also.

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  11. #10
    siwy11011's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    67
    Reputation
    10
    Thanks
    6
    My Mood
    Tired
    Well i like it

  12. #11
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Very Very Nice...
    And you got it right theres an ego in the section where if people can semi code / leech a Combat Arms hack they Pro as shit, and i think thats bullshit

  13. #12
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by whit View Post
    Very Very Nice...
    And you got it right theres an ego in the section where if people can semi code / leech a Combat Arms hack they Pro as shit, and i think thats bullshit
    True that, I am pro as shit( JK )

    hehe

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  14. #13
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by Nubzgetkillz View Post
    True that, I am pro as shit( JK )

    hehe
    Shut up whitey..

  15. #14
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by whit View Post


    Shut up whitey..
    Shut up you little ******
    /

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  16. #15
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    720
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy
    Finally, a smart member who DOES NOT pretend to be "The Shit." We need more people in this section like you. Thanks, +rep.
    note- OMFG SOMEONE ACTUALLY KNOWS C++ HOLAY SHIIT

Page 1 of 2 12 LastLast