At what point does changing a code make it mine

And there is an easy way to defend your scripts if you consider them “yours”, and I always respect them by leaving the information intact. Here’s an example of a header in a script by JJ Sancho:

property |version| : 1.0
property author : "Pescados Software · [url=http://homepage.mac.com/julifos/soft]http://homepage.mac.com/julifos/soft"[/url]
property |date| : date "Sunday, March 21, 2004 5:46:58 PM"
property license : "freeware, open-source"

-- the script follows.

If you don’t do something like that, copiers will be impolite, but they are not heinous poachers of scripts they find in an uncopyrighted tutorial or forum in my view. I try to be polite.

Like the quote.

Excellent idea.

Mind if I copy it? :wink:

Given that JJ’s method is certainly not unique (I’ve seen it used by lots of other scripters in one form or another), I think you’re free to use the format as you like. When I’m using a piece of code or a handler that I’ve taken from a forum, I sometimes add something like the following if I haven’t already got a comment to that effect:

property Original_Author : John Doe
property Found_at: MacScripter.net.

well this is entertaining topic, talk about rolling on the ground laughing, after reading those ‘hypothetical examples’ - :slight_smile:

but on a serious note, it is like a child learning to read for the first time, they pick up their own methods of learning, though practice, recognizing word and sentence structures, etc., and with us, learning to write code is no different, we all have to start somewhere…

i think if we are honest about it, we all copied somebody’s code in our ‘early days’ and made it work for ourselves, until we became more proficient at it, and could design and write ‘off the top of our heads’ what we needed - it is a form of evolution e.g. from ‘copy-write infringer’ to ‘author’

nobody owns the alphabet (although companies that produce ‘fonts’ may think differently), and so my intellect tells me, i can arrange the letters in any order i like, and it is my work, my copy-write material by default (big deal), we all know of one big software company that claims, it owns the code that some have written, and they even go to the extremes of having patents on ‘the concept of the code’, even though they have no idea as to how they will implement it, let alone figure out how to write it, i think the only thing they are good at is writing bugs in their code, but then again, this could be their trademark :slight_smile:

to hell with the lawyers, and this whole ‘intellectual property’ ownership thing, it is a death spiral of greed, political correctness gone mad, by contrast, look at the open source community, they all work together to benefit the computer users, the operating systems, the software developers never fight over infantile things like ‘thats mine’ (e.g. some-bodies code), no, they share ideas, code, even ‘the shirts off their backs’ if need be… all in the name of advancing technology, unselfishly striving for perfection and the greater good of all

so lets get to the root of the matter… if you ‘used’ some-bodies code, and you have a conscience, and you plan to make money from your endeavor, do the honest thing, and ask for their permission to use it, make an arrangement that suits both parties, including financial reward etc, and you will sleep well at night, knowing you did the right thing

but if they are totally unreasonable or want some exorbitant amount of money for such a small amount of code, use your head and think how you can write your own code to obtain the desired solution/results… hint: renaming variables is a good start, just like the alphabet, nobody has a patent on ‘variable names’

Model: G5 1.8GHz Dual (4 years old now, time for a intel soon)
Browser: Safari 523.12.2
Operating System: Mac OS X (10.5)

Excellent Posts! Thanks to everyone for joining in.

The line is still fuzzy for me about how much change must be made before someone else cannot claim it as their code.
Example:
I wanted to make a handler that is recursive. So I found this example in the Applescript Definitive Guide:


on remvix(ix, ls)
	if ls is {} then
		return {}
	else if ix is 1 then
		return rest of ls
	else
		return {item 1 of ls} & remvix(ix - 1, rest of ls)
	end if
end remvix
remvix(2, {"Mannie", "Moe", "Jack"})

It showed me the concept, but I needed to tweak it to recurse through children:

on remvix(ls)
	if ls is {} then
		return {}
	else
		return {item 1 of ls} & remvix(checkForChildren(item 1 of ls) & rest of ls)
	end if
end remvix

on checkForChildren(parent)
	if parent is "Moe" then
		return {"Lisa", "June"}
	else if parent is "Lisa" then
		return {"Snarpy", "Snappy"}
	else
		return {}
	end if
end checkForChildren

remvix({"Mannie", "Moe", "Jack", "Stephen", "Ken"})

Next, I wanted to use the same idea for search and replace a string:


on cleanString(dirtyString, searchString, replaceString)
	if dirtyString is "" then
		return ""
	else
		set iReturn to 1
		set addReplaceString to ""
		local myI
		set myI to character 1 of dirtyString
		
		if character 1 of dirtyString is equal to character 1 of searchString then
			repeat with i from 1 to length of searchString
				if character i of dirtyString is not equal to character i of searchString then
					exit repeat
				end if
			end repeat
			if i is equal to length of searchString then
				set iReturn to i + 1
				set addReplaceString to replaceString
			end if
		end if
		
		set returnString to addReplaceString
		if iReturn is not greater than length of dirtyString then
			set returnString to returnString & character iReturn of dirtyString
		end if
		
		if length of dirtyString is 1 then
			return returnString
		else
			set iReturn to iReturn + 1
		end if
		
		return (returnString) & cleanString(text (iReturn) thru (length of dirtyString) of dirtyString, searchString, replaceString)
	end if
end cleanString

cleanString("my dirty string", "y", "
")

I was able to write this code because I learned how to do it from the books example. Does credit need to be given to the book’s author for this code?

We all learn from someone or something. The books author didn’t give credit to his teacher for how he learned about recursion.


I’m now using different variances of the code above, I tapped into using offset with recursion to cut back on the number of times the code calls itself.

You could have learned about recursion in any number of places, and you’ve certainly modified and extended the concept as you found it. In my view, the scripts you’re using are yours.

Based on the code you’re showing, I’d say that you learned the form of a recursive function (or handler) and have now made it your own.

Learning a concept from a teacher or textbook is different from copying proprietary code (at least in my book).

Look at it in terms of a term paper (or thesis): If you are copying words verbatim from some other source, you’re plagiarizing. If you are restating facts that you learned from a source (or several sources) in your own words, you’re writing your own paper.

In programming, we often copy the form of a bare-bones handler or function and then adapt it to our own use. Recursion is an accepted standard way of doing some kinds of things in coding, so it doesn’t “belong” to anyone.

A recursive function that was written by someone to perform a specific function (like your final handler above) DOES belong to you, and if someone copied it verbatim (or with only minor changes) they would be “lifting it” from you. Whether you consider it “stealing” is your call.

As Kevin says, it’s your call – you hardly ever see anyone on this forum complain that some bit of the code shown in a new post is theirs. I remember posting something that used a handler by Kai Edwards (though I didn’t remember that because I’d changed it quite a bit) — his response: “Hey Adam, that looks familiar :lol:” to which I replied “Oops – I couldn’t remember where I saw that.”