2014-2015
Lecture 1 Introduction Phil Smith
Learning Outcomes LO1 Understand the principles of object oriented programming LO2 Be able to design object oriented programming solutions LO3 Be able to implement object oriented programming solutions LO4 Be able to test and document object oriented programming solutions.
Learning Outcomes LO1 LO1 Understand the principles of object oriented programming 1.1 discuss the principles, characteristics and features of objected oriented programming.
Learning Outcomes LO1 LO1 Understand the principles of object oriented programming 1.1 discuss the principles, characteristics and features of objected oriented programming.
Assignments 3 summative assignments Each has a formative feedback before submission. The submission MUST be your OWN work, MUST be spelt correctly and MUST use good grammar and punctuation. All diagrams must have captions and be referred to in your narrative. Harvard referencing must also be used (see wiki).
Structure 1.5 hours of lectures approx. 1.5 hour of tutorial/lab (approx.), Lab work will mostly be in small groups. Additional independent study.
Resources Lectures. Books (in lab). Books in LRC. Internet, you have internet access. Periodicals etc.
Environment Programming Language: C# Use Visual studio 201x? Why? 1. Popular language. 2. Designed for OOP. 3. Built with OOP. 4. Strongly typed (more stable code?)
Environment this unit is not about the language, this is just syntax. It is about (learning outcomes again) OOP. You already have programming knowledge. We will have to get used to C# syntax. C# is case sensitive and explicit in its nature (by design). C# is built upon the Microsoft.net framework.
.NET Framework The.NET Framework is A software development environment A runtime engine for Managed Code A platform designed for Internet- Distributed software The.NET Framework is an exciting computing platform
.NET Framework Microsoft s vision to introduce an improved programming experience Installed on Windows Operating Systems A software development environment A runtime engine for Managed Code
Architecture Common Language Infrastructure (CLI).NET libraries are provided as a language-neutral platform Common Language Runtime A runtime provides services from the operating system and hardware The CLR Provides: Memory management Thread management Exception handling Garbage collection Security The CLR allows users to ignore specifics for the CPU and get on with programming the task
.NET Platform Architecture
C# Language Why C# ( more) Uses.NET framework Works with common editors Intuitive syntax Powerful features Close syntax to Java
Visual Studio Development tool for the programmer Includes Graphical User Interface (GUI) code editor supporting IntelliSense Syntax building GUI applications web designer class designer database schema designer
Visual Studio Cost Download free version Search for Visual Studio Express 2014 Download C# version 30 days free trial register to continue usage Or make use of DreamSpark Version
Properties Load Visual Studio Menus Toolbox Code Area Solution Explorer Messages Area
Create a Simple Project File -> New Give the project a name
Solution Explorer Displays all projects in solution Shows all files in project Files organisation Project references
Resources Files.resx Efficient and secure method of storing objects within application Images (PNG, BMP, GIF, JPEG, TIFF) Audio Text Strings Icons Access resources programmatically
Window Docking Floating Dockable Tabbed Document Auto hide Hide
Project Properties
Building Projects Build project (F6) Complies code for platform Creates executable file File locations EXE file
Visual Studio Help
Forms A Form is for the creation of a Graphical User Interface Provides user interaction with the code Positioning of user controls A program can have one or more forms Forms can be various sizes
Form Controls and Properties Form Controls include Buttons Textboxes Radio buttons Check boxes Labels Sliders Tabs List boxes
Form Controls and Properties Properties All controls have a unique name for identification within the code Control size X & Y Colour Screen position All controls don t necessarily have the same properties
Properties Define the control s properties Writes code for you
Form Properties Name String AcceptButton String CancelButton - String Icon Windows icon BackColor - RGB Enabled True/False Font Style, Size, Colour Location X,Y MaximizeSize X/Y MinimizeSize X/Y Size X,Y WindowState Maximize, Minimize, Normal
Button Properties Name String Text - String BackColor - RGB DialogResult OK, Cancel, Abort, Retry, Yes, No Enabled True/False Font Style, Size, Colour Location X,Y Size X,Y TextAlign Left, Right, Centre, Top, Middle, Bottom TabIndex int Visable True/False
Lab 01 Do project 1 of Lab01.
Add Controls Add the following controls to your lab01 project. Label Button ListBox TextBox PictureBox Change some properties
Aligning Controls Use this control to align controls on a form In most cases you will need to select two or more controls to align Use the shift key to select multiple controls Use this for lab01 project 2 But not yet
Coding in C# and Visual Studio Tutor Demo IntelliSense Microsoft's implementation of auto-completion Code is separated into several files AssemblyInfo.cs Assembly information Author Company Version/build Form.Designer.cs - Form controls Program.cs application code
Coding in C# and Visual Studio Language syntax When declaring variables the type is entered first! String varname; // this is a string variable Statements must be complete with a semicolon;
Coding in C# and Visual Studio C# is a strongly typed language. C# is very explicit in its syntax. A bit like marmite, you either hate or love this. C# produces very stable runtimes as a result. This is by design.
Control Naming Controls using in your programs require appropriate naming This aids the developer by: Providing a description of the control Reduces naming conflicts Use a naming convention Modified Hungarian Notation
Simple Naming Conventions [prefixes][basename] Prefixes - A Prefix is created to mnemonically represent the word it abbreviates, such as "frm" for "form" Basename - The base name is the your own name for the particular object btnok txttitle lstnames
Modified Hungarian Notation Control Label ListBox MainMenu RadioButton TextBox Timer CheckBox ComboBox Button Form GroupBox PictureBox Horizontal scroll bar lbl lst mnu rad txt tmr chk cbo btn frm grp pic hsb Prefix
Lab01 Now do Lab01 Project 2
Summary What is the.net Framework? Introduction to C# Visual Studio Forms Controls Naming conventions
Next Time C# Language fundamentals Beginning OOP concepts