1. Homepage
  2. Programming
  3. 420371 - Programming with Java EE Assignment A: Source Code Analysis

420371 - Programming with Java EE Assignment A: Source Code Analysis

Engage in a Conversation
420371 - Programming with Java EEJavaSource Code Analysis

Academic Year 2023-2024 Semester 1 / 420371 - Programming with Java EE / Assignment A CourseNana.COM

Academic Year 2023-2024 Semester 1 420371 - Programming with Java EE CourseNana.COM

Assignment A CourseNana.COM

When we are analyzing the source code of a Java project for certain purposes (e.g. locating the related scope of bugs), we commonly focus on the following two issues: CourseNana.COM

  1. a)  The invocation relationships among methods. For example, given a method, which method(s) invokes it, and which method(s) is invoked by it? CourseNana.COM

  2. b)  The original source of method parameters. For instance, given the sayHello method in the class below, its parameter name may be directly assigned by a literal in the main method when it invokes sayHello (i.e. "Jon"); and it may also be indirectly assigned in the introduction method, while this further contains two sub cases: (1) assigned by name2 (i.e. "Garfield") within the introduction method; and (2) indirectly assigned by name3 (i.e. "Odie") in the main method. CourseNana.COM

package main;
class Test {
     void sayHello(String name) {

System.out.println("Hello, " + name + "!"); } CourseNana.COM

     void introduction(String name1) {
          sayHello(name1);
          String name2 = "Garfield";
          sayHello(name2);
     }

public static void main(String[] args) { sayHello("Jon"); CourseNana.COM

          String name3 = "Odie";
          introduction(name3);
     }

} CourseNana.COM

General Requirements CourseNana.COM

Each team of candidates is required to design and implement a Java program for analyzing and displaying the above method invocation information in a specified Java project. All functionalities should be implemented in Java. Please focus on the design of system architecture and components, the implementation of functionalities and features, and the efficiency of program, as well as the readability of source code. There is no specific requirement on the user interface, while a simple command-line based program is well accepted. CourseNana.COM

Important tip: AST (abstract syntax tree) is a tree-like representation of the source code structure, which could be useful in analyzing the relationships among source code elements. You may consider CourseNana.COM

Page 1 of 5 CourseNana.COM

Academic Year 2023-2024 Semester 1 / 420371 - Programming with Java EE / Assignment A CourseNana.COM

(but not necessarily) using the Java Parser library (please kindly refer to the reference for details). CourseNana.COM

The assessment will be based on both the presentation and submission. All teams will be randomly divided into three groups (namely Group A, Group B, and Group C), while each group is subject to different requirements as below: CourseNana.COM

Group CourseNana.COM

Group A Group B Group C CourseNana.COM

Functional Requirements CourseNana.COM

F0
F0 + F1 F0 + F2
CourseNana.COM

Submission Due CourseNana.COM

11.59pm, 25 October 2023 11.59pm, 1 November 2023 11.59pm, 8 November 2023 CourseNana.COM

Presentation Date CourseNana.COM

26 October 2023 2 November 2023 9 November 2023 CourseNana.COM

F0: Basic Functional Requirements (For All Groups) CourseNana.COM

Design and implement a Java program that analyzes the source code of a specified Java project, and prints out the method invocation relationships, with the following features: CourseNana.COM

a) The end-user can use the program to load a specific Java project and specify any method of any class within this project, and consequently, the program prints out its callers and callees. This service should be supported in an on-demand manner, which implies that given a specified Java project, the program should firstly scan and analyze all method invocation relationships, properly store necessary data and information, and then quickly respond to the end-user’s queries. A set of input and output samples is presented below. Please note that the samples are for illustrative purpose only, but not compulsory requirements. Concrete formats of input and output can be designed in any way as long as all information can be clearly understood. CourseNana.COM

Input: CourseNana.COM

introduction, main.Test, depth=2 ========
Output:
It is invoked by the following: CourseNana.COM

[main, main.Test (depth:1)] It invokes the following: CourseNana.COM

// Method name, class name, and depth of search CourseNana.COM

[sayHello, main.Test (depth:1)] CourseNana.COM

Input: CourseNana.COM

sayHello, main.Test, depth=2 ========
Output:
It is invoked by the following: CourseNana.COM

[introduction, main.Test (depth:1)] CourseNana.COM

[main, main.Test (depth:2)] It invokes the following: CourseNana.COM

[NONE] CourseNana.COM

b) The program can completely print out all possible original sources of every parameter in each method from all classes, into a plain text file. The following output serves as a sample, while you may design any output format as long as it can be easily understood. CourseNana.COM

Page 2 of 5 CourseNana.COM

Academic Year 2023-2024 Semester 1 / 420371 - Programming with Java EE / Assignment A CourseNana.COM

main.Test:
     sayHello(String name):

String name:
["Jon": Line 15 of Test.java]
[name2: Line 11 of Test.java <-- "Garfield": Line 10 of Test.java] [name1: Line 9 of Test.java <-- name1: Line 8 of Test.java
CourseNana.COM

<-- name3: Line 17 of Test.java <-- "Odie": Line 16 of Test.java] CourseNana.COM

F1: Extended Feature 1 (For Group B Only) CourseNana.COM

When parsing the source code, a source code block may not be successfully identified by the parsing facilities if there exist code elements that are not completed yet, such as the following example. Please improve your program and try to implement additional mechanism for identifying such source code block as much as possible. CourseNana.COM

public class IncompleteClass {
     private int a, b;
     public int getSum()
          this.a = 5;

// The left brace is missing CourseNana.COM

// Not finished yet
this.b = 10;
int result = this.a +

F2: Extended Feature 2 (For Group C Only) CourseNana.COM

In object-oriented programming, a method may override another method in the parent class. Under such scenario, the method invocation depends on the type of object at runtime. For example, given the following source code, when the a.speak() statement is executed, it actually invokes the speak method in the Dog class rather than that in the Animal class. Please consider and support such situation with additional mechanism. CourseNana.COM

class Animal {
void speak() { System.out.println("Animal speaks"); }
CourseNana.COM

} CourseNana.COM

class Dog extends Animal {
     @Override

void speak() { System.out.println("Dog barks"); } } CourseNana.COM

class Main {
     public void speak() {

Animal a = new Dog();
a.speak(); // It actually invokes the speak method of the Dog class
CourseNana.COM

Page 3 of 5 CourseNana.COM

Academic Year 2023-2024 Semester 1 / 420371 - Programming with Java EE / Assignment A CourseNana.COM

References CourseNana.COM

  1. Abstract Syntax Tree (AST): https://en.wikipedia.org/wiki/Abstract_syntax_tree CourseNana.COM

  2. Java Parser: https://javaparser.org CourseNana.COM

Submission CourseNana.COM

Each team is required to submit a package consisting of the following materials: CourseNana.COM

  1. a)  The complete set of source code; CourseNana.COM

  2. b)  One project report that covers the following contents in the given order: CourseNana.COM

    1. 1)  Full names and matriculation numbers of all team members, contact number, email address, and other particulars if any; CourseNana.COM

    2. 2)  The complete list of system functionalities and features implemented; CourseNana.COM

    3. 3)  A simple user manual (including UI samples and descriptions); CourseNana.COM

    4. 4)  System architecture and components, general workflow, major data structures, efficiency considerations, and key techniques; CourseNana.COM

    5. 5)  Other technical details and/or information, if any. CourseNana.COM

    Note: The report should be written in English; file format for submission: PDF. CourseNana.COM

  3. c)  The presentation slides, with the first slide presenting the full names and matriculation numbers of all team members. CourseNana.COM

    Note: The slides should be composed in English; file format for submission: PDF. CourseNana.COM

Please place the source code (a) and the documents (b and c) into different folders, compress them into one ZIP file, and submit it via Canvas. CourseNana.COM

Presentation CourseNana.COM

Each team is required to present the project within 20 minutes, followed by a Q&A session. The presentation should be delivered in English. Candidates are required to: CourseNana.COM

  1. a)  Explicitly demonstrate all implemented functionalities and features; CourseNana.COM

  2. b)  Present the design of system architecture and components, general workflow, major data structures, efficiency considerations, and key techniques, as well as other issues that are worth discussing; CourseNana.COM

  3. c)  Present the mechanisms, methods and skills of collaboration among team members; CourseNana.COM

  4. d)  Discuss important issues involved during the design and implementation, as well as the corresponding solutions. CourseNana.COM

Page 4 of 5 CourseNana.COM

CourseNana.COM

Academic Year 2023-2024 Semester 1 / 420371 - Programming with Java EE / Assignment A CourseNana.COM

Grading Criteria CourseNana.COM

Grading Criterion CourseNana.COM

Part A: Presentation CourseNana.COM

System functionalities and features 40% Technical design 30% Presentation quality 10% CourseNana.COM

Part B: Submission CourseNana.COM

Source code quality 10% Documentation quality 10% CourseNana.COM

THE END CourseNana.COM

Page 5 of CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
420371 - Programming with Java EE代写,Java代写,Source Code Analysis代写,420371 - Programming with Java EE代编,Java代编,Source Code Analysis代编,420371 - Programming with Java EE代考,Java代考,Source Code Analysis代考,420371 - Programming with Java EEhelp,Javahelp,Source Code Analysishelp,420371 - Programming with Java EE作业代写,Java作业代写,Source Code Analysis作业代写,420371 - Programming with Java EE编程代写,Java编程代写,Source Code Analysis编程代写,420371 - Programming with Java EEprogramming help,Javaprogramming help,Source Code Analysisprogramming help,420371 - Programming with Java EEassignment help,Javaassignment help,Source Code Analysisassignment help,420371 - Programming with Java EEsolution,Javasolution,Source Code Analysissolution,