Basic info on code

Discussion in 'General Discussion' started by Monkeyking1776, Aug 1, 2015.

  1. Hi everyone,
    This is my first thread and I want info on how to write basic code. I am starting to get into computers, although I have basic computer skills I want to learn more. This thread code be used as a way for people to show and share coding ideas and basic tips and tricks.

    Thank You
    • Like Like x 1
  2. JohnnyRUClear Member

    It's been a long time since I wrote any computer programming, but... wouldn't it be helpful to specify a particular programming language for this thread?
    • Like Like x 1
  3. anon8109 Member

    If you want to become a professional programmer, get professional training.

    If you just want to code as a hobby, there are plenty of websites that will help you learn. Google is your friend.
    • Like Like x 2
  4. John Duff Member

    How to become a master programmer in 2 steps :
    • Learn. You can figure things out by yourself or search on the internet. What's important is that you don't get stuck in what you already know. Ask questions ("what if I did this instead of that ? would it improve my code ?"), learn about some dev practices, new languages, new ways of achieving whatever you want to do etc. Keep an open mind, things change a lot. What you consider today as a genius idea could be replaced tomorrow by something more genius (for example I used to love XML, then I learned about JSON).
    • Practice. You can know everything in the world, it will be useless until you put it into practice. Just open your text editor and code something. For example you can code a little function that will output "hello, world", code your personnal website from scratch (no framework), create an addon or plugin for something that already exists, code a Tetris etc.
    These two steps are mandatory and never ending. You can't become good without one of them.

    In practice :
    1. Get an idea of something you want to code. It can be an over-simplistic project or a beast that will take you several years to complete. What is important is that you like the project. Of course, you can run several projects at the same time.
    2. Code it.
    3. You're stuck. Internet is your best friend (google search, stackoverflow etc). You can even discover things by yourself by testing ideas (even if you think your ideas are bad, it's always good to know if they work or not and why). You have a problem ? Dox it. Find out what is this problem, why it happens, how to get rid of it, who are his family members, where does he live etc.
    4. Ok, you're not stuck anymore. Feeling lost with your new knowledge ? That's normal. Go back to 2 and code it ; with practice (and maybe more lurk), you will understand it.
    5. When finished, take a look at your code. Find out what is bad in your code (there is always something to improve, if you don't see it, you need more knowledge). An over complicated function, weird algorithm logic, non user friendly syntax, a paradigm that you didn't understand at 100% etc. Try to improve on these weaknesses. Go back to 1 for another project or improve your current project.
    Note : it's ok to start over (even many times) if you feel that your projects needs it. Usually, the project becomes better and you will face new challenges that will help to improve your programming skills.

    Time division :
    • 1/3 of the time spent coding is not productive
    • 1/3 of the time spent coding is counter productive
    • 1/3 of the time spent coding is useful and compensates for the other 2/3.
    It's ok to get stuck, it's ok to read doc about something that has no link with what you are coding. It's ok to test new stuff and crash your entire project.
    It's great to get stuck on something during a week and finally find out a way to solve the problem (and you may feel a little frustrated too if the solution is simple, like it usually is).

    About saving your data :

    ALWAYS save. Use svn, git or copy-paste to manage the different versions of your projects even if you work alone.
    You should always be able to find "that useful little piece of code you removed from your project 2 months ago" when you need it.
    It is also fun to look at your old code to look at what horrible and complicated things you used to produce. And maybe make an improved v2 of them.

    When coding :

    Make it work.
    If you can, make it as simple and clear as possible.
    Don't hesitate to make mistakes. You probably already made some of them but didn't notice. You'll correct them soon or later.

    PS : I've seen many developpers in my life. In most cases, the best of them were the ones that practiced a lot. I've seen crap comming from guys who had studied for 5 years in famous schools and wonders comming from guys that didn't have any diplomas but just liked to code.
    • Like Like x 1
  5. Thanks for
    thank you for the advise where should I start looking(websites,books,etc) i know Google is a great way to start but do you suggest any in particular?
  6. A.O.T.F Member

    • Like Like x 1
  7. John Duff Member

    • Like Like x 1
  8. Thank You, it's a great start
    • Like Like x 1
  9. DeathHamster Member

    Keep in mind that half the answers on that site are grossly or subtly wrong. You can't just copy and paste code without knowing enough about the problem to see what's wrong, what was left out, or what has changed since that answer was posted.

    Half the time it's great, and other half it's a dangerous time sinkhole.
    • Like Like x 2
  10. John Duff Member

    I just realized that i forgot the most important thing : use your brain.

    The most efficient method I've found so far to make sure you're using your brain is that when you write code (or copy paste), you always have to understand what the code does. This will reduce the number of mistakes in the code.
    Even better : do not copy/paste code from somwhere, always rewrite it yourself (with your own coding norm and your own style), most of the time you will end up with something similar to what you wanted to copy/paste, but sometimes, you'll end up with something better (and this is good).

    If you do this, 99% of the errors you get will be careless mistakes (forgot a ";" or a space somwhere etc).
    These car usually be debugged with ease.

Share This Page

Customize Theme Colors


Choose a color via Color picker or click the predefined style names!

Primary Color :

Secondary Color :
Predefined Skins