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 KnowNamespaces and classes supplied with VB .NETDefinitionString classArrayList classWorking with datesFormatting outputUse the MessageBox classDisplaying a Form33Some General CommentsUse Naming ConventionAn integer variable – intNumberOfYearsA Button object – btnExitVariables should be defined at the top of a moduleWriteLine vs Write methodsAnother loop structure For EachAdding a Reference44Using the Namespaces and Classes Supplied with VB .NET .NET class library: predefined classes and their methods, organized into namespacesNamespace: group of related classesKeyword Imports: gives compiler access to classes contained in specific namespaces55Using the String Class String: collection of charactersstring data is an instances of String classString are immutableEach character in a String instance has an index Index values begin with zeroString 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 – 132Chars returns a characterCopy returns a StringEndsWith / StartsWith returns a BooleanEquals returns a BooleanIndexOf returns a IntegerInsert returns a StringReplace returns a StringSplit returns a StringArraySubString returns a StringToUpper / ToLower returns a String99Using the ArrayList Class Major limitation of arrays: fixed sizeArrayList classMember of System.Collections namespaceCreates dynamically resizable array – the number of elements can change during runtime1010Using the ArrayList ClassCode to create an instance of ArrayList class:' create an ArrayList instance with 3 elementsDim anArrayList As ArrayList = New ArrayList(3)1111Using the ArrayList ClassAdd method is used to populate the elementsWhen 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 FormA class in System.Windows.Forms namespaceGuiModule.vb module contains instructions toInstantiate GuiForm.vb FormMake it visible and invisibleSet Visible property orUse Show/Hide methodsGuiForm.vbA subclass of FormInherits Form attributes and methods1313Chapter 5Object-Oriented Analysis and Design1414Need to knowOOA vs OODAnalysis defines WHAT functions a system must provideDesign defines HOW to accomplish the functionsBasics of Unified Modeling Language (UML)OOA – develop logical modelsOOD – develop physical modelsThe three-tier approach to design PresentationProblem Domain / Business RulesData Access1515Exploring OOA and OODOO development modelsDefine classes of objectsDepict object interactionsAre based on UMLIncludeUse case diagramsClass diagramsSequence diagrams1616Exploring OOA and OODOO development works well with an iterative approach to developmentIterative developmentAnalysis, design, and programming are performed in parallel, with the process repeated several times until the project is doneContrasts with the waterfall methodAn earlier approachAll of analysis was completed before design could start, and all of design was completed before programming could start1717Exploring OOA and OODOO development also uses incremental developmentSome of the system is completed and put into operation before the entire system is finished1818Exploring OOA and OODSpiral modelAn increasingly popular approach to developmentEmphasizes the iterative nature of developmentProject appears as a spiral starting in the middle and working its way outDevelopment 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 designsUML defines a standard set of constructs and diagrams to model OO systems Common analysis and design modeling languageUp to 1996 there was no such thing2020Use Case Diagram Defines the main system functionsA use case diagram shows two key concepts: Use case: a system functionActor: person or entity using the system2121Use Case Diagram2222Creating and Interpreting the Use Case DiagramIdentify use cases by the event s the system must respond toThree types of events can affect a system: External eventsTemporal eventsState eventDocumented as a series of steps users followScenarios: variations in the main steps2323Creating and Interpreting the Class Diagram Class diagramShows the classes involved in the systemIs a rectangle with three sectionsTop section contains name of the classMiddle section contains attributes of the classBottom section contains methods of the class2424Creating and Interpreting the Class Diagram2525Creating and Interpreting the Class DiagramClass DiagramAssociation relationship between two classes is shown with a line connecting the two classesNumber of associations between classes is written on each end of the lineUML refers to the number of associations as multiplicity2626Creating and Interpreting the Class DiagramClass DiagramShows generalization/specialization hierarchies (inheritance)Abstract classes shown in italicsObjects cannot be created for an abstract classOnly serves
View Full Document