Presentation is loading. Please wait.

Presentation is loading. Please wait.

Practical Programming COMP153-08S Lecture 1: Starting to program.

Similar presentations


Presentation on theme: "Practical Programming COMP153-08S Lecture 1: Starting to program."— Presentation transcript:

1 Practical Programming COMP153-08S Lecture 1: Starting to program

2 Computers Central Processing Unit (CPU) –Pentium IV – 3GH (billion / sec) Main Memory (RAM) –512MB (512 books, 512 minutes music) –Holds running programs and their data Disk (Hard Drive) –80GB (80 movies) –Long term storage (with care)

3 Software (Programs) Operating system –The most complex thing ever built by the human mind –Interacts with you – interprets mouse clicks, etc –Keeps track of files –Allows several programs to run at the same time

4 Programming Don’t write individual computer instructions Use development environment Much is written for us We use libraries of useful behaviour and appearance and functionality

5 Programming Can Be Fun and creative Demanding –Often meticulous detail required Error prone –Very hard to get things just right Interacts interestingly with our personalities

6 Visual Basic (VB) Concepts: Control Property Event A whole program is quite large. Usually we don’t even look at it, let alone write it ourselves. We write ‘event’ handlers – sets of instructions (subroutines) to be run when something happens

7 Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents One As System.Windows.Forms.Button Friend WithEvents Two As System.Windows.Forms.Button Private Sub InitializeComponent() Me.One = New System.Windows.Forms.Button Me.Two = New System.Windows.Forms.Button Me.SuspendLayout() ' 'One ' Me.One.Location = New System.Drawing.Point(64, 64) Me.One.Name = "One" Me.One.Size = New System.Drawing.Size(120, 32) Me.One.TabIndex = 0 Me.One.Text = "I am called One" '

8 'Two ' Me.Two.Location = New System.Drawing.Point(64, 120) Me.Two.Name = "Two" Me.Two.Size = New System.Drawing.Size(112, 64) Me.Two.TabIndex = 1 Me.Two.Text = "My name is two" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.Add(Me.Two) Me.Controls.Add(Me.One) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) End Sub #End Region Private Sub One_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles One.Click Two.Text = "I've been changed" Two.Width = 200 End Sub End Class

9 What we see/What we write Public Class Form1 Inherits System.Windows.Forms.Form.... Hidden lines of program Private Sub One_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles One.Click Two.Text = "I've been changed" Two.Width = 200 End Sub End Class

10 Subroutines Private Sub Albert() instructions End Sub Sub is short for Subroutine Group of instructions with a name

11 Assignment statement Something = some expression –Something: a property of a control Written controlname. propertyname –Some expression allows arithmetic and parenthesis Button2.Width = 400 Button2.Width = (900 + 20) / 2

12 THE END


Download ppt "Practical Programming COMP153-08S Lecture 1: Starting to program."

Similar presentations


Ads by Google