Software Construction Lecture 10 Frameworks

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
Unit 091 Introduction to GUI Programming Introduction to User Interfaces Introduction to GUI Programming GUI Design Issues GUI Programming Issues Java.
1 Chapter 7 Graphics and Event Handling. 2 Overview The java.awt and javax.swing packages and their subpackages support graphics and event handling. Many.
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
Creating a GUI with Swing. Introduction Very useful link: Swing – is a part of JFC (Java Foundation.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
GUI Programming in Java Tim McKenna GUI Programming Concepts l conventional programming: sequence of operations is determined by the program.
Java Swing - Lecture 1 An Introduction Milena Radenkovic slides originally by Chris Coleman.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
GUI Basics: Introduction. Creating GUI Objects // Create a button with text OK JButton jbtOK = new JButton("OK"); // Create a label with text "Enter your.
GUI Programming in Java
Java Programming Chapter 10 Graphical User Interfaces.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Java Swing, Events and MVC Optional Readings: Eckel’s Thinking in Java: Chap 14 (
Applets and Frames CS 21a: Introduction to Computing I First Semester,
GUIs for Applets Introduction Applets and Swing/JFC Alternatives to Swing Look-and-Feel issues Example applet graphical user interfaces.
CompSci 230 S Software Construction Frameworks & GUI Programming.
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
MIT AITI 2003 Lecture 17. Swing - Part II. The Java Event Model Up until now, we have focused on GUI's to present information (with one exception) Up.
Java Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
Chapter 9: Visual Programming Basics Object-Oriented Program Development Using Java: A Class-Centered Approach.
Session 27 Swing vs. AWT. AWT (Abstract Window ToolKit) It is a portable GUI library for stand-alone applications and/or applets. The Abstract Window.
GUIs in Java Swing, Events CS2110, SW Development Methods Readings: MSD, Chapter 12 Lab Exercise.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
– Advanced Programming P ROGRAMMING IN Lecture 21 Introduction to Swing.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
CS Lecture 00 Swing overview and introduction Lynda Thomas
MSc Workshop - © S. Kamin, U. ReddyLect 3 - GUI -1 Lecture 3 - Graphical User Interfaces r GUI toolkits in Java API r JFrame r GUI components.
Cs413_chapt02.ppt CS413 Advanced Swing Graphical User Interface Components Text: Advanced Java 2 Platform: Chapter 2 Abstract Windowing Toolkit (AWT) Library.
Object Oriented Programming Engr. M. Fahad Khan Lecturer, Software Engineering Department University of Engineering & Technology, Taxila.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
Frameworks CompSci 230 S Software Construction.
Software Design 5.1 From Using to Programming GUIs l Extend model of "keep it simple" in code to GUI  Bells and whistles ok, but easy to use and hide.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Week 6: Basic GUI Programming Concepts in Java Example: JFrameDemo.java container : a screen window/applet window/panel that groups and arranges components.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Java Swing, Events Readings: Just Java 2: Chap 19 & 21, or Eckel’s Thinking in Java: Chap 14 Slide credits to CMPUT 301, Department of Computing Science.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Graphical User Interface (GUI)
1 Lecture 8: User Interface Components with Swing.
Applets. 9/04/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L12: Applets Slide 2 Applets Usually.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
Java Programming Fifth Edition Chapter 13 Introduction to Swing Components.
Java Swing What is swing? Swing is a ”Lightweight” GUI ToolKit for Java Different from AWT / SWT Toolkits for GUIs Few lines of code to produce GUI elements.
A Quick Java Swing Tutorial
CompSci 230 S Software Construction
A First Look at GUI Applications
Java GUI.
Review: Java GUI Programming
Lecture 27 Creating Custom GUIs
Swing & the JFC – Advanced Java GUI
Ellen Walker Hiram College
Event Driven Programming
Week 8 Swing NetBeans GUI Builder
Advanced Programming in Java
Advanced GUIs and Graphics
Presentation transcript:

Software Construction Lecture 10 Frameworks

Agenda & Reading Topics: Reading Frameworks Extensibility Inversion of Control Java Frameworks Advantages & Disadvantages Reading Software framework Wikipedia Frameworks in Java

Framework Generic software platform for a certain type of applications Consists of parts that are found in many apps of that type Libraries with APIs (classes with methods etc.) Ready-made extensible programs ("engines") Sometimes also tools (e.g. for development, configuration, content) Often evolved by developing many apps of that type and reusing code more and more Characteristics: Reusable: the parts can be used for many apps of that type Extensible: developers can add their own app-specific code Inversion of Control: framework often calls your code

Web Application Frameworks Framework Examples Web Application Frameworks GUI Toolkits

Extensibility All frameworks can be extended to cater for app-specific functionality. A framework is intended to be extended to meet the needs of a particular application Common ways to extend a framework: Extension is carried out by sub-classing, overriding methods, and implementing interfaces Plug-ins: framework can load certain extra code in a specific format Within the framework language: Subclassing & overriding methods Implementing interfaces Registering event handlers

Inversion of Control A framework employs an inverted flow of control between itself and its clients. When using a framework, one usually just implements a few callback functions or specializes a few classes, and then invokes a single method or procedure. The framework does the rest of the work for you, invoking any necessary client callbacks or methods at the appropriate time and place. i.e. "Don't call us, we'll call you.“, or "Leave the driving to us.“ Example: Java's Swing and AWT classes. They have a huge amount of code to manage the user interface, and there is inversion of control because you start the GUI framework and then wait for it to call your listeners

Inversion of Control Traditional Program Execution The app has control over the execution flow, calling library code when it needs to. The framework has control over the execution flow, calling app code for app-specific behavior.

Inversion of Control Example: Java Applets

What is Java Frameworks? Frameworks are large bodies (usually many classes) of prewritten code to which you add your own code to solve a problem in a specific domain. In Java technology there are so many frameworks that helps the programmers to build complex applications easily. Examples: GUI Framework: eg Java's Swing and AWT classes Collection Framework/library It is a unified architecture for representing and manipulating collections It contains Interfaces, Implementations and algorithms

Collections Framework The Java Collections Framework provides the following benefits: Reduces programming effort Concentrate on the important parts of your program rather than on the low-level "plumbing" required to make it work. Increases program speed and quality It provides high-performance, high-quality implementations of useful data structures and algorithms Fosters software reuse New data structures that conform to the standard collection interfaces are by nature reusable. The same goes for new algorithms that operate on objects that implement these interfaces.

Frameworks VS libraries Framework uses your code because it is usually the framework that is in control. It means the framework controls the sequence and logic of some operation and calls your code to provide certain details You make use of a framework by calling its methods, inheritance, and supplying "callbacks", listeners, etc Note: although sometimes large libraries are referred to as frameworks, this is probably not the most common use of the term.

Advantages Reuse can save cost and time Higher level of abstraction Frameworks provides a standard working system through which user can develop the desired module of application or complete application instead of developing lower level details. Developers can devote more time in developing the software requirement Reduced maintenance cost (if the framework is maintained by someone else)

Disadvantages Can lead to code bloat Cost of learning a framework Framework may contain lots of unused code May need to use several frameworks Cost of learning a framework Spend more time in assessing the concept, function and its uses in developing the program. Licensing cost (for commercial frameworks) A generic ‘one-size-fits-all’ does not work so efficiently for any specific software. There is need to extend framework with specific code to develop any specific software.

GUI Programming Concepts conventional programming: sequence of operations is determined by the program what you want to happen, happens when you want it event-driven programming: sequence of operations is determined by the user’s interaction with the application’s interface anything that can happen, happens at any time

GUI Design Concepts a wealth of information creates a poverty of attention - Herbert Simon Principles of good GUI Design IBM's Design concepts Saul Greenberg's HCI pages Tim's HCI notes

GUI Programming Concepts in Java Java GUI has components Windows GUI has controls Unix GUI has widgets examples: labels, buttons, check boxes, radio buttons, text input boxes, pull down lists Swing components: JLabel, JButton, JCheckBox, JRadioButton, JTextField, JTextArea, JComboBox

Java GUI history: the AWT AWT(JDK 1.0, 1.1): Abstract Window Toolkit package: java.awt, java.awt.event heavyweight components using native GUI system elements used for applets until most browsers supported JRE 1.2

lightweight components that do not rely on the native GUI or OS Swing in Java Swing(Java 2, JDK 1.2+) lightweight components that do not rely on the native GUI or OS “look and feel” of Swing components are identical on different platforms can be customized Swing inherits from AWT AWT still used for events, layouts

Swing Components in Java advanced GUI support. e.g. drag-and-drop package names: javax.swing, javax.swing.event components inherit from JComponent components are added to a top-level container: JFrame, JDialog, or JApplet.