Skip to content
Snippets Groups Projects
Commit 65574f11 authored by s64648's avatar s64648
Browse files

w

parent eaea2836
Branches master
No related tags found
No related merge requests found
Showing
with 5346 additions and 475 deletions
Bildschirmfoto 2019-10-27 um 18.33.10.png

85.5 KiB

File deleted
# se2-Application, v2.0
Demo application of the Software Engineering 2 course.
SE-Application has a <b>modular structure</b> that is comprised of components that follow certain software engineering principles.
<b>Components</b> are basic building blocks of an application that represent a coarser level of abstraction than classes. Components often consist of multiple parts such as parts for performing the logic (e.g. transactions or calculations), parts that create views of a GUI (e.g. a web-GUI or a JavaFX-GUI) and parts that configure and control other parts.
It has become good software engineering practice to decouple interfaces from implementations, including user interfaces (views) from performing functions (logic). This principle is called <b>separation of concerns</b> and is an essential software engineering method to introduce structure and clarity in software systems.
In this code base, <b>"Views"</b> are used to implement GUI parts of an application component and <b>"Logic"</b> is referred to implementing functionality.
The first application component is a <b>Tax Calculator</b>. Its view-part is responsible for displaying the key panel, receiving key/mouse input and displaying calculation results. The Tax Calculator's
* GUI-component is comprised of files from the fxgui-package: _Calculator.fxml_, _Calculator.css_, _CalculatorFXMLController.java_.
* Actual calculations are performed in the logic-part located in the logic-package: _CalculatorLogic.java_.
Both parts are implemented in separate Java packages and classes. Both are connected by interfaces (<b>ViewIntf</b> and <b>LogicIntf</b>) that connect both parts to each other.
<b>Interfaces</b> consist of <i>Interface definitions</i> (public Java Intf-interfaces) and <i>references to instances</i> (Java objects) that implement interfaces. Those are often instances of private (non-public) Impl-classes of an interface. Instances often exist as <i>singletons</i> meaning that only one instance of a class exists and distributed (<i>"wired"</i>) to other parts that need to access them by <i>injecting their references</i>. "Wiring" is a complex <i>configuration</i> task.
In this code base, component interfaces are defined in a "component"-class located in the components-package. _components.Calculator.java_ contains interface definitions for the Tax Calculator:
* _Calculator.ViewIntf_ - implemented by CalculatorFXMLController.java in the GUI and
* _Calculator.LogicIntf_ - implemented by CalculatorLogic.java. Both parts have no other connections, dependencies, imports, references other than
those two interfaces.
<b>Wiring</b> is the process of connecting instances that implement certain interfaces to component parts that need to access interfaces. An interface cannot be accessed with no implementation (instance) behind. Hence, the reference to an instance that implements an interface must be bound ("wired") into the component where it is accessed. It is important that only the interface definition is known in the code where the interface is used. The implementation class of the interface should be hidden (non-public) to the code making sure that the interface is the only dependency and no other "import" exists other than the interface.
Wiring can be performed by explicitly injecting a reference into a component by invoking a method called _inject( Intf ref );_ during its configuration. Frameworks such as _Spring_ perform wiring automatically.
<b>Lifecycle</b>. Since components are comprised of multiple parts, they can be complex and their "lifecycle" needs to be carefully designed and implemented. Lifecycle operations span from creation (instantiation) and configuration to start, operation, shut down and destruction - all performed in an explicitly controlled, orderly manner. Lifecycle operations are important for components and should explicitly be defined by lifecycle interfaces that include operations such as create(), startup(), shutdown() and destroy().
This leads to the need for other components that are not concerned with performing application logic or the GUI, but with the "managing" and "operating" the other components by executing their lifecycle operations. Those components include:
* _Configurators_ as special components that provide configuration information (_AppConfigurator.java_ is an example).
* _Builders_ are special components that build (create, configure, wire) other components.
* _Runners_ are special components that execute (start, stop) other components.
Most of these components exist throughout the lifetime of the application as singleton instances. Since they control other components, they must be created first and also shut down last.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.group</groupId>
<artifactId>se-application</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>HelloWorld</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
<project
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<!-- Parent project file.
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent
-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
</parent>
<!-- This project. -->
<groupId>de.beuth</groupId>
<artifactId>se2-application</artifactId>
<version>${project.version}-SNAPSHOT</version>
<name>se2-application</name>
<description>Software Engineering 2 application with Spring Boot</description>
<packaging>jar</packaging>
<properties>
<project.version>2.0.0</project.version>
<springboot.version>2.1.8.RELEASE</springboot.version>
<junit.version>4.12</junit.version>
<openjfx.version>12</openjfx.version>
<maven.test.skip>false</maven.test.skip>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.compiler.source>1.12</project.compiler.source>
<project.compiler.target>1.12</project.compiler.target>
</properties>
<!-- Project dependencies. -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- include open JavaFX openjfx dependency for Java -->
<!-- https://stackoverflow.com/questions/52653836/maven-shade-javafx-runtime-components-are-missing -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${openjfx.version}</version>
</dependency>
</dependencies>
<!-- Configurations for build stage. -->
<build>
<plugins>
<!-- Use Spring Boots maven build plugin. -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<!-- Build plugin extension to copy/package resources needed during run-time to target -->
<resources>
<resource>
<!-- Copy all files to ./target/classes -->
<directory>src/main/resources</directory>
</resource>
<resource>
<!-- Copy files from source tree to target -->
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.sql</include>
</includes>
</resource>
</resources>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
This diff is collapsed.
File moved
File moved
File moved
File moved
import java.util.*;
/**
*
*/
public class Article extends EntityIntf {
/**
* Default constructor
*/
public Article() {
}
/**
*
*/
private String name;
/**
*
*/
private String price;
/**
* @return
*/
public String getId() {
// TODO implement here
return "";
}
/**
* @return
*/
public String getName() {
// TODO implement here
return "";
}
/**
* @param name
* @return
*/
public void setName(String name) {
// TODO implement here
return null;
}
/**
* @return
*/
public String getPrice() {
// TODO implement here
return "";
}
/**
* @param price
* @return
*/
public void setPrice(String price) {
// TODO implement here
return null;
}
}
\ No newline at end of file
import java.util.*;
/**
*
*/
public class Customer extends EntityIntf {
/**
* Default constructor
*/
public Customer() {
}
/**
*
*/
private String name;
/**
*
*/
private CustomerStatus status;
/**
* @return
*/
public String getId() {
// TODO implement here
return "";
}
/**
* @return
*/
public String getName() {
// TODO implement here
return "";
}
/**
* @param name
* @return
*/
public void setName(String name) {
// TODO implement here
return null;
}
/**
* @return
*/
public List<String> getContacts() {
// TODO implement here
return null;
}
/**
* @return
*/
public List<Note> getNotes() {
// TODO implement here
return null;
}
/**
* @return
*/
public CustomerStatus getStatus() {
// TODO implement here
return null;
}
/**
* @param status
* @return
*/
public void setStatus(CustomerStatus status) {
// TODO implement here
return null;
}
}
\ No newline at end of file
import java.util.*;
/**
*
*/
public class EntityIntf extends Serializable {
/**
* Default constructor
*/
public EntityIntf() {
}
/**
* @return
*/
public String getId() {
// TODO implement here
return "";
}
}
\ No newline at end of file
import java.util.*;
/**
*
*/
public class Note extends Serializable {
/**
* Default constructor
*/
public Note() {
}
/**
*
*/
private Date timeStamp;
/**
*
*/
private String noteText;
/**
* @return
*/
public String getSimpleTimestamp() {
// TODO implement here
return "";
}
/**
* @return
*/
public String getNoteText() {
// TODO implement here
return "";
}
/**
* @param noteText
* @return
*/
public void setNoteText(String noteText) {
// TODO implement here
return null;
}
/**
* @return
*/
public String externalize() {
// TODO implement here
return "";
}
}
\ No newline at end of file
import java.util.*;
/**
*
*/
public class Serializable {
/**
* Default constructor
*/
public Serializable() {
}
}
\ No newline at end of file
/**
* Project Untitled
*/
#include "Article.h"
/**
* Article implementation
*/
/**
* @return String
*/
String Article::getId() {
return "";
}
/**
* @return String
*/
String Article::getName() {
return "";
}
/**
* @param name
* @return void
*/
void Article::setName(String name) {
return;
}
/**
* @return String
*/
String Article::getPrice() {
return "";
}
/**
* @param price
* @return void
*/
void Article::setPrice(String price) {
return;
}
\ No newline at end of file
/**
* Project Untitled
*/
#ifndef _ARTICLE_H
#define _ARTICLE_H
#include "EntityIntf.h"
class Article: public EntityIntf {
public:
String getId();
String getName();
/**
* @param name
*/
void setName(String name);
String getPrice();
/**
* @param price
*/
void setPrice(String price);
private:
String name;
String price;
};
#endif //_ARTICLE_H
\ No newline at end of file
/**
* Project Untitled
*/
#include "Customer.h"
/**
* Customer implementation
*/
/**
* @return String
*/
String Customer::getId() {
return "";
}
/**
* @return String
*/
String Customer::getName() {
return "";
}
/**
* @param name
* @return void
*/
void Customer::setName(String name) {
return;
}
/**
* @return List<String>
*/
List<String> Customer::getContacts() {
return null;
}
/**
* @return List<Note>
*/
List<Note> Customer::getNotes() {
return null;
}
/**
* @return CustomerStatus
*/
CustomerStatus Customer::getStatus() {
return null;
}
/**
* @param status
* @return void
*/
void Customer::setStatus(CustomerStatus status) {
return;
}
\ No newline at end of file
/**
* Project Untitled
*/
#ifndef _CUSTOMER_H
#define _CUSTOMER_H
#include "EntityIntf.h"
class Customer: public EntityIntf {
public:
String getId();
String getName();
/**
* @param name
*/
void setName(String name);
List<String> getContacts();
List<Note> getNotes();
CustomerStatus getStatus();
/**
* @param status
*/
void setStatus(CustomerStatus status);
private:
String name;
CustomerStatus status;
};
#endif //_CUSTOMER_H
\ No newline at end of file
/**
* Project Untitled
*/
#include "EntityIntf.h"
/**
* EntityIntf implementation
*/
/**
* @return String
*/
String EntityIntf::getId() {
return "";
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment