Hi all again,
Over the past couple of weeks I’ve been attempting to delve into programming and applescript in particular for the first time in ten years. I’m attempting to create a script which will make it a hell of a lot easier for Scrum Masters to report to management in future regardless of the tools they use.
Part of this has led me from messy code to OOP. Well, I’m now confused. I just don’t know the detail of instantiating a sub-class from a parent. Do I do it from a method inside the parent? Do I treat them separately and create ID’s in both classes? I’ve no idea.
The information I’m attempting to manage all relate to a Project then a Sprint then a Feature. How can I relate them in such a way that I can say “get description of feature x of sprint y of project z” or equivalent? Or, even “get all features in sprint y”?
Code below…
set project to CM_Project()
set sprint to CM_Sprint()
set feature to CM_Feature()
project's set_project_name("The Brilliant Project")
project's set_project_start_date("15/09/2012")
project's set_project_end_date("15/09/2013")
project's set_project_sprint_length(3)
log project's get_project_name()
log project's get_project_calendar_days()
--=====
-- HANDLERS 
--=====
--PROJECT CLASS
on CM_Project()
	
	script CM_Project
		property projectName : missing value
		property startDate : missing value
		property endDate : missing value
		property calendarDays : missing value
		property workingDays : missing value
		property sprintLength : missing value
		property sprintTotal : missing value
		property sprintList : missing value
		property sprintCount : missing value
		
		
		on init()
			set projectName to ""
			set startDate to ""
			set endDate to ""
			set calendarDays to ""
			set workingDays to 0
			set sprintLength to 0
			set sprintTotal to 0
			set sprintList to {}
			set sprintCount to 0
			return me
		end init
		
		
		on set_project_name(PNValue)
			set projectName to PNValue
		end set_project_name
		
		on set_project_start_date(SDValue)
			set startDate to SDValue
		end set_project_start_date
		
		on set_project_end_date(EDValue)
			set endDate to EDValue
		end set_project_end_date
		
		on set_project_sprint_length(SLValue)
			set sprintLength to SLValue
		end set_project_sprint_length
		
		on get_project_name()
			return projectName
		end get_project_name
		
		on get_project_start_date()
			return startDate
		end get_project_start_date
		
		on get_project_end_date()
			return endDate
		end get_project_end_date
		
		on get_project_calendar_days()
			get_project_start_date()
			set calendarDays to ((date (get_project_start_date() as string)) - (date (get_project_end_date() as string))) div days
			return calendarDays
		end get_project_calendar_days
		
		on get_project_working_days()
			return workingDays
		end get_project_working_days
		
		on get_project_sprint_length()
			return sprintLength
		end get_project_sprint_length
		
		on get_project_sprint_total()
			set sprintTotal to (get_project_calendar_days / 7) / get_project_sprint_length
			return sprintTotal
		end get_project_sprint_total
		
		on create_new_sprint()
			set sprintCount to sprintCount + 1
			set end of sprintList to sprintCount
			
		end create_new_sprint
		
	end script
	return CM_Project's init()
	
end CM_Project
--SPRINT CLASS
on CM_Sprint()
	
	script CM_Sprint
		
		
		property parentProject : missing value
		property sprintNumber : missing value
		property startDate : missing value
		property endDate : missing value
		property NoOfTotalFeatures : missing value
		property NoOfTotalPoints : missing value
		property NoOfCompletedPoints : missing value
		property NoOfInProgressPoints : missing value
		property NoOfInBacklogPoints : missing value
		property NoOfCompletedFeatures : missing value
		property NoOfInProgressFeatures : missing value
		property NoOfInBacklogFeatures : missing value
		
		
		on init()
			
			set parentProject to ""
			set sprintNumber to 0
			set starDate to ""
			set endDate to ""
			set NoOfTotalFeatures to 0
			set NoOfTotalPoints to 0
			set NoOfCompletedPoints to 0
			set NoOfInProgressPoints to 0
			set NoOfInBacklogPoints to 0
			set NoOfInProgressFeatures to 0
			set NoOfInBacklogFeatures to 0
			return me
		end init
		
		
	end script
	
	return CM_Sprint's init()
	
end CM_Sprint
--FEATURE CLASS
on CM_Feature()
	
	script CM_Feature
		
		property parentSprint : missing value
		
		on init()
			return me
		end init
		
		
	end script
	
	return CM_Feature's init()
	
end CM_Feature
