1 of 45
INF1003F
INTRODUCTION
There are two types of software
• System Software - collection of programs designed to operate, control, and extend the processing
capabilities of the computer itself.
generally prepared by the computer manufacturers
e.g. operating systems such as Microsoft Windows, Mac (for Apple devices), and Linux for
desktop computers, laptops and tablets
• Application Software - computer software developed speci cally to aid a user to execute and
perform speci c tasks.
e.g. word processing, spreadsheets, graphics, games, databases, communications
A software is a computer program designed to perform a well de ned function
A program is a sequence of instructions written to solver particular
problems
How is a program developed?
• One of the fundamental procedures of developing software in a
step by step manner is by following the Software Development Life
Cycle (SDLC) or sometimes called the Software Development
Process.
• The SDLC is a process used by the software industry to design,
develop and test high quality softwares that meets or exceeds
customer expectations, reaches completion within times and cost
estimates.
The .NET framework
- .NET is a developer platform made up of tools, programming
languages and libraries for building many di erent types of
applications.
- C# is a powerful, type safe, object orientated language that runs on the .NET framework
- It includes an interactive development environment, visual designers for building windows and
web applications, a compiler and a debugger
- .NET core is newer than .NET as well as its cross platform while .NET is not
.NET Framework and .NET Core
Windows Forms applications do not access the
operating system or computer hardware
directly. Instead, they use services of the .NET
Framework, which in turn access the operating
system and hardware.
The .NET Framework consists of two main
components:
- Class Library
provides les that contain pre-written
code known as classes that are available
to all of the NET programming languages.
Classes within this library are organised
in a hierarchal structure. In this structure
related classes are organised into groups
called namespaces
fi fi ff fi fi
, 2 of 45
- the Common Language Runtime (CLR)
manages the execution of .NET programs by coordinating essential functions such as memory
management, code execution, security, and other services.
Because .NET applications are managed by the CLR, they are called managed applications.
The Common Type System is a component of the CLR that ensures that all NET applications use the
same basic data types no matter what programming languages are used to develop the
applications.
Three platforms for developing Windows desktop applications with .NET
• Windows Forms (WinForms)
A traditional Windows application that runs on the user's PC. The Windows forms that provide the
user interface for this type of application contain Windows Forms controls, like labels, text boxes,
buttons, and radio buttons, that let the user interact with the application.
• Windows Presentation Framework (WPF)
The enhanced user experience that's provided by WPF (Windows PresentationFoundation)
applications developed using C# is implemented using XAML (Extensible Application Markup
Language).
- xaml make it easier to develop applications that include animation, enhanced graphics,
touch processing and more.
• Universal Windows Platform (UWP)
Two platforms for developing web applications with .NET
• ASP.NET Web Forms
A traditional web applications that run on a web server, but whose user interfaces are displayed
in a browser on a client machine.
• ASP.NET Core MVC (model view controller)
A newer addition to the .NET family. MVC provides for breaking an application into component
parts which can make it easier to code test, debug and maintain large applications.
Programming languages supported by VS:
How a C# application is compiled and run:
1. Create a project
• A project is made up of source les that
contain C# statements, may also contain
other types of les such as, sound, image, or
text les
• A solution is a container that can hold one
or more projects
2. C# compiler
• builds (compiles) your C# code into
Microsoft Intermediate Language (MSIL)
fi fi fi
, 3 of 45
• The Intermediate Language is then stored on a disk in a le that’s called and assembly, this
le also contains references to the required classes.
• An assembly is an executable le that has an .exe or .dll extension.
3. Assembly is run
• Then the CLR converts the IL to native code that can be run by the windows operating system
Getting groovy with object orientated programming:
• An object is a self-contained unit like a form or control that combines code and data.
object is an entity that has state and behaviour, state means data and behaviour means
functionality.
- An object is a runtime entity, it is created at runtime.
• A class is the code that de nes the characteristics of an object.
• An object is an instance of a class, and the process of creating an object from a class is called
instantiation.
EXAMPLE:
Class- Animals
Objects- Lion, cat, bird, elephant etc
• If you instantiate two or more instances of the same class, all of the objects have the same
properties, methods, and events. However, the values assigned to the properties can vary from one
instance to another.
• Control: are objects that display data or make it easier for users to enter or edit data, perform an
action, or make a selection
- A label
- A text box
- A button
• Properties de ne the characteristics of an object and the data associated with an object
- Name property
‣ Sets the name you use to identify a control in your C# code
‣ Use a three letter pre x to indicate what the name refers to: form (frm), button (ban), label (lbl),
or text box (txt)
- Text property
‣ Sets the tent that’s displayed on the form or control
- Other properties for forms:
- Other properties for controls:
• Methods are the operations that an object can perform.
• Events are signals sent by an object to the application telling it that something has happened that
can be responded to.
• Properties, methods, and events can be referred to as members of an object.
fi fi fi fi fi fi
, 4 of 45
Objects and forms
• When you use the xgner, Visual Studio automatically generates C# code that creates a new class
based on the Form class. Then, when you run the project, a form object is instantiated from the new
class.
• When you add a control to a form, Visual Studio automatically generates C# code in the class for
the form that instantiates a control object from the appropriate class and sets the control’s
default properties.
• When you move and size a control, Visual Studio automatically sets the properties that specify the
location and size of the control
How an application responds to events
• To indicate how an application should respond to an event, you code an event handler, which is a
special type of method that handles the event.
• To connect the event handler to the event, Visual Studio automatically generates a statement that
wires the event to the event handler. This is known as event wiring.
• An event can be an action that’s initiated by the user like the Click event, or it can be an action
initiated by program code like the Closed event
EXAMPLE: