Remove unused & obsolete methods of the "View" class

Bug #1605419 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Aaron Wells

Bug Description

The method View::find_artefact_children() was added in 2007, and was only ever used in the method View::get_artefact_hierarchy(). The function View::get_artefact_hierarchy() was then removed later in 2007 due to errors, but View::find_artefact_children() was left behind by apparent oversight.

In its current form it's not very useful, and it's more or less redundant with artefact_get_descendants() in artefact/lib.php.

Likewise there are several other "orphan" methods in the View class, which it would be good to remove because:

1. The class is already huge, and removing unnecessary methods will make it easier for developers to find the useful methods in it.

2. These unused methods often contain bugs, because they're not updated when Mahara's internal data structures change.

I'm going to remove several of these unused methods, and refactor away a few single-use methods that don't provide any real API value.

Tags: refactoring
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/6742

Aaron Wells (u-aaronw)
summary: - Remove unused, obsolete method View::find_artefact_children()
+ Remove unused & obsolete methods of the "View" class
description: updated
tags: added: refactoring
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6742
Committed: https://git.mahara.org/mahara/mahara/commit/8f2d8b18863d6c446b7c914db2e9651c1ae2f3b5
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 8f2d8b18863d6c446b7c914db2e9651c1ae2f3b5
Author: Aaron Wells <email address hidden>
Date: Fri Jul 22 12:04:03 2016 +1200

Bug 1605419: Refactoring out old, unused methods of View class

Leaving in View::get_artefact_instances() because there are
plans to use it in the SmartEvidence commits.

Change-Id: I04371779ba358678ae5b36b286356e2fd990dfff
behatnotneeded: Covered by existing tests.

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.