1 / 26

F21SF Software Engineering Foundations

Dept of Computer Science. F21SF Software Engineering Foundations. Look Beyond the course. Monica Farrow EM G30 email : M.Farrow@hw.ac.uk Material available on Vision. Topics. Other java applications A look ahead to the Advanced Software Engineering course. OTHER JAVA

quilla
Télécharger la présentation

F21SF Software Engineering Foundations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dept of Computer Science F21SFSoftware Engineering Foundations Look Beyond the course Monica Farrow EM G30 email : M.Farrow@hw.ac.uk Material available on Vision SJF L19 Final

  2. Topics • Other java applications • A look ahead to the Advanced Software Engineering course SJF L19 Final

  3. OTHER JAVA APPLICATIONS SJF L19 Final

  4. Java is multi-platform JVM : Java Virtual Machine : a system program that runs on any platform and translates byte code into machine-language instructions for that platform Source code (.java file) Java Compiler Byte code for the JVM (.class file) Interpreted for a Mac Interpreted for PC Interpreted for Sun Executable Instructions for Sun Executable Instructions for a Mac Executable Instructions for PC SJF L19 Final

  5. APPLETS • Are java programs which are run inside a web browser • Use multi-platform feature of java • The code is stored on a web server and downloaded into the browser whenever you access a web page that contains the applet • The program does not have to be stored on your machine • Can be slow to run over a slow network connection • Writing an applet is VERY similar to writing a GUI application, with a few differences SJF L19 Final

  6. JAVA WEBSTART • Java WebStart, which enables you to download a java application over the web and run it independently of the browser • Good on a network within a department, where everyone has an up-to-date browser • Will not work on older browsers • The client machine needs the java runtime environment installed • The application is cached locally, then every time it is launched over the web, the existing version is used unless it has been updated, when the newer version is automatically downloaded • Example = ARGOUML SJF L19 Final

  7. Security issues (applets and webstart) • Because the application may be using facilities e.g. files on your local machine, you must decide whether or not you trust it • The application must have been signed and has a certificate • The first time that you run it, you are warned that it is requesting unrestricted access to your local machine and network SJF L19 Final

  8. Java Application connecting to a Database • There are java classes to enable you to • connect to a database • run SQL queries to extract the data • update the data using SQL • ‘update’ means any sort of alteration • Use JFrames for the user interface • The java application is on your machine (or your workspace) • The database is somewhere in the local network • E.g an Access or an Oracle database SJF L19 Final

  9. Servlets • ‘Middleware’ written in java • The code is on the server, not on your machine • Doesn’t have to be local, anywhere on the internet is ok • Also can connect to a database • Can get the user’s response from html forms • E.g. list the contents of a database table • Can generate dynamic html (depending on the user’s response) • E.g. display the contents of a database table • More in Network Applications • Servlets are complex, and there are simpler languages • JSP is simpler middleware based on servlets SJF L19 Final

  10. Servlet SJF L19 Final

  11. The Three Main Java Editions • Java™ 2 Platform, Micro Edition (J2ME™) • “The Java Platform for consumer and embedded devices such as mobile phones, PDAs, TV set-top boxes, in-vehicle telematics systems and a broad range of embedded devices” • Java™ 2 Platform, Standard Edition (J2SE™) • The one you are used to using • Java™ 2 Platform, Enterprise Edition (J2EE™) • For developing multi-tier enterprise applications • Plus • Javacard for smart cards • Java-fx for creating rich media and interactive content SJF L19 Final

  12. Java Overview SJF L19 Final

  13. Java SE platform SJF L19 Final

  14. Some J2SE APIs • Remote Method Interface • for building distributed application – i.e. ones which run on a network of communicating computers • Java Beans • a standard structure for classes (e.g. including get and set methods) which allow them easily to be plugged together • Threads • enabling a program to split off into a number of inter-communicating processes • Java Collections Framework • for managing different kinds of multi-valued objects – not just arrays, but also lists, sets, trees, etc. • Lots More Swing • Tables, Trees, etc. • Text Framework – documents with style, HTML renderers (i.e. browsers) SJF L19 Final

  15. Some of the J2EE APIs • JDBC (JavaDataBaseConnectivity) and new JDO (Java Data Objects) • Connecting to a database • Servlets and JSP (Java Server Pages) • Server side programs for dynamic web applications • Java Messaging Service • For building systems which send messages to people (point-to-point) or for publishing messages for people to find (publish-and-subscribe) • JavaMail • For building e-mail systems • JNDI - Java Naming and Directory Interface • For unifying access to various kinds of data storage which can be made to look like folders with files and other folders in them • Java for XML Processing SJF L19 Final

  16. Advanced Software Engineering Data Structures and the Java Collections Framework Methodologies Patterns Threads Testing SJF L19 Final

  17. Some data structures • A collection holds the data in a data structure • Different structures are used for different purposes. E.g. • List : arbitrary numbers of objects in order • E.g. A record of songs played by a jukebox • Set : arbitrary numbers of unique objects • E.g. which items chosen in jukebox, omitting repeated choices • Map : arbitrary numbers of objects accessed through unique key • E.g. all the items that are available for playing, stored by (title and artist) SJF L19 Final

  18. Methodologies • ? Is it better to completely plan the whole system before starting to code • Requirements • Classes and methods • Design, Implement, Test, Evaluate • ? Or to develop the system incrementally, using prototyping • => Learn about methodologies, try them out in a group project, write about it SJF L19 Final

  19. JUnit tests • Automated unit testing of Java objects • Write code to test each method • Separates tests from production code • Can be run individually or altogether • Run whenever a change is made to the code • IDEs such as Eclipse support JUnit tests. You can generate skeleton code, and select tests for running. SJF L19 Final

  20. Packages • A package is a set of related java classes • java library classes such as java.util, java.io • An application you have written yourself for general use will be in a package • If you don’t declare a package, it is considered to be in a ‘default’ package. • Classes that you have written that can be used in more than one application should be placed in a package eg. myUsefulClasses • Your JUnit tests should be in a separate package SJF L19 Final

  21. Publishing your program • To deliver your java program to a customer, you only need the .class files. • The .class files can be combined and compressed into a single jar file • A batch file can be created to run the java command which runs the jar file • Creating a shortcut to the batch file means that you can double click on the shortcut to run the java program SJF L19 Final

  22. What is a pattern? • Here are several definitions of a design pattern: • A general solution to a common problem in software design (not implementation) • Best practices of experienced object-oriented software developers • Descriptions of communicating objects and classes that are customised to solve a general design problem in a particular context • This means a pattern can never be transformed directly into code. It needs to be tailored to a specific problem • Some patterns are introduced in Advanced Software Engineering SJF L19 Final

  23. Iterator in java • Here is a way of iterating through a list: ArrayList<MyElement> myCollection = new ArrayList <MyElement> (); . . . //create an iterator Iterator it = myCollection.iterator(); while (it.hasNext()) { //get next element MyElement element = it.next(); //do some processing with this element element.doMethod(); } SJF L19 Final

  24. ITERATOR PATTERN • Java is using the Iterator Pattern • This pattern allows us to access the elements of an aggregate object in a sequential manner, without exposing the underlying representation. • The original pattern defined methods for createIterator, first, next, isDone and currentItem. • Implementations in the java collections framework use iterator(),hasNext(), next() and remove() SJF L19 Final

  25. THREADS • So far, your programs have consisted of a sequence of instructions which are done one after another. • In java, it is possible to allow multiple operations to happen concurrently (at the same time) • Well, apparently at the same time. • Specify separate threads of execution • Enable multi-threading • Example of concurrency • Playback of audio file while still being downloaded SJF L19 Final

  26. F21AS Assessment • Coursework • Advanced Software Engineering is assessed by 50% coursework, 50% exam • Coursework is group project (groups of 3) • Creating an application • PLUS studying how to create an application SJF L19 Final

More Related