Introduction to Input and Output. Layers (or Tiers) of an Application  Software in the real world normally takes the form of a number of independent.

Slides:



Advertisements
Similar presentations
Lectures on File Management
Advertisements

 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Operating-System Structures
Function Point Analysis example. Function point FP is defined as one end-user business function FPA evaluates the system from a user perspective.
Files & Streams. Files Introduction Files are used for long-term retention of large amounts of data, even after the program that created the data terminates.
Chapter 12 ATM Case Study, Part 1: Object-Oriented Design with the UML
1 Lecture 31 Handling Selected Topics Again!! File I/O Special Lectures.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.
2: OS Structures 1 Jerry Breecher OPERATING SYSTEMS STRUCTURES.
11 3 / 12 CHAPTER Databases MIS105 Lec14 Irfan Ahmed Ilyas.
Slides prepared by Rose Williams, Binghamton University Chapter 10 File I/O.
Part two. 3.2 operating system architecture  Software have two categories  Application software  System software  Application software: consists of.
Database Management Systems (DBMS)
Introduction - The Need for Data Structures Data structures organize data –This gives more efficient programs. More powerful computers encourage more complex.
Systems Software Operating Systems.
2. I/O Text Files CCSA225 - Advanced Java Programming Sarah Alodan
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Section 2.1 Identify hardware Describe processing components Compare and contrast input and output devices Compare and contrast storage devices Section.
Operating system Part two Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Files and Streams 1 -Based on slides from Deitel & Associates, Inc. - Revised by T. A. Yang.
RjpSystem Level Programming Operating Systems 1 Having fun withy the Unix Operating System Praxis Week 7 Rob Pooley.
SYSTEM SOFTWARE Prepared by: Mrs. Careene McCallum-Rodney.
Software Writer:-Rashedul Hasan Editor:- Jasim Uddin.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Faculty of Computer & Information Software Engineering Third year
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Systems Software Operating Systems. What is software? Software is the term that we use for all the programs and data that we use with a computer system.
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
The Client/Server Database Environment Ployphan Sornsuwit KPRU Ref.
Personal Computer - Stand- Alone Database  Database (or files) reside on a PC - on the hard disk.  Applications run on the same PC and directly access.
Faculty of Computer & Information
Operating Systems COMP 4850/CISG 5550 File Systems Files Dr. James Money.
Buffers Let’s go for a swim. Buffers A buffer is simply a collection of bytes A buffer is simply a collection of bytes – a char[] if you will. Any information.
Chapter 9 I/O Streams and Data Files
20 Oct - Overview Homework #1 Group-Id rule Notes on Java text file input/output –Scanner class –Printf (like C)
Higher Systems Computer Software. Operating System (O/S) ► The O/S controls the computer. It controls communication with peripheral devices. It loads.
The Functions of Operating Systems Desktop PC Operating Systems.
Lesson Overview 3.1 Components of the DBMS 3.1 Components of the DBMS 3.2 Components of The Database Application 3.2 Components of The Database Application.
Chapter 4 Introduction to Classes, Objects, Methods and strings
1 Software. 2 What is software ► Software is the term that we use for all the programs and data on a computer system. ► Two types of software ► Program.
 Pearson Education, Inc. All rights reserved Files and Streams.
CIS 234: File Input & Output introduction. Data Storage Is Fundamental computers need to store data to work with it memory (RAM) is fast but transient.
File Systems cs550 Operating Systems David Monismith.
Chapter 2. System Structures
Systems Software. Systems software Applications software such as word processing, spreadsheet or graphics packages Operating systems software to control.
Field Trip #34 Creating and Reading Zip Files in Java By Keith Lynn.
File Input & Output1 Streams & File I/O. Introduction (1) The Java platform includes a number of packages that are concerned with the movement of data.
Java Programming, Second Edition Chapter Sixteen File Input and Output.
1 Object-Oriented Static Modeling of the Banking System - III Lecture # 33.
 Project Team: Suzana Vaserman David Fleish Moran Zafir Tzvika Stein  Academic adviser: Dr. Mayer Goldberg  Technical adviser: Mr. Guy Wiener.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Coupling and Cohesion Schach, S, R. Object-Oriented and Classical Software Engineering. McGraw-Hill, 2002.
Comp1004: Introduction III Java. Content How Java Works: The JVM Writing a Class in Java – Class – Member Variables – Method – Statement Magic incantations.
1 Classes. 2 Class use Classes have so far been used in 1 of 2 ways 1.An object has been created from a class myClass myObject = new myClass(); 2.An existing.
AS Level Computing 8 CHAPTER: Fundamentals of structured programming The basics of good programming Algorithms System Flow Charts Symbol Conventions Steps.
Section 2.1 Section 2.2 Identify hardware
Unit 2 Technology Systems
3 Introduction to Classes and Objects.
INFORMATION RETRIEVAL AND KNOWLEDGE MANAGEMENT SYSTEM
Chapter 2: System Structures
The Client/Server Database Environment
Introduction to Operating System (OS)
I/O Basics.
Topics Introduction to File Input and Output
MSIS 670: Object-Oriented Software Engineering
Files & Streams.
Chapter-1 Computer is an advanced electronic device that takes raw data as an input from the user and processes it under the control of a set of instructions.
Topics Introduction to File Input and Output
Presentation transcript:

Introduction to Input and Output

Layers (or Tiers) of an Application  Software in the real world normally takes the form of a number of independent classes, like lego blocks, that can be stuck together in whatever form the designer wishes.  Programmers thus write sections or components of a solution and put them together as they go along.

Layers (or Tiers) of an Application  The structure, where a solution is made out of connected classes, is called a layered or tiered approach.  Distinct parts of a solution are organized into distinct groups and these are then put together to form layers.  There are usually 3 distinct layers –The user interface –The logic layer –The data layer

Layer/ Tiers  There are usually three distinct layers: –The user interface layer is intended to contain all the statements necessary to supply information to and obtain information from the user. The user interface layer may not necessarily process the information or store that information, for these functions it can pass the information to an application layer. –The application layer, sometimes called the business logic or logic layer, is usually responsible for managing the information and performing operations on it, for example retrieving information, computing results, applying rules. – The data layers responsibility is to store or retrieve the data on disk, in memory or in a database.

Tier Example - Bank  For example imagine that you were asked to write an Information System for a bank.  The structure for a bank : you meet the teller when you go in the door, they take your particular request and then defer to a manager. The manager then looks up your file to see if you can be granted your request, passes their decision to the teller who will notify you.

Tier Example - Bank  To computerise this would require a User Interface to the system that the tellers could use to create new accounts and to lodge and withdraw money from accounts. This User Interface would use another part of the program which would manage accounts. The layer which manages accounts would effectively replace the manager and therefore carries out business logic. Account information could be stored as objects in the data layer.  Therefore we have three distinct sections for our problem, a Graphical User Interface layer, a Business Logic layer and a Data layer.

Bank Layer nameFunction of this layer GUITo allow the user to input and view information. Specifically: - Create a new account - Lodge money - Withdraw money - Check balance Business Logic/ ApplicationTo receive requests from the GUI and to pass it back the result of those requests. Operations to handle: - Create a new account: Search for an existing account with the same name, if it exists deny request. If number of accounts created exceeds a preset limit deny creation request. - Lodge money: Search to see if the named account exists, if so add the amount supplied to the balance of account and return the new balance, return a message otherwise. - Withdraw money: Search to see if the named account exists, if it does deduct a supplied amount from the account provided there is sufficient funds to meet the withdrawal and return the new balance, refuse withdrawal otherwise. Data / DatabaseHold account name and balance of that account. Operations to handle: - Create new record - Get record information - Store information

Developing Layers  Each layer must be debugged before use  Layers should be as independent as possible

Layers Enter Data Login User Handle data input DataBaseAccount Manager GUI Logic Data Account Object

Scenario  We want to write a file to maintain an array of person objects.  The user can add to, delete from or modify Person objects in the array.  To make this practical, we must save data to a file  If data was saved to a file then the program can read them back from the file and rebuild the array

File I/O  The most basic of Input/Output with Java is done with streams.  Think of a stream as a flow of data, which can be an input stream or an output steam  The stream commands enable you to write to a disk or to the output screen.

File I/O  A common term in programming is persistence.  How can you make data persist, or still be available, from one run of a program to the next?  You have 2 main choices- –Write/Read from files –Write/Read from database

File I/O  No matter where the data is coming from or going to and no matter what type its type, the mechanism for sequentially reading and writing data are basically the same. READINGWRITING open a stream while more information read information read information write information write information close the stream

File and FileDialog Objects  Suppose we want to read the contents of a file sample.data. Before we begin the actual operation of reading data from this file, we must create a File object (from the java.io package) and associate it to the file.  We call the File constructor –File inFile = new File (“sample.data”); –File inFile = new File (“c:\\JavaProjects”, “xyz.data”);

File and FileDialog  A file MUST be opened before performing any file access operation.  Since the user can select a file from a directory different from the current directory, we should use directoryPath in creating a file object File inFile = new File (directoryPath, filename);

Streams  A Stream is simply a sequence of data items, usually eight-bit bytes.  Java has 2 types of streams 1.An input stream 2.An output stream  An input stream has a source from where the data items come and an output stream has a destination to where the data items are going.  To read/write data items from/to a file, we attach one of the Java input/output stream objects to the file.  The basic classes for Java I/0 are FileInputStream and FileOutputStream