The following Java source is the complete code of a small library system. String and LocalDate are library types.
public class Library { private Book[] catalogue; private Member[] members; } public class Book { private String isbn; private Loan currentLoan; } public class Member { private String name; private Loan[] loans; } public class StudentMember extends Member { private String studentId; } public class Loan { private Book book; private Member borrower; private LocalDate due; } public class Notifier { public void remind(Member member, Loan loan) { /* sends an email */ } }
Recover a class diagram using these rules: a field whose type is a project class gives an association; two fields in different classes that refer to each other form one bidirectional association; a project type used only as a method parameter gives a dependency. The fan-in of a class is the number of other project classes whose source names it. Give each answer as a whole number:
Unlock full course notes by signing up
True statements about reverse engineering
A team is reverse engineering an undocumented scheduling module to produce a class diagram. Which of the following statements about this work are true? Select all that apply.
Recovering upload termination behavior
You are reverse engineering an undocumented upload routine to describe its externally visible behavior. The Python implementation below returns a status and the number of send attempts. Each reply corresponds to one attempt. Every supplied list contains at least three replies, and slicing with replies[:3] selects only its first three entries.
Complete the recovered behavior table. Enter each status exactly as returned by the code and each attempt count as an exact integer. Each row is a separate run starting with sends equal to zero.
Justifying a recovered multiplicity
While reverse engineering a billing system, you find that the class below is the only code that creates or modifies Invoice objects; assume nothing creates them by other means such as reflection or deserialization. Customer has no field referring to Invoice.
What multiplicity should the recovered class diagram show at the Customer end of the association between Invoice and Customer?
Recovering nested notification behavior
You are reverse engineering an event dispatcher whose subscriber list can change during a notification. The complete Python script is shown below. There are no other subscribers, exceptions, threads, or calls.
Each publish call invokes its subscribers in list order. The expression list(subscribers) creates a separate copy when that invocation enters its loop. Later additions to subscribers do not alter an existing copy. Calls execute synchronously: a caller waits for each called function to return.
Determine three exact integer counts: the total number of callback invocations across capture, audit, and metrics; the number of audit invocations; and the maximum number of simultaneously active publish invocations. A publish invocation remains active from entry until return, including while it waits for a nested call.