View unanswered posts | View active topics It is currently Mon Feb 06, 2012 10:15 pm



This section is under re-development. It is not finished, and not fully functional. The current development stage is pre-alpha and as such, not every feature is even implemented yet.




Options



rss Planet-Black0ps
rss Diagmato
rss From Wordpress



Users



Total entries:
Total comments:

The Newbie Code Obsession

Diagmato, From Wordpress
Tue May 11, 2010 2:03 pm

Some of you are going to know what this is about just by the title, and can probably relate to it. Others will hopefully learn something from it, and relax a bit. The situation is best described with an example conversation that happened recently:


Him: “Can you please find what’s wrong with this code?”


Me: “Hmm, sure, send it to me”


Him: “Ok, but before I do, you have to PROMISE, on your life, you won’t use it or share it to anyone else. It took me ages.”


Me: “…I won’t. ”


Him: “Good :) . If I see any file handling on your site than I know you have lol”


Me: “…Except for the, you know, fact that it handles image uploads, maps, and whatnot already? Don’t accuse me of ripping off your code when i’m just trying to help.”


He saw sense in the end, but it’s not the first time that’s happened.


The problem is that some people get so attached to their ‘hard’ effort, that they think the world is about to try and take it from them, even for the most basic of tasks.


So, if this sounds like you (the one paranoid that your code is so amazing, that it will somehow appear across the world whenever someone needs that functionality), then you really need to think about this:



  • What makes your code so special? Why is it no one else in the world can do the same function, or even better?

  • If someone does see your code, why do you think they will rip it off and use it as their own?


Part of being a programmer is that you find solutions to a problem. That should also be a fun task – one that gives you some sort of satisfaction for completing it, much like a difficult puzzle. You certainly don’t get that when dragging in someone elses code, and you certainly won’t learn much from it either. On top of that, if there are any bugs with the code, the basic programmer will struggle to find it, the expert programmer will probably end up re-writing most of it anyway. Suddenly then, it’s no longer your code. In this circumstance however, an expert programmer just won’t take your code because he/she can easily do it anyway. In fact, if someone was going to “steal ideas from your site”, then they would code their own version, rather than hope they can get your exact code, and implement it.


In the example above, the function was one which looped over the contents of a directory, and unlink()’ed all the files, THEN deleted the directory itself. The bug was that, if there was a subdirectory, it wouldn’t delete the directory itself because it still had contents, and unlink() doesn’t remove directories (rmdir() doesn’t delete a directory that has anything still inside it either). The fact of the matter is, it wasn’t exactly some incredible solution to the world’s problems, and any site that handles files in pretty much any way is likely to do something similar.


The other point I want to make is, don’t take someone elses code and try to pass it on as yours. Especially if you are then going to ask someone to help you fix it. The moment they ask you a question about it, and you can’t answer it, it becomes obvious. Someone sent me a function that actually had me going for a bit – it was a cleverly done MySQL query using all sorts of degtorad() and distance calculations, for a google map, to work out how far one destination was from another. As soon as I tested him by asking why he was converting to radians, he got completely stuck and thankfully owned up.


Finally, if this has sucked the life out of your hard work, then don’t let it. The idea is, you learn from your mistakes. There is no shame in asking for help, just, in trying to pretend you did it all.  You are going to run into situations where, something you are excited about coding isn’t going to impress anyone – either that have already done it, or something similar, or something far harder. Difficulty is relative – you will get satisfied in this case, but don’t be alarmed when others don’t share that excitement, and certainly don’t keep going on about it “in case no one could hear you”, because they did – just, it wasn’t actually impressive to them.



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.