Originally Posted by
Rukentuts
Say you have to write code for like...a bubble sort. Just DL it from someone else. No reason to write something that is already correct and functioning fine.
It's not as if bubble sort is hard! (Taken from my own Java program, that I needed to make for Uni)
Code:
//sort the array using the bubblesort algorithm
//whenever a swap appears, update the bar chart using the drawChart method
for (int j=0; j < index-1; j++) {//checks the value at index 0 + index 1
//^if it's not larger, move to the next index values (and repeat).
for (int k=0; k < index-1; k++) { //k is 0, but while it's less than 1 keep adding 1 to k
//if k is greater than the number in the next array's index value, then move k up one slot
if (intArray[k] > intArray[k+1]) {
temp = intArray[k]; //temp = whatever value is in the array at (variable called 'k')
intArray[k] = intArray[k+1]; //the value of k is now +1 of k
intArray[k+1] = temp; //k+1 is now equal to the temporary figure
myChart.drawChart(intArray,index); //Redraw the graph, in the new arrangement
System.out.println("Swap " + swapValue); //print how many swaps have happened
swapValue = swapValue+1; //Add 1 to swapvalue for each time it loops around
UserInput.readString(); //Slow process down by requiring the user to hit 'Enter' key.
}
}
}
But basically, someone would then copy my code after me posting it, then using it for their own needs.
(If you couldn't tell, that was from a program where you had to enter a bunch of random integers, then it sorts the data from smallest to largest... That's 'just' the sorting part, which is the hardest part.)
I wouldn't mind if anyone uses the code for a private program, though if it was for their own school work or something, they could at least attempt it, or try to understand how to make one said bubble sort before hijacking it :P . Although, I've left all the comments in, so that you could fairly easily understand what's going on, if you needed to edit some part... Or something.
Basically though, re-using code is fine (you can't change the coding too much, otherwise it becomes a pile of junk), but people are just getting upset because they aren't given credit for their work, which can be googled within 5mins after it has been posted somewhere. I mean, it took me 30 minutes to write the entire program that was for my 5th assignment (1 part of 4 pieces in the individual assignment) for Uni (part of that is above). I realize that while I'm not the best person out there, I destroyed the time to do it in, compared to my fellow students... They spent a couple of hours on it and still couldn't figure it out properly (none of us had really done programming before, so I forgave them) and helped them out a bit, but I didn't exactly hand them the answers.
You definitely need a mix of not re-inventing the wheel, and knowing what the code actually says, and how it works in depth after obtaining it.