St. Ambrose CSCI 275 - Programming with Supplied Classes

Unformatted text preview:

Chapter 4Things you should KnowSome General CommentsUsing the Namespaces and Classes Supplied with VB .NETUsing the String ClassUsing String MethodsStringsOther String MethodsUsing the ArrayList ClassUsing the ArrayList ClassSlide 11Displaying a FormChapter 5Need to knowExploring OOA and OODSlide 16Slide 17Slide 18Understanding the Unified Modeling LanguageUse Case DiagramUse Case DiagramCreating and Interpreting the Use Case DiagramCreating and Interpreting the Class DiagramCreating and Interpreting the Class DiagramSlide 25Slide 26Creating and Interpreting a Sequence DiagramSlide 28Creating and Interpreting a Sequence DiagramSlide 30Using Three-Tier Design in OO DevelopmentSlide 3211Chapter 4VB .NET Programming with Supplied Classes22Things you should KnowNamespaces and classes supplied with VB .NETDefinitionString classArrayList classWorking with datesFormatting outputUse the MessageBox classDisplaying a Form33Some General CommentsUse Naming ConventionAn integer variable – intNumberOfYearsA Button object – btnExitVariables should be defined at the top of a moduleWriteLine vs Write methodsAnother loop structure For EachAdding a Reference44Using the Namespaces and Classes Supplied with VB .NET .NET class library: predefined classes and their methods, organized into namespacesNamespace: group of related classesKeyword Imports: gives compiler access to classes contained in specific namespaces55Using the String Class String: collection of charactersstring data is an instances of String classString are immutableEach character in a String instance has an index Index values begin with zeroString has special method property makes the method look like an attribute66Using String Methods Copy method returns a second String that is a copy of the String sent as an argument s1 = “Hello World”' create a copy of s1Dim s2 As String = String.Copy(s1)77Stringss2 = String.Copy(s1) s1 s2s2 = s1s1s2Primitive vs Reference variables88Other String Methods Pg 130 – 132Chars returns a characterCopy returns a StringEndsWith / StartsWith returns a BooleanEquals returns a BooleanIndexOf returns a IntegerInsert returns a StringReplace returns a StringSplit returns a StringArraySubString returns a StringToUpper / ToLower returns a String99Using the ArrayList Class Major limitation of arrays: fixed sizeArrayList classMember of System.Collections namespaceCreates dynamically resizable array – the number of elements can change during runtime1010Using the ArrayList ClassCode to create an instance of ArrayList class:' create an ArrayList instance with 3 elementsDim anArrayList As ArrayList = New ArrayList(3)1111Using the ArrayList ClassAdd method is used to populate the elementsWhen a fourth element is added, the number of elements increases automaticallyanArrayList.Add(s1)anArrayList.Add(s2)anArrayList.Add(s3)anArrayList.Add(s4)1212Displaying a Form FormA class in System.Windows.Forms namespaceGuiModule.vb module contains instructions toInstantiate GuiForm.vb FormMake it visible and invisibleSet Visible property orUse Show/Hide methodsGuiForm.vbA subclass of FormInherits Form attributes and methods1313Chapter 5Object-Oriented Analysis and Design1414Need to knowOOA vs OODAnalysis defines WHAT functions a system must provideDesign defines HOW to accomplish the functionsBasics of Unified Modeling Language (UML)OOA – develop logical modelsOOD – develop physical modelsThe three-tier approach to design PresentationProblem Domain / Business RulesData Access1515Exploring OOA and OODOO development modelsDefine classes of objectsDepict object interactionsAre based on UMLIncludeUse case diagramsClass diagramsSequence diagrams1616Exploring OOA and OODOO development works well with an iterative approach to developmentIterative developmentAnalysis, design, and programming are performed in parallel, with the process repeated several times until the project is doneContrasts with the waterfall methodAn earlier approachAll of analysis was completed before design could start, and all of design was completed before programming could start1717Exploring OOA and OODOO development also uses incremental developmentSome of the system is completed and put into operation before the entire system is finished1818Exploring OOA and OODSpiral modelAn increasingly popular approach to developmentEmphasizes the iterative nature of developmentProject appears as a spiral starting in the middle and working its way outDevelopment team completes analysis, design, prototyping, and evaluation tasks for each iteration, starting in the middle of spiral1919Understanding the Unified Modeling Language Object-oriented development requires a collection of models that depict system requirements and designsUML defines a standard set of constructs and diagrams to model OO systems Common analysis and design modeling languageUp to 1996 there was no such thing2020Use Case Diagram Defines the main system functionsA use case diagram shows two key concepts: Use case: a system functionActor: person or entity using the system2121Use Case Diagram2222Creating and Interpreting the Use Case DiagramIdentify use cases by the event s the system must respond toThree types of events can affect a system: External eventsTemporal eventsState eventDocumented as a series of steps users followScenarios: variations in the main steps2323Creating and Interpreting the Class Diagram Class diagramShows the classes involved in the systemIs a rectangle with three sectionsTop section contains name of the classMiddle section contains attributes of the classBottom section contains methods of the class2424Creating and Interpreting the Class Diagram2525Creating and Interpreting the Class DiagramClass DiagramAssociation relationship between two classes is shown with a line connecting the two classesNumber of associations between classes is written on each end of the lineUML refers to the number of associations as multiplicity2626Creating and Interpreting the Class DiagramClass DiagramShows generalization/specialization hierarchies (inheritance)Abstract classes shown in italicsObjects cannot be created for an abstract classOnly serves


View Full Document

St. Ambrose CSCI 275 - Programming with Supplied Classes

Download Programming with Supplied Classes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Programming with Supplied Classes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Programming with Supplied Classes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?