Sie sind auf Seite 1von 29

C# VS

OOP Ms .NET

Visual Programming
Introduction to Visual C#
C# Fundamental
Marcel Bonar Kristanda
Vector image courtesy of freepik.com

The Instructor
Marcel Bonar Kristanda, S.Kom, M.Sc

E-mail : marcel.bonar@umn.ac.id
Office Phone : (021)5422-0808 Ext. 6021
Mobile Phone : 085770302782
LINE ID : bonar.umn
Facebook: Marcel Bonar Kristanda

DONT CALL ME PAK, BAPAK, OM


CALL ME KAKAK, KOKO, MAS, BRO, BANG

TK, SD, SMP, SMA : St. Theresia, Menteng, Jakarta


S1 : Teknik Informatika, UMN, 2007-2011
S2 : Information Management, CCU, Taiwan, 2013-2015

Responsive Web
Push Technology
Mobile Technology

MBK

The References

Books
Title

Author

Year

Accelerated C# 2010

Trey Nash

2010

Introducing Visual C# 2010

Adam Freeman

2010

Pro C# 5.0 and the .NET 4.5 Framework

Andrew Troelsen

2012

Visual C# 2010 Recipes

Allen Jones
Adam Freeman

2010

Visual Language Theory: Towards a


Human-Computer Interaction
Perspective

N. Hari Narayanan
Roland Hbscher

1998

Journal Article, Research Paper, Book Chapter (Theoritical Concept)


Old Slide Presentation and its References from Previous Lecturers
Dennis Gunawan
Eka Gautama

MBK

The Points

Final Exam (40%)

Things to Note

Midterm Exam (30%)

Assignments are divided by 2:


Before Midterm and After Midterm
Individual 5%, Team 10%

Team Assignment (20%)

Presence and Active Participation in class are


the consideration for bonus points for your
individual assignment

Individual Assignment (10%)

Late and Absence wont affect your points.


But, they also wont get any excuses.
Remember the risk of exam participation!

MBK

The Outline

Introduction to C#

Preconcepts
Programming Language Paradigm
Multiple Paradigms
Concept
Visual Programming
.NET Framework
Visual Studio .NET

MBK

The Outline

Fundamental C#
Basic Understanding
Language Rule
Class Structure
Inheritance
Access Modifier

Technical Understanding
Simple C# Programs
Identifiers
Keywords
Windows Application Form
Visual Controls
Properties and Event

MBK

The Preconcepts
Programming Language Paradigm

MBK

Multiple Paradigms
C# Paradigms

Main programming paradigms


The imperative paradigm
The functional paradigm
The logical paradigm
The object-oriented paradigm

Other possible programming paradigms


The visual paradigm
One of the parallel paradigms
The constraint based paradigm
By Structure
Block
Modular
OOP
By Programming Style
Linear
Non-Linear

Perspective

Procedural (C)

OOP (C#)

Fundamental
Unit

Function and
Variable

Class and Object

Code
Organization

List of Small
Procedures

Attributes and
Class Methods

Data

No Intrinsic
Relationship
Global/Local

Intrinsic
Relationship
Public / Protected
/Private

Reusability

Less

Very High

Abstraction

No

Yes

Inheritance

No

Yes

Encapsulation

No

Yes

Polymorphism

No

Yes

Cost (Relatively)

More

Less

MBK

The Concept
Definition of Visual Programming

Visual languages. Languages with alphabets


consisting of visual representations that are used for
human-human or human-computer communication.
Visual programming. The use of visual
representations to communicate data and
operations to a computer. The underlying
programming language mayor may not be visual.

Visual programming language. A programming


language with an alphabet made up of visual
representations.

MBK

The Framework
Microsoft .NET Framework
What is .NET?
Application development platform
from Microsoft that provides
services for building, deploying,
and running desktop, web, and
phone applications and web
services. Released in 2002
What is Framework?
Framework may include support
programs,
compilers,
code
libraries, tool sets, and application
programming interfaces (APIs)
that bring together all the different
components
to
enable
development of a project or
solution

MBK

10

The Framework
Relations between C# and .NET

MBK

11

The Development Tools


Visual Studio .NET

CLICK HERE TO GET THE EXPRESS EDITION FOR FREE!

MBK

Fundamental C#

12

The Language Rule

Case Sensitive

Bracket {.Code Here}Block

Semicolon
Statement

Everything must be inside class


The class name doesnt need to be
the same as file name
Class usually consists of methods and
attributes, but for the best practices,
C# class can be divided into 3 terms

MBK

13

The Class Structure


Fields, Properties and Methods

Fields : Representation of class


internal states. Giving a direct
access
to
fields
isnt
recommended.

Fields
Properties
Methods

Properties : Acts as an getter or


setter of fields. Rules and
constraints are implemented
here
Methods : Functions or
Procedures that belongs to a
class

MBK

14

The Class Structure


Anatomy of defining a class
Modifier
Keywords
are
applied
to
declarations of different kinds to
create a specific kind of behavior
for class, methods, properties and
fields:
public, protected, private, internal,
abstract, const, event, in, out,
override, readonly, sealed, static,
virtual
Bolded modifier is called Access Modifier.
Which is very important in understanding C#
inheritance

MBK

15

The Inheritance
C# Inheritance
One of the big features of
object-oriented programming is
that one object can inherit
features from another.
You can write C# programs
without using the inheritance
features, but youll quickly find
thatyour code becomes hard to
maintain.

Student class still has the walk() method

MBK

16

The Inheritance
Relations between Access Modifier and Inheritance

MBK

17

Technical Understanding
Simple C# Non-Visual Program Structure

MBK

18

The Identifiers

Identifiers are the names assigned by the programmer to C# elements such


as classes, namespaces, methods, fields, properties, and so on.

MBK

19

The Keywords
Punctuators

10 -> Literals
* -> Operators

Keywords are words that have special meaning in C#; you


use them to tell the C# compiler about your program or to
perform a specific task or function

MBK

20

The Visual Techniques


Windows Application Form
Open Visual Studio 2010
File-> New ->Project ->
Select Visual C# (Left) ->
Select Windows Form ->
Set Name, Location,
Solution Name -> OK

Inside Toolbox

Main Workarea

Visual Controls
that you can drag
and drop it to the
Form

Form that
implicates
display of the
application
development

MBK

21

The Windows Form


Visual Controls
Panel is a Container for
Visual Controls, can be
found in Containers Subsection
TextBox is a Common form
field that can be modified
in the runtime (user typing)
ComboBox is a Common
form field that contains
selective text options
Button is a Common form
field to trigger an action in
the application
Label is a Common form field
that contains read-only text, but
can be modified via code

MBK

22

Visual Controls
Properties

Visual Control
Properties can be set
as initial state of how
the control looks like
or behave
IMPORTANT!!!
Text is not the same
as Name Properties.

It can be change
inside your code for
sure

Text is made for


information display.
Name is made for
identifier in your code

MBK

23

Visual Controls
Event

Event Properties is used for handling specific action


within a time that triggered by user (Ex. Event Clock),
by program (Ex. Event Paint), or by code (Ex. Event
Category PropertiesChanged).
To handle this, developer can trigger some code
within the block of Event Handler just like the
example above. It handles an Event Click from
btnDraw that was made before

MBK

24

Visual Controls
Adjusting Controls to Make It Neat
Split Containers
Divide the form or
other container into 2
panels
Important Property
Orientation :
Horizontal
Vertical
Can be combined with
Dock Property from
other visual control

MBK

25

Coding Techniques
Graphics: Lets Paint a Square and Ellipse

DrawRectangle(Pen pen, int x, int y, int


width, int height)
FillRectangle(Brush brush, int x, int y,
int width, int height)
DrawEllipse(Pen pen, int x, int y, int
width, int height)
FillEllipse(Brush brush, int x, int y, int
width, int height)

MBK

26

The Assignment
Individual

Make a Summary of what you learn in the 1st week with the rules:
1. Make it in Bahasa Indonesia
2. All the example must be different with this presentation
3. First paragraph is the title Bab 1 : Pengenalan dan Dasar Visual C#
4. Put some valid references for your summary at the end, use Harvard Style
5. A grader will be used to check the content, language style, and sentence
similarity. So, please make it on your own and you will get not only
points but more understanding in this course.
Technical Details
1. A4 Paper, Margin 3 cm
2. Min. 3 Pages Max. 8 Pages
3. Font : Times New Roman, 11pt, 1.5pt line spacing (also before-after
paragraph)
4. Save it as Ms. Word and Submit it to me as a PDF File
5. Name the Ms. Word File as Rangkuman Pemrograman Visual NIM Nama
Kelas.docx / .doc
6. Name the PDF as Summary_01_NIM_Name_Class(A/B/C/D/E/F/G).pdf

MBK

The Assignment

27

Group
Make a Group : 2 person 3 person.
Name your Group with an appropriate name (educational context)
Find a physical form with minimum 10 fields.
Each group has to bring an unique form, even with other classes
group.
5. Convert it to a Windows Form Application display.
6. Give the Solution Name as Group_Class(A/B/C/D/E/F/G)_GroupName
7. Project Name as Group_01_Class(A/B/C/D/E/F/G)_GroupName_Starter
8. Bring your own laptop with Visual Studio 2010 installed (Express Edition
will be okay) and prepare the Windows Form and show it next week!
9. Take a photo with clear shot of your form!
10. Take a screenshot of windows form application version!
11. Put it side by side with a graphic editor!
12. Submit it as Group_01_Class(A/B/C/D/E/F/G)_GroupName.jpg!
1.
2.
3.
4.

MBK

fin

Lets Called It A Day !

MBK

Das könnte Ihnen auch gefallen