1 / 53

BIS305: Advanced Business Programming Introduction

BIS305: Advanced Business Programming Introduction. Toru Sakaguchi, Ph.D. Chapter 1: Introduction. Introduction to Programming the .NET Framework. Introduction to Software Development. The software development life cycle consists of a sequence of well-defined steps Problem identification

guri
Download Presentation

BIS305: Advanced Business Programming Introduction

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. BIS305: Advanced Business ProgrammingIntroduction Toru Sakaguchi, Ph.D.

  2. Chapter 1: Introduction • Introduction to Programming • the .NET Framework

  3. Introduction to Software Development • The software development life cycle consists of a sequence of well-defined steps • Problem identification • System design • System implementation • System documentation • System testing • System deployment • Postimplementation audit

  4. System Analysis Methodologies • Pseudocode uses English-like statements to depict an application’s actions • Top-down design (HIPO chart) is used to subdivide general tasks into more specific tasks • Flowcharting uses graphical symbols to depict an application’s actions • The Unified Modeling Language (UML) supplies several graphical templates to model a system

  5. The Evolution of Programming Languages • Programming languages can be categorized into four generations • Machine languages (1st generation) • Assembly languages (2nd generation) • Machine independent languages (3rd generation) • Natural languages (4th generation)

  6. Figure 1-14: Relationship Between Assembly Language and Machine Language

  7. Figure 1-15: Compiling Third-generation Programs

  8. Compiling a .NET Program • Visual Studio compiles a program into machine independent assembly language called intermediatelanguage (IL) • IL gets translated into executable code using the just-in-time compiler (JIT) • The process is automatic

  9. Introduction to Object-oriented Programming • Hardware costs are falling but software development costs are rising • Software systems are becoming increasingly complex • Object-oriented programming attempts to reduce software costs through code reuse

  10. Characteristics of Object-oriented Programming • Objects are created from classes • A class is a template or blueprint for an object • A class describes the data stored in the class and the actions performed by the class • Multiple objects can be created from the same class

  11. Figure 1-17: Relationship Between a Class and Objects Created From the Class

  12. Characteristics of Object-oriented Programming Languages • Encapsulation: Data and processes are coupled together • Inheritance: A new class can be created from an existing class • Informationhiding: Some information is hidden in a class while other information is exposed to the developers using the class • Polymorphism: members have multiple forms

  13. The Visual Studio Implementation of Object-oriented Programming • The interface of a class is the formal specification of the data stored in the class and the actions supported by the class • Objects are created from a class by calling a constructor • Data items stored in a class are called properties • Actions performed by a class are called methods • A class can have events • Statements in an event handler execute in response to an event

  14. Procedural and Event-driven Programming Languages • In a procedurallanguage, the sequence of activities can be predicted by the application • In an event-drivenlanguage, the execution path of the application is based on the various events that fire • Users and the system itself can cause events to fire • It's impossible to predict exactly when an event will fire

  15. Figure 1-18: Event Processing Loop

  16. Figure 1-19: Operation of a Procedural Application

  17. The Syntax of Programming Languages • The rules of a programming language are called syntax • Each programming language has its own syntax • C# and Visual Basic have a different syntax, for example • Syntax rules are absolute • Statements with incorrect syntax are considered syntaxerrors

  18. Types of Programming Statements • A statement expresses a complete thought or action • Statements can be categorized into two types • Declaration statements are used to create variables and define the structure of an application • Executable statements perform an action while a program is running

  19. Types of Programming Statements (Example) Module Hello Sub Main() System.Console.WriteLine("Hello World") End Sub End Module Executable statement

  20. Reserved Words and Operators • Language keywords are called reserved words • Every programming language has a set of reserved words • Reserved words differ from programming language to programming language • Module and Sub are Visual Basic reserved words, for example • + and – are the Visual Basic operators for addition and subtraction

  21. Identifiers and Their Names • The term identifier describes the name of a programming element • Identifier names must • Begin with a letter • Only contain alphabetic characters, digits, or the underscore character • Have a maximum length of 1023 characters

  22. The Structure of a Visual Basic Application • Every program has a well-defined structure • Visual Basic is a block structured language • The outermost block is the Namespace block • Namespace blocks contain Module blocks • Module blocks contain Sub procedure blocks • Procedure blocks contain declaration and executable statements

  23. Namespace Blocks • Conceptually, Namespace blocks are similar to file folders • An application can contain one or many Namespace blocks • Every namespace has an identifier (name) • A Namespace block is marked by the Namespace and EndNamespace keywords

  24. Namespace Block (Example) • Declare a namespace named Chapter01: Namespace Chapter01 End Namespace

  25. The Contents of a Namespace • A Namespace block can contain • Class blocks • Structure blocks • Module blocks • Interface blocks

  26. Introduction to Module Bocks • A Namespace block can contain one or more Module blocks • A Module block begins with the Module statement • A Module block ends with the EndModule keywords • Module blocks cannot be nested

  27. Module Block (Example) • The Namespace block named Chapter01 contains a Module block named Hello Namespace Chapter01 Module Hello End Module End Namespace

  28. Introduction to Procedure Blocks • A Module block can contain one or many Procedure blocks • Procedure blocks cannot be nested • Procedure blocks contain declaration and executable statements • The Sub and EndSub statements mark the beginning and end of a procedure

  29. Procedure Block (Example) • The Namespace named Chapter01 contains a Module block named Hello with a Sub procedure block named Main() Namespace Chapter01 Module Hello Sub Main() End Sub End Module End Namespace

  30. Figure 1-20: Organization of a Namespace, Module, and Procedure

  31. Writing Executable Statements • Executable statements can be used to call (execute) a procedure • Executable statements can be used to make decisions and execute loops • Assignment statements are executable statements

  32. Calling a .NET Framework Class Library Method • The .NET Framework supplies general services used by all applications • The Console class has methods used to read input and to write output • The SystemInformation class gets information about the local computer

  33. Organization of the .NET Framework Class Library • The .NET Framework class library is made up of several disk files called libraries • Physical library files are called assemblies • Physical assemblies contain one or more logical namespaces • Namespaces are organized hierarchically • Namespaces contain classes and other types

  34. Common Namespaces • System defines the primary data types • System.Data contains classes used to work with databases • System.Drawing supplies graphics functionality • System.Windows.Forms contains classes to create visual forms • System.XML contains classes to work with the XML language

  35. Figure 1-21: Categorization of Types That Make Up the .NET Framework Class Library

  36. Referencing Namespaces and Classes • A period separates a namespace name and a class name • Reference the Console class of the System namespace System.Console • Call the WriteLine method of the System.Console class System.Console.WriteLine()

  37. Method Arguments • Methods accept 0, one, or many arguments • Arguments are used to send data to a method • Arguments appear as a comma separated list • The list appears in parenthesis • Example to display the text "Hello World”: System.Console.WriteLine("Hello World")

  38. Continuation Lines • Complicated statements might not fit on one line • Use the continuation character to split a statement across multiple lines • The continuation character is the underscore (_) • The continuation character must appear at the end of a line • A space must precede the continuation character • The continuation character cannot break up words

  39. Continuation Lines (Example) • The following statement appears on two lines: System.Console.WriteLine( _ "Hello World")

  40. Methods of the System.Console Class • The Read method reads one character from the console • The ReadLine method reads a line from the console • The Write method writes a character or characters to the console • The WriteLine method writes a character or characters, followed by a carriage return, to the console

  41. The SystemInformationClass • The SystemInformation class gets information about the system • The ComputerName property gets the name of the computer • The MouseButtons property gets information about the mouse • The MouseWheelPresent property indicates whether the mouse has a mouse wheel • The Network property indicates whether the computer is connected to a network • The UserName property returns the name of the current user

  42. Using a Command Prompt Window • The Command Prompt window is used to execute commands and compile programs • Type a command and press Enter to execute the command • The Command Prompt window can be used to navigate through the Windows file system

  43. Figure 1-22:Command Prompt window

  44. The Windows File System • A path defines the hierarchical location of a directory within the Windows file system • Path references are of two types • Absolute paths begin with a drive designator and a leading backslash C:\CourseTechnology\Chapter01 • Relative paths begin with a period (.) to denote the current directory and two periods (..) to denote the parent directory of the current directory ..\Data.Chapter01 .\Chapter01

  45. Windows Navigation Commands • DIR lists the files and directories in the current directory • CD changes directories • RENAME changes the name of a file or directory • DEL deletes a file • There are many other commands and command options

  46. Windows Navigation Commands (Examples) • Display the contents of the current directory DIR • Change the current directory to the root directory on the current drive CD \ • Rename FileOld to FileNew RENAME FileOld FileNew • Delete FileNew DEL FileNew

  47. Compiling and Executing a Visual Basic Application • Visual Basic programs are compiled into intermediate language (IL) • IL code is translated into an executable form using the JIT compiler • The JIT compiler is called automatically when an application is run • The Visual Basic compiler is named vbc.exe

  48. Figure 1-23: Translation of .NET Source Code to Executable Code

  49. Calling the Visual Basic Compiler • The compiler is called with directives that define how the application is compiled • /main specifies the module containing the entry point • /out specifies the name of the executable file • /verbose causes the compiler to display informational messages

  50. Calling the Visual BasicCompiler (Example) • Compile the Visual Basic file named Hello.vb to produce an executable file named Hello.exe • The Main procedure appears in the Namespace and Module named Chapter01.Hello vbc /main:Chapter01.Hello /out:Hello.exe Hello.vb

More Related