From Physical Concept to Software Object: SNS/ARCS Software Workshop Caltech, Dec. 13, 2002 Illustration of a class design process.

Slides:



Advertisements
Similar presentations
Javier Junquera Exercises on basis set generation 1. The default basis set.
Advertisements

Chapter 3: Modularization
Chapter 2: Modularization
Programming Logic and Design Fourth Edition, Introductory
Fall 2007CS 225 Introduction to Software Design Chapter 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Object-oriented concepts.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L15 (Chapter 22) Java Collections.
Chapter 1 Principles of Programming and Software Engineering.
Chapter 1 Program Design
Liang, Introduction to Java Programming, Tenth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 20 Lists, Stacks, Queues, and Priority.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Spring 2009CS 225 Introduction to Software Design Chapter 1.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Chapter 19 Java Data Structures
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 22 Lists, Stacks, Queues, and Priority.
Lattice Vibrations, Part I
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Fruitful functions. Return values The built-in functions we have used, such as abs, pow, int, max, and range, have produced results. Calling each of these.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Introduction to Software Design Chapter 1. Chapter Objectives  To become familiar with the software challenge and the software life cycle  To understand.
1 Software Design Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13, 5 th edition and Ch. 10, 6 th edition.
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
Graphics Concepts CS 2302, Fall /3/20142 Drawing Paths.
1 Software Design Overview Reference: Software Engineering, by Ian Sommerville, Ch. 12 & 13.
1 CSC 222: Computer Programming II Spring 2004 See online syllabus at: Course goals:
Event Data History David Adams BNL Atlas Software Week December 2001.
Cohesion and Coupling CS 4311
Chapter 18 Java Collections Framework
Design Concepts By Deepika Chaudhary.
Chapter 1 Data Structures and Algorithms. Primary Goals Present commonly used data structures Present commonly used data structures Introduce the idea.
1 Principals of Software Design and Development Specification SDDEDPDCG 090.
Looping and Counting Lecture 3 Hartmut Kaiser
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
The Software Development Process
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Thomas Kuehne.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
Data Abstraction UW CSE 160 Spring What is a program? – A sequence of instructions to achieve some particular purpose What is a library? – A collection.
Interface specifications At the core of each Larch interface language is a model of the state manipulated by the associated programming language. Each.
Databases and Database User ch1 Define Database? A database is a collection of related data.1 By data, we mean known facts that can be recorded and that.
Data Modeling Using the Entity- Relationship (ER) Model
Principles of Programming & Software Engineering
Entity- Relationship (ER) Model
Lecture 1 Introduction Richard Gesick.
Chapter 19 Java Data Structures
Chapter 20 Lists, Stacks, Queues, and Priority Queues
Principles of Programming and Software Engineering
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Chapter 20 Lists, Stacks, Queues, and Priority Queues
Data Structures and Algorithms for Information Processing
Chemical Bonds What holds a compound together?
Chapter 2. Problem Solving and Software Engineering
Chapter 20 Lists, Stacks, Queues, and Priority Queues
Presentation transcript:

From Physical Concept to Software Object: SNS/ARCS Software Workshop Caltech, Dec. 13, 2002 Illustration of a class design process

Two terms: Class: Blueprint for making objects that model a concept specifies what data and what operations data typically left blank operations filled in Object (2): an instance of a class fills in blanks in blueprint class A var1 ____ var2 ____ op1( ){ does stuff;} a (object of type A) var1 = var2 = “meV” op1( ){does stuff;} Object (1): software entity that can have both data and operations on data.

Basic phonon (atomic vibration) model Essential inelastic neutron scattering measurement! For periodic crystal: Model crystal as balls & springs Springs described by force constants Finite range forces

Introducing: CrystalStructure The problem: Compute neutron cross sections from a Born-von Kármán model for an arbitrary crystal structure. Immediate need: A class to acquire, store, and serve the crystal structure information needed by the rest of the computation: “CrystalStructure”

Design Goals Modular – Changes to CrystalStructure leave the rest of the program invariant. – Other classes know as little as possible about CS’s internals. Logical – structure classes to mirror the physics. Efficient – no extraneous parts.

CrystalStructureForceConstantList ForceConstantTensor ? Immediate need: object to generate and serve crystal structure information to the rest of the program loop over q space to compute phonon model and i.n.s. cross section CrystalStructure’s neighborhood

What information does CrystalStructure serve? Bonds!* Each bond has: Two atoms A vector from one to the other Note: no force constant. *Among other things…

How does CrystalStructure get bonds? 1. Process input data to get bonds Given how many nearest-neighbor shells (n) and a unit cell, ask what are the n distances of the nearest neighbors? which pairs of atoms are at any of those distances? Inputs needed:UnitCell*, number of shells *to be defined… 2. Read a file Result: a collection of bonds.

How do other objects get bonds from CS object? Other objects should not know internal details of CrystalStructure In particular, the other object (client) should not know how bonds are stored (e.g. array? list? associative array*?) But clients will need to get the complete bond collection. Offer an interface that hides the implementation

Solution: BondServer Create a server class that will give one iteration through the collection of bonds Guarantee every bond given once Two piece interface: IsTheBondContainerEmpty GetNextBond – returns the next bond in the container, and a flag telling if that bond is the last one. Client: blissfully ignorant!

Downwards! Outline of CrystalStructure class known. CS knows how to acquire and serve the bond information. But How will CS contain the bonds? “Bond contains two atoms”—what is an atom? What is UnitCell?

UnitCell UnitCell has additional information about the atomic positions and properties. How do we retain it and make it available? CrystalStructure BondCollection UnitCell Atoms Alternative 1 Dump UnitCell info into CS Crystal Structure BondCollection Atoms Basis Vectors Cell params

UnitCell, cont. Alternative 2: UnitCell serves info directly UnitCell Atoms Basis Vectors Cell params CrystalStructure BondCollection loop over q space to compute phonon model and i.n.s. cross section BondServer

CrystalStructure BondCollection Alternative 3: Embed UnitCell in CrystalStructure; CS serves UnitCell’s information UnitCell, cont. UnitCell Atoms Basis Vectors Cell params loop over q space to compute phonon model and i.n.s. cross section BondServer

What’s in UnitCell? UnitCell tracks: Atoms their locations (Vectors) cell parameters (a, b, c, angles) space group symbol ability to tell if a vector is “in the first Brillouin zone” Sites More types of objects: Site, Atom, Vector a b c

Keep working down the hierarchy Stop when each class clearly represents a single concept Site Atom BasisVector Wyckoff symbol Atom chem symbol mass b coh b inc  abs Vector x, y, z Getting to the bottom…

Putting it together: UnitCell SiteCollection cell parameters InFirstBZ( ) Site Atom Vector Atom symbol mass b coh b inc  abs Vector x, y, z Bond Atom1 Atom2 Vector CrystalStructure BondCollection UnitCell FindBondLengths( ) FillBondCollection( )

Much more to do… Implementation: How do we store bonds? Does each bond have two Atom objects? Pick the relevant bonds? Interface: How do clients get UnitCell information from CrystalStructure? Site Info? Atom info? How does a user create Atoms, Vectors, Sites, UnitCell? … Critique: Right degree of abstraction? Does each object’s name match the concept it models? … Document design, write code, test, document…

CrystalStructureForceConstantList ForceConstantTensor loop over q space to compute phonon model and i.n.s. cross section...but we’ve started well.