Monday, May 26, 2025

Online Food Store Case Study

STEP 1 - System Requirements Analysis

1.1 Main Use Case: Making an Order

Here you do an examination the different stages involved in the process of how to do an online order

  1. Browsing and Adding to Cart: The customer explores the online store, finds items they like, and adds them to their virtual shopping cart. When the customer is finished adding items, they requests the cart; they may optionally edit the cart.

  2. Order Checkout: The customer clicks "proceed to order" and enters their personal information, shipping address, and payment details. The customer reviews their order summary, including the items, quantity, price, and shipping details. They then click a button like "Confirm Order" or "Place Order" or "Buy Now" to finalize the purchase. This action sends the order request to the online store.

  3. Confirmation Email: The customer receives a confirmation email with a summary of the order details and an order number. The store is acknowledging that the order has been received and is being processed.

  4. Payment Processing: The online store processes the customer's payment, ensuring the funds are securely transferred.

  5. Order Fulfillment: The online store prepares the order for shipment. This includes picking the items, packing them, and generating a shipping label.

  6. Shipping: The order is handed over to the shipping carrier, which delivers it to the customer's address.

  7. Delivery: The customer receives their order!

  8. Order Completion: The online store marks the order as complete in their system.

  9. Potential Return/Refund: The customer may have the option to return or request a refund for their order if they are not satisfied.

1.2 "Making an Order" System Sequence Diagrams
CustomerSystemAdminrequestMenu"Menu"loopaddItemToCart(item)requestCart"Cart"checkoutOrder(cart)"Order"setDeliveryAddresssetPaymentDetailsplaceOrder(order)"Order Confirmation Email"notifyAdmin(orderId, "new order")approveOrder(orderId)notifyCustomer("order is being prepared")updateOrderStatus(orderId, "ready for delivery")notifyCustomer("order is ready for delivery")notifyCustomer("order is delivered")updateInventory(item, quantity)

STEP 2 - OOA: Functional Requirements Analysis

When doing OO analysis, you create the Domain Model and draw classes/abstractions and interactions.

2.1 Online Food Store Key Abstractions
  • Customer: The person placing the order.
  • Menu: The list of available MenuItem.
  • MenuItem: The dishes items the Customer selects from the Menu. MenuItem details: price, description and dietary info
  • Cart: The virtual cart where the customer adds their items.
  • Restaurant: The establishment providing the food.
  • Order: The collection of items the customer wants.
  • OrderItem: a single item within an order, including quantity and any special instructions.
  • Address: The Customer delivery address and the Restaurant location
  • RestaurantAdmin: The person who accepts orders and manages the order states
  • Payment Details: a class that holds the details of the payment method used.
  • Payment System: The system used to process the payment.
  • Delivery Service: The service responsible for delivering the food.
  • Review/Rating: To allow customers to rate their experience.
2.2 Online Food Store Domain Model
Menumenu itemsMenuItemnamepriceCartorder itemsadd(menuItem)OrderItema menu itema quantityOrdercustomerorder itemsshipping addresspayment methodstatusCustomerfirst namelast nameemaildate of birthphone numberAddressPaymentcontains11..*contains11..*has11is used to createis placed by1*has11..*has11has11

STEP 3 - OOD: Sequence Diagram

3.1 The Sequence Diagram of the "Making an Order" Use Case
CustomerMainUIControllerRestaurantCartOrderMailingSystemPaymentServicePaymentGatewayDeliveryServiceAdminUIAdminrequestMenu()requestMenu()requestMenu()"Menu""Menu"loopaddItemToCart(item)addItemToCart(item)addItemToCart(item)add(item)requestCart()requestCart()requestCart()"Cart""Cart"checkoutOrder(cart)checkoutOrder(cart)checkoutOrder(cart)"Order""Order"setDeliveryAddress(address)setDeliveryAddress(address)setDeliveryAddress(address)setDeliveryAddress(address)setPaymentDetails(payment)setPaymentDetails(payment)setPaymentDetails(payment)setPaymentDetails(payment)placeOrder(order)placeOrder(order)placeOrder(order)sendConfirmationEmail(order)"Order Confirmation Email"updateOrderStatus(orderId, "pending")processPayment(payment)processPayment(payment)paymentResult(success/failure)paymentConfirmation(success/failure)updatePaymentStatus(success/failure)notifyAdmin("new order")approveOrder(orderId)approveOrder(orderId)notifyCustomer("order is being prepared")updateOrderStatus(orderId, "accepted")updateOrderStatus(Id, "ready for delivery")updateOrderStatus(orderId, "ready for delivery")updateOrderStatus(orderId, "ready for delivery")notifyCustomer("order is ready for delivery")requestDelivery(order)deliveryConfirmation(success/failure)updateOrderStatus(orderId, "delivered")notifyCustomer("order is delivered")updateInventory(item, quantity)

STEP 4 - OOD: Class Diagram

4.1 The Refined Domain Model Class Diagram

The class diagram of the design activity which represents the Refined Domain Model

Menuitems : List<MenuItem>MenuItemname : Stringprice : DoubleCartitems : List<OrderItem>add(:MenuItem)OrderItemitem : MenuItemquantity : IntegerCustomercustomerID : LongfirstName : StringlastName : Stringemail : Stringphone : StringshippingAddresses : Address[]billingAddress : AddresspaymentMethods : Payment[]OrderorderID : Longitems : List<OrderItem>customer : CustomershippingAddress : AddresspaymentMethod : PaymentpaymentStatus : StringtotalAmount : DoubleorderStatus : StringAddressPaymentcontains11..*11..*is used to create11is placed by10..*1111..*has11

Saturday, April 12, 2025

UML tools for eclipse IDE

Comparing eclipse IDE: UML Designer, Papyrus and Eclipse Modeling Tools

UML Designer, Eclipse Papyrus, and Eclipse Modeling Tools are all part of the Eclipse ecosystem, particularly focused on model-driven development (MDD). While they can overlap in functionality, they serve different purposes or cater to different user needs.


1. UML Designer (by Obeo)

  • Overview: A tool dedicated to UML modeling that provides a user-friendly interface.
  • Features: Lightweight, drag-and-drop interface, customizable viewpoints.
  • Best for: Beginner users who want standard UML diagrams.

2. Papyrus (by Eclipse Foundation)

  • Overview: A powerful modeling tool that supports multiple modeling languages.
  • Features: Support for UML 2.5, SysML and MARTE modeling languages.
  • Best for: Complex modeling, academic and industrial-grade modeling projects.

3. Eclipse Modeling Tools with UML Plugins

  • Overview: A general-purpose Eclipse package with optional UML plugins (like MDT UML2, EMF, GMF, etc.)
  • Features: Supports multiple modeling languages and frameworks: EMF, GMF, Ecore tools, etc.
  • Best for: Developers creating custom modeling tools or DSLs

Comparison Table

Tool Purpose UML Diagram Support Complexity Target Audience
Eclipse UML Designer UML modeling Good UML support Medium Developers needing custom diagram views
Eclipse Papyrus Multi-language (SysML, UML, MARTE...) modeling environment Full UML 2.x support High System engineers, advanced UML users
Eclipse Modeling Tools A package that includes EMF, GMF, and more Varies by plugin High Developers building modeling tools

Note: The UML Designer 9.0.0 standalone IDE is based on eclipse Oxygen (2017) and includes a JRE 8. UML Designer 9.0.0 can only run on older Ubuntu (e.g. 18.04 or 20.04); newer Ubuntu versions will have compatibilty issues with SWT included with UML Designer. The UML Designer 9.0.0 plugin will not work with current eclipse versions running on JDK 17 and higher.
Solution: Try running UML Designer in a Docker container with an older Ubuntu (e.g., 18.04 or 20.04) and the library versions match what UML Designer expects.
You can use an image like this:

FROM ubuntu:20.04
RUN apt update && apt install -y openjdk-8-jdk libgtk-3-0 libcanberra-gtk3-module libfreetype6
COPY UMLDesigner/ /opt/UMLDesigner/
WORKDIR /opt/UMLDesigner/
CMD ["./UMLDesigner"]

Or even easier: use a base image with Eclipse Oxygen preinstalled.

Friday, October 22, 2021

Eclipse IDE tips

1 Importing a Git project

To import a Git project into an eclipse project, open the command line terminal and move to eclipse workspace:

user@host:~$ cd eclipse-workspace/

clone the Git project into a newly created project folder:

user@host:~/eclipse-workspace$ git clone https://github.com/davidflanagan/jstdg7 Flanagan-JavaScript-Book-7Ed

The Flanagan-JavaScript-Book-7Ed folder is going to be the base folder of the eclipse project.
Run eclipse IDE and open the "eclipse-worskspace" folder. To import the project, select the option File -> Import -> General -> Project from Folder or Archive and click on Next button.

This opens a the "Import Projects from File System or Archive" window, click on "Directory" button. This opens a file chooser, navigate to the newly created folder and click on Open to import the project into eclipse IDE.

2 Importing a Maven project

Download a maven project, for example by cloning a git repo or by using the maven archetype plugin
In my case I am going to clone the maven project from git

Open the command line terminal and move to eclipse workspace:

user@host:~$ cd eclipse-workspace/

clone the Maven project into a newly created project folder:

git clone https://github.com/heroku/java-getting-started heroku-getting-started

You have cloned the Git project into the heroku-getting-started folder. That folder is going to be the base folder of the eclipse project.
Run eclipse IDE and open the "eclipse-worskspace" folder. To import the project, select the option File -> Import -> Maven -> Existing Maven Projects and click on Next button.

This opens a window that allows you to chose the project root directory, click on the Browse button.
This open a file selector, select the folder of the Maven project to be imported. This is what you get:

Select the pom of the project you want to import and click finish. In case you are importing a multi module maven project select the parent pom and all the poms of subproject you want to import.

3 Make eclipse IDE build faster

3.1 Turn Off Validations

As soon as you open a project, eclipse starts to build the project. Validation is part of projects building. If your workspace has many projects open, validation may take too long, threfore you may want to turn off validation to make building faster.

You can disable validators either for your project or for your workspace. To disable validators for your workspace, select Window -> Preferences -> Validation. This opens the Validation window. You can tick the second check box in the upper list "Suspend all Validators" or you can choose to disable individual validator by clearing the box next each validator.

3.2 Uncheck Auto Build

The menu item Project -> Build Automatically is checked by default. That means eclipse build all projects (both closed and opened projects) in your workspace whenever you open the workspace or run a clean command. So, if you your workspace holds many projects, it is convenient to uncheck the Build Automatically item.

Doing so, it will disable automatic building for the projects. To build the project you are currently working on, select the Project -> Clean item, uncheck Clean all projects and select Build only the selected project.

Friday, July 19, 2019

Introduction to SQL


The SQL language is a standard for relational databases:

  • since database systems share a standard language, migrating a database application to another relational database is a quick and inexpensive process
  • database application programs can access data stored in multiple relational DBMSs using the same database language

The practical SQL vs the relational algebra

  • the SQL language is a high level declarative language for the relational model: with a query in the SQL language, the user must only indicate how the result is to be and the DBMS decides how to execute the query
  • the relational algebra is a formal language for the relational model: with a query in the relational algebra, the user must specify a sequence of low-level operations. Relational algebra operations are not suitable for most DBMS users

The SQL name stands for Structured Query Language

  • the SQL language is a standard by the American National Standards Institute (ANSI) and the International Standards Organization (ISO)
  • on the wikipedia page about SQL, you can find out the history of the versions of the SQL standard

Wednesday, May 29, 2019

How to style link as buttons

CSS styles

.my-link{
    margin: 20px 0;
    text-align:center;
}
.my-link a {
    font-size:12px;
    padding: 8px 10px;
    background: #4eb0d7;
    color: #FFF;

    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    border: solid 1px #20538D;

    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
    -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
}
.my-link a:hover, .my-link a:focus {
    background: #377B96;
    border: solid 1px #2A4E77;
    text-decoration: none;
}
.my-link a:active {
    -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    background: #2E5481;
    border: solid 1px #27586C;
}

HTML code

<div class="my-link">
  <a href="#"> CONTINUE TO LINK </a>
</div>

the result

Friday, December 21, 2018

Introduction To Database

Databases and Database Users

Many daily activities involve the use of applications that interact with a database, for example making a bank operation or an hotel reservations, borrowing a book, purchasing tickets or anything else online.

A database application manages information that is to be stored in a database:

  • traditional applications use databases to store textual or numeric data
  • social-media web sites use big data storage systems or NOSQL systems to store text data and non conventional data such as images and video data

Tuesday, October 23, 2018

Floating-point Arithmetic

Floating-point numbers

A mathematical notation offers a way to represent a number with a string of digits of any length and a radix point. If the position of the radix point is not specified, the string indicates a integer and the position of the radix point would be next the least significative digit.

A mathematical notation can represent numbers as the product of two factors: a number of significant digits in a given base and a scale factor, where the scale factor is the base and an exponent. To obtain the value of the number, multiply the significand by the base raised to the exponent, which is equivalent to shifting the radix point by a number of places equal to the value of the exponent.

In scientific notation, numbers are scaled by a power of ten, the radix point appears immediately after the first digit and the scaling factor is a power of ten.

Floating-point representation is similar to scientific notation. A floating-point number consists of:

  • a signed digit string of a fixed length in a given base (or radix), called the significand, coefficient or mantissa.
    • the length of the significand determines the precision to which numbers can be represented
    • the base can be two, ten or sixteen
  • a signed integer exponent (also called scale or characteristic), which modifies the magnitude of the number.

The number exactly represented has the following form:

  significand * baseexponent (significand ∈ Z, base ∈ Z and base ≥ 2, exponent ∈ Z)

Example:

 +3.1415 = +31415 × 10-4

Floating point computation allows to represent very small and very large real numbers with finite precision.
In computing, floating-point arithmetic is used to represent approximated real numbers.

The term floating point indicates the fact that the radix point (decimal point or binary point in computers) can be floated to left or right, that is, it can be placed anywhere in the significant digits of the number.

The IEEE standard for floating numbers in computers and programming languages

Over the years, different floating-point representations have been used in computers. In 1985, IEEE 754, the Standard for Floating-Point Arithmetic, was established by the Institute of Electrical and Electronics Engineers (IEEE). The IEEE 754 standand is for binary floating point numbers representation.

The three IEEE standard number formats widely used in computers hardware and languages are:

  • single precision: the float type in C language. It is a binary format that occupies 32 bits (4 bytes), the significand has a precision of 24 bits, which implies about 7.2 decimal digits.
  • double precision: the double type in C language . It is a binary format that occupies 64 bits (8 bytes), the significand has a precision of 53 bits, which is equal to about 15.9 decimal digits.
  • double extended: also called exdended precision format. It is binary format that occupies 80 bits, the significand has a precision of 64 bits, which corresponds to about 19 decimal digits. If the processor handles 80 bits foating point, the "long double" C type can be used.