This forum is in archive mode. You will not be able to post new content.

Author Topic: How to improve your programming skills  (Read 4387 times)

0 Members and 1 Guest are viewing this topic.

Offline m0l0ko

  • Peasant
  • *
  • Posts: 129
  • Cookies: -4
    • View Profile
How to improve your programming skills
« on: February 03, 2013, 10:23:13 PM »
I learned PHP mainly through trial and error, by starting a big project then learning the things I need for the project as I went along. Well, at the very beginning I read a book so I could understand the basic programming concepts but since then its been all active trial and error learning. My skills have vastly improved but I notice that when I build a big project, my code gets really sloppy and confusing. What happens is I'll come across something that I need to do so I come up with a way to do it with my current knowledge and end up doing it but I'm often doing it in a completely roundabout and inefficient way due to my lack of knowledge. Often when I learn a new thing later down the line, I realise that I could have accomplished the same thing with a fraction of the code, and in a fraction of the time it took me to do it before I learned this new thing.

I'm sure all programmers encounter this problem, what do you do, do you just get a good book and read it from the start, do you download ready made scripts and back engineer them or what?

Offline Zesh

  • Royal Highness
  • ****
  • Posts: 699
  • Cookies: 42
    • View Profile
Re: How to improve your programming skills
« Reply #1 on: February 03, 2013, 10:49:17 PM »
Practice makes perfect. I started off by ripping apart a game engine that I was using to make a game and on top of that was Google for answers and tutorials to help me along.

I've been working on my game for 4, almost 5 years now. My game project has been with me throughout my game development and programming journey and many times I have looked back at old code and completely re-done the code because as time went by, I naturally got better at programming and old code doesn't look good at all :P

If you're working on a big project and your code is getting sloppy then what you need to do is, is to step back and plan! I never liked planning myself but I got used to it because, trust me, big projects need some planning behind them. A plan can help you keep "on track" and when you're planning I suggest you jot down some pseudo code and define how your project's code structure will look like so when you get to programming you can use that as a reference to help you from getting confused or "off track".

Hope that answers your question :D

Offline Uriah

  • Sir
  • ***
  • Posts: 454
  • Cookies: 42
  • άξονας
    • View Profile
Re: How to improve your programming skills
« Reply #2 on: February 03, 2013, 11:44:04 PM »
Yeah the best way to learn is definitely just throwing yourself into a project. By the time it's finished, you'll be a much better coder.
Personally, I like doing this, and just referring to written tutorials or language documentation wherever I get stuck. I also do what Zesh does, writing pseudo code before actually writing the program. It allows me to plan everything out better.
And yeah, I run into that problem of previous bad code tons. It really sucks when you working on a big project, because it gets really tedious to have to keep going back and fixing things. However, you can also look at is as an obvious sign that your improving.
One REALLY important thing is that you don't just keep looking up things about code without actually trying it yourself. Thats why projects are so important. If your not writing the code your "learning" about, your likely to forget it very soon, or be very bad at writing it yourself when the time comes. Its better to search for things on google when you get stuck, and repeat the code so often that you memorize how it works.

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: How to improve your programming skills
« Reply #3 on: February 04, 2013, 04:38:27 AM »
Im not that good a coder but what works for me is to build a skeleton first.
Like creating a blue print for a building.

I can also say ive learnt the most by just throwing myself in head first.
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: How to improve your programming skills
« Reply #4 on: February 04, 2013, 01:44:11 PM »
In addition to the things said (throw yourself into a project), it helped me a great deal to learn the concepts. I.e. read yourself into design patterns. Patterns are solutions for problems that occur very often. Get at least an overview so you are able to recognize that you need this pattern and look it up.

For big projects learn how to use your IDE, i.e. shortcuts to find code pieces that you are looking for or automated refactoring that the IDE can do for you.

Refactor your code once you know that your task can be accomplished better. The most important thing for big projects is a good structure/architecture. Prefer simple and easily understandable solutions instead of the complicated and maybe more efficient solutions. Only do something about perfomance when there is a need for it.

In addition to the design patterns learn to recognize code smells (=bad code). Try to understand why these are smells and learn how to remove/avoid them.

Learn how to use libraries that help you with managing big projects. I.e. logging, unit-tests.
Don't underestimate unit tests. They can help you to avoid a lot of bug searching.
« Last Edit: February 04, 2013, 01:44:53 PM by Deque »

Offline wookie

  • Peasant
  • *
  • Posts: 68
  • Cookies: -4
    • View Profile
Re: How to improve your programming skills
« Reply #5 on: March 05, 2013, 11:04:03 PM »
Personally I would recommend looking into object orientated PHP.  I find that it subconsciously encourages me to be neater with my code and stop repeating the same code.

[size=78%]If you have a script that does a few things over and over, try adding something like[/size]


Code: [Select]
<?php


class myobject {


function 
printServerInfo($args){
print(
"<pre>");
print_r($_SERVER);
print(
"</pre>");
}


}


$obj = new myobject();


$obj->printServerInfo();


?>

[size=78%] [/size]

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.