C OMP 110/401 D OCUMENTATION : A NNOTATIONS Instructor: Prasun Dewan.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

C OMP 110/401 P ACKAGES Instructor: Prasun Dewan.
Java Programming 2 Dr. Priti Srinivas Sajja Introductory concepts of java programming as specified in PGDCA 203:Object Technology, S P University.
C OMP 401 C OURSE O VERVIEW Instructor: Prasun Dewan (FB 150, Course page:
C OMP 110 S TATE Instructor: Jason Carter. 2 O UTLINE Instance Variables Procedures Properties Print Statements Println vs. Print Overloading.
C OMP 401 C LASS S TATE Instructor: Prasun Dewan.
C OMP 110 C ONDITIONALS Instructor: Jason Carter.
C OMP 110 S TYLE Instructor: Jason Carter. 2 I NTERFACES AND M ORE S TYLE Define contracts between our users and implementers Optional – they may not.
C OMP 401 O BJECTS Instructor: Prasun Dewan 2 C OMPUTER VS. P ROGRAM M ODEL Processor Compiler Program (source code)
C OMP 110 L OAN C ASE S TUDY Instructor: Jason Carter.
C OMP 110 O BJECTS Instructor: Jason Carter. 2 C OMPUTER VS. P ROGRAM M ODEL Processor Compiler Program (source code)
By - Qiong Han. DON’T FALL BEHIND IN READING Submission Instruction Everyone needs to submit the printed HARD- COPY of the codes and the grading sheets.
Midterm Exam 75 points 1 min per point Allocate time proportionate to points Closed book Chapters 1-5 (except char) PDF/PS with index and corrections coming.
Object-based Programming Intuitive explanation Using objects to read input Creating objects Style rules.
Program Style Identifier Names Comments Named Constants Avoiding Code Repetition Giving Least Privilege Efficiency Interfaces.
Comp 14 (3) By Stephan Sherman Office hours, W, 3:00-3:50pm.
Object-based Programming Intuitive explanation Using objects to read input Creating objects Style rules.
Programmer-Defined Types Object Types as Programmer-defined Types Two-way Dependencies Representation Errors Primitive Vs Object Properties Constructors.
Scott Grissom, copyright 2004Ch 3: Java Features Slide 1 Why Java? It is object-oriented provides many ready to use classes platform independent modern.
Object-based Programming Intuitive explanation Two concrete examples Calculators addition BMI Programming Environment.
ObjectEditor Prasun Dewan Comp 114. ObjectEditor Automatic user-interface generation. You only write computation code Separate object to do I/O Main just.
State Instance Variables Procedures Properties Print Statements Println Vs Print Overloading J++
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
C OMP 401 A NIMATION L OOPS Instructor: Prasun Dewan.
1 v1.6 08/02/2006 Overview of Eclipse Lectures 1.Overview 2.Installing and Running 3.Building and Running Java Classes 4.Refactoring 5.Debugging 6.Testing.
C OMP 401 C LASS S TATE Instructor: Prasun Dewan.
C OMP 401 P ATTERNS, I NTERFACES AND O BJECT E DITOR Instructor: Prasun Dewan.
Week 3 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Lesson 6. GCSE Computing – programming languages Candidates should be able to:  describe common tools and facilities available in an integrated development.
C OMP 110/401 C OMPOSITE A NNOTATIONS Instructor: Prasun Dewan.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
FEN UCN T&B - PBA/CodeContract- Intro 1 Code Contract Introduction Specification of a Person Class.
C OMP 401: C ONSTRUCTORS AND P OINTERS Instructor: Prasun Dewan (FB 150,
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
A First Simple Program /* This is a simple Java program. Call this file "Example.java".*/ class Example { // Your program begins with a call to main().
C OMP 110/401 D OCUMENTATION : C OMMENTS Instructor: Prasun Dewan.
C OMP 110/401 E NCAPSULATION AND L EAST P RIVILEGE Instructor: Prasun Dewan.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
I NCREASING THE A UTOMATION OF A T OOLKIT WITHOUT R EDUCING ITS A BSTRACTION AND U SER - I NTERFACE F LEXIBILITY Prasun Dewan University of North Carolina.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 5.
C OMP 401 A NIMATION : MVC Instructor: Prasun Dewan.
C OMP 401 U SER -I NTERFACE VS. M AIN T HREADS Instructor: Prasun Dewan.
C OMP 401 R EFLECTION AND A CTION O BJECTS Instructor: Prasun Dewan.
C OMP 401 G RAPH VS. D AG VS. T REE O BJECT S TRUCTURES Instructor: Prasun Dewan.
C OMP 401 P RACTICAL A PPLICATIONS OF MVC AND O BSERVER : P ROPERTY N OTIFICATION Instructor: Prasun Dewan.
C OMP 401 E XCEPTIONS -R EMAINDER Instructor: Prasun Dewan.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
C OMP 401 P ACKAGES Instructor: Prasun Dewan 2 P REREQUISITES Objects.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
1 Week 8 Final Project Planning & Chapter 6 JavaScript Advanced Web Development IT225 Spring Term 2016 Marymount University School of Business Administration.
J AVA P ROGRAMMING 2 CH 04: C LASSES, O BJECTS AND M ETHODS (II) 0.
More on Arrays Review of Arrays of ints, doubles, chars
Building C# Applications
More Sophisticated Behavior
Module Road Map Refactoring Why Refactoring? Examples
Reference: COS240 Syllabus
HW5(50pts) The homework Due on April 14, 23:59:59
Instructor: Prasun Dewan
Instructor: Prasun Dewan (FB 150,
Overview of Eclipse Lectures
Beans and object editor
Composite Objects with Object Editor With slides from Andrew Ghobrial
Comp 110/401 Documentation: Comments
Recitation 4 September 16, 2011.
The Object-Oriented Thought Process Chapter 04
Midterm 2 review.
Recitation 3 September 9, 2011 Wade Gobel.
LCC 6310 Computation as an Expressive Medium
Plug-In Architecture Pattern
Presentation transcript:

C OMP 110/401 D OCUMENTATION : A NNOTATIONS Instructor: Prasun Dewan

2 P REREQUISITE Documentation Comments.

3 P ROGRAMMING S TYLE : T HE A RT OF P ROGRAMMING Use Interfaces Efficiency Document Program Avoid Code Repetition Giving Least Privilege Use Named Constants

4 D OCUMENTATION Comments are one form of documentation about a program External descriptions of a program are also useful html#exampleresult} Annotations: Internal descriptions available at runtime (to runtime tools) also useful

5 A NNOTATION VS. C OMMENT is in meters, weight in centimeters") public class AnAnnotatedBMICalculator { public double calculateBMI(double height, double weight) { return weight/(height*height); } Annotation not removed by compiler Available to ObjectEditor

6 E XPLANATION A NNOTATION ?

7 A NNOTATED I NTERFACE AND C BMI from height in metres and weight in kgs.") public interface AnnotatedBMISpreadsheet { public double getHeight(); public void setHeight(double is in Kilograms. ") public double weight automatically recalculates BMI.") public void setWeight(double newVal); public double getBMI(); previously computed BMI value in a variable.") public class AnAnnotatedBMISpreadsheet implements AnnotatedBMISpreadsheet {…}

8 E XPLANATION AND UI D OCUMENTATION Menu item tooltip text Explanation annotation of associated method Property tooltip text Sum of getter and setter explanations Object tooltip text Sum of interface and class explanations Some documentation is outside a class In PPT, PDF, and other Web Docs

9 W EB D " tate_Notes.pdf", " Slides.pptx" }) public interface AnnotatedBMISpreadsheet {public interface AnnotatedBMISpreadsheet { … }

10 C OMMON M ENU

11 C OMMON M ENU

12 T OOLTIP T EXTS IN C OMMON AND O BJECT M ENU ObjectEditor used to build itself Meta circularity – a la Interpreter “interpeting” itself Bootstrapping – a la OS loading itself Requires a layered implementation

13 L AYERED I MPLEMENTATION public class ADemoFontOperationsModel implements FrameModel ("Makes font size big enough to be easily seen in a demo projected to a medium-sized room.") public void demoFontSize() { … } … }

14 E DITING O BJECT E DITOR import bus.uigen.ObjectEditor; public class AnObjectEditorEditor { public static void main (String[] args) { ObjectEditor.edit(new ObjectEditor()); } Can instantiate and edit objects without using knowing about or using main