Syntax & Semantics UML - Java

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
JAVA Revision Lecture Electronic Voting System Marina De Vos.
Phil Campbell London South Bank University Java 1 First Steps.
 Computer Science 1MD3 Introduction to Programming Winter 2014.
Class Scope class Student { private: string id; string firstName, lastName; float gpa; public: void Read() { cin >> id >> firstName >> lastName >> gpa;
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
CS-1010 Dr. Mark L. Hornick 1 Selection Statements and conditional expressions.
The Java Programming Language
Outline Java program structure Basic program elements
Writing algorithms using the while-statement. Previously discussed Syntax of while-statement:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Object Oriented Design and UML
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Basics Programming Concepts. Basics A computer program is a set of instructions to tell a computer what to do Machine language = circuit level language.
CIS Computer Programming Logic
Java Language and SW Dev’t
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
The Java Programming Language
CIS 260: App Dev I. 2 Programs and Programming n Program  A sequence of steps designed to accomplish a task n Program design  A detailed _____ for implementing.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Boolean expressions, part 2: Logical operators. Previously discussed Recall that there are 2 types of operators that return a boolean result (true or.
Lecture 1 Introduction. 1-2 Your world is filled with objects. Many of these objects are controlled by computers. Computers rely on ___________ to determine.
CIS 260: App Dev I. 2 Programs and Programming n Program  A sequence of steps designed to accomplish a task n Program design  A detailed _____ for implementing.
Parse & Syntax Trees Syntax & Semantic Errors Mini-Lecture.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Mutual Recursion A set of methods calls each other cooperatively and repeatedly Expression is a term, or sum or difference of terms Term is a factor, or.
CS 153: Concepts of Compiler Design October 21 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Review TEST 2 Chapters 4,5,7. QUESTION For which type of operands does the == operator always work correctly: (a) int, (b) double, or (c) String?
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
Boolean expressions, part 1: Compare operators. Compare operators Compare operators compare 2 numerical values and return a Boolean (logical) value A.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
AP Computer Science A – Healdsburg High School 1 Unit 2 - Structure of a Java Program - Documentation - Types of Errors - Example.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Lecture 1 Introduction. © 2006 Pearson Addison-Wesley. All rights reserved 1-2 Your world is filled with objects. Many of these objects are controlled.
The Essentials of a Java Program JavaMethods An Introduction to Object-Oriented Programming Maria Litvin Gary Litvin Copyright © 2003 by Maria Litvin,
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Midterm preview.
1 Sections 3.1 – 3.2a Basic Syntax and Semantics Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Concepts of Programming Languages
Information and Computer Sciences University of Hawaii, Manoa
The need for Programming Languages
Working with Java.
System Software Unit-1 (Language Processors) A TOY Compiler
Chapter No. : 1 Introduction to Java.
Representation, Syntax, Paradigms, Types
Generic array list and casting C&K s7.7
null, true, and false are also reserved.
TO COMPLETE THE FOLLOWING:
UML & Programming Martin Fowler.
Chapter 2: Basic Elements of Java
Chapter 1: Computer Systems
Unit 3 - The while Loop - Extending the Vic class - Examples
Representation, Syntax, Paradigms, Types
Units with – James tedder
Interpreter Pattern.
CS/ENGRD 2110 Fall 2018 Lecture 5: Local vars; Inside-out rule; constructors
COMPUTER 2430 Object Oriented Programming and Data Structures I
Representation, Syntax, Paradigms, Types
SYNTAX DIRECTED DEFINITION
Focus of the Course Object-Oriented Software Development
Understand the interaction between computer hardware and software
Representation, Syntax, Paradigms, Types
CS/ENGRD 2110 Spring 2019 Lecture 5: Local vars; Inside-out rule; constructors
Visual Programming Languages ICS 539 Icon System Visual Languages & Visual Programming, Chapter 1, Editor Chang, 1990 ICS Department KFUPM Sept. 1,
JAVA. Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of platforms, such.
Presentation transcript:

Syntax & Semantics UML - Java

Syntax Java has textual syntax. From Wikipedia, the free encyclopedia: “…the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.” Java has textual syntax. The If-sentence bellow is syntactically correct: First code word if followed by token ( , etc. … int age = 10; if (age >70){ System.out.println(“Can be retired!"); } else { System.out.println("Can not be retired!"); }

UML Has a Vusuall Syntax (and also a textual one) If sentence in an activity diagram: [age>70] Print: «Can be retired!» age = 10 [else] Print: «Can not be retired!»

Semantics The study of meanings. Used to differentiate the meaning of an instruction from its format. int age = 10; if (age >70){ System.out.println(“Can be retired!"); } else { System.out.println("Can not be retired!"); } Semantics of the if-sentence: If the boolean expression evaluates to true then execute what is between { and }... Here the symbol function as a merge (i.e., not an if) [age>70] Print: «Can be retired!» age= 10 [else] Print: «Can not be retired!» The samantics of a branch is the «same as» the if sentence.

Code Generation Semantics of UML constructions expressed with Java expressions package Journal.model; public class Person { private String firstName; private String lastName; } package Journal.model; public class Patient extends Person{ private PatientFile has; } package Journal.model; public class PatientFile{ private java.util.List<PatientRecord> contains; private Patient concerns; }

MagicDraw: UML  Java public class PatientFile{ private java.util.List<PatientRecord> contains;... 7/2/2018

Operations  Method public class Person { private String firstName; private String lastName; public String getName( ){ return null; } public void setName( String name ){

This was problematic in MagicDraw This was problematic in MagicDraw. Did some reverse engineering to get this in place... package Journal.controller; import Journal.model.PatientFile; public class JournalApp { private java.util.List<PatientFile> patientFiles; public static void main( String[] args ){ }

MagicDraw - I Meny velg: Tools/Generate Code/Java

Software Engineering Ref. : http://developeriq.in/articles/2013/dec/24/the-myth-of-software-reengineering/