Introduction - History of C

advertisement
COP 2360 – C# Programming
Introduction
The Evolution from C to C#
Introductions

Bradley’s Contact Info
–
–

bradleyl@palmbeachstate.edu
407-925-8751
Bradley’s Background
Syllabus






List the historical evolution of programming languages such
as C, C++ that led to the development of C# and its
standardization as Visual C# in .NET platform.
Describe and use Visual Studio IDE environment and its
components.
Compile and run C# programs for a wide range of platform
including mobile devices.
Write C# programs which use different control structures,
classes, objects, and methods.
Write C# programs which utilize exception handling.
Write code that uses object-oriented programming and uses
abstraction, data encapsulation, inheritance, and
polymorphism.
Required TextBook

C# Programming: From Problem Analysis to
Program Design
–
–
–
–
4th Edition
Barbara Doyle
Cengage
ISBN-10: 1285096266
Other Required Stuff



You will need a thumb drive or your own
laptop to work on in-class assignments and
follow-alongs.
You will need access to a PC with Visual
Studio 2012 (or later) installed to do the take
home assignments.
Dreamspark access available for this class
Course Outline








Aug 26 – Introduction – Chapter 1
Sept 2 – Variables & Arithmetic – Chapter 2
Sept 9 – Methods – Input/Output – Chapter 3
Sept 16 – Logic – File I/O – Chapters 5 & 13
Sept 23 – Iteration – Chapter 6
Sept 30 – Exam 1
Oct 7 – Arrays – Chapter 7
Oct 14 – Collections/Classes – Chapters 4 & 8
Course Outline









Oct 21 – Windows Programming – Chapter 9
Oct 28 – Windows Forms – Chapter 10
Nov 4 – Exception Handling – Chapter 12
Nov 11- Exam 2
Nov 18 – Database Access – Chapter 14
Nov 25 – Web Development – Chapter 15
Dec 2 – Web Development Continued
Dec 9 – Advanced Object Oriented – Chapter 11
Dec 16 – Comprehensive Final Exam
Grading




5 Programming Assignments
– Each worth 10 points
– (Sep 9, Sep 30, Oct 21, Nov 25, Dec 16)
– There may be bonus points in some assignments
3 Exams
– Each worth 12 points
– (Sep 30, Nov 4 and Dec 16)
Attendance 14 points.
– Each class attended is worth 1 point except the first and last
Add up your points and apply the standard grading scale
– 90-100 = A, 80-89 = B, 70-79 = C, 60-69 = D, Below 60 = F
Grading



Makeup exams are given only if there is solid evidence of a
medical or otherwise serious emergency that prevented the
student from participating in the exam.
Assignments are to be submitted on time, with 2 point per day
late penalties. Appropriate accommodations will be made for
students having a valid medical excuse for being unable to
work on an assignment. The excuse must be presented to the
instructor as soon as possible once the issue is identified.
Requests for an extension the night the assignment is due will
not be accepted.
Unless there is solid evidence of medical or otherwise serious
emergency situation, incomplete grades will not be given.
Withdrawal Policy



Students who miss more than three days of class
without notifying the professor of why they have not
attended class before November 4, 2015, will be
withdrawn from the class and receive a WX.
Regardless of reason, students are responsible for
missed lecture materials and assignments.
The last day to withdrawal from this class and
receive a “W” grade is November 4, 2015.
Course Website

A website will be maintained with a menu to
all power point slides and assignments
–
www.wodwhere.com/cop2360
Electronic Device Use and Email Policy


Cell phones may be turned on but must be set to
vibrate/quiet mode during class. If you must make or
receive a call, please exit the classroom. Laptops
may be used as long as the usage does not interrupt
other students. The speakers must be turned off.
All email to the instructor must come from your Palm
Beach State College email account.
–
–
This account goes directly to my phone, so if you need to
reach me, this is the best bet.
YOU NEED TO CHECK YOUR EMAIL AT LEAST DAILY TO
SEE IF I SENT YOU A MESSAGE. PLEASE RESPOND
WHEN ASKED TO RESPOND!!
Ethics



Students at Palm Beach State College are expected to maintain
the highest ethical standards.
Academic dishonesty is considered a serious breach of these
ethical standards, because it interferes with the college’s
mission to provide a high quality education in which no student
enjoys unfair advantage over any other.
Academic dishonesty is also destructive of the college
community, which is grounded in a system of mutual trust and
place high value on personal integrity and individual
responsibility. Harsh penalties are associated with academic
dishonesty.
Cheating???

There is always a fine line between helping your fellow student
and cheating. Pointing a student in the correct direction, giving
advice, suggesting other reading or explaining that an answer
or assignment is wrong is permissible. Giving another student
the solution to a problem or working together on an individual
assignment will be considered cheating and will be disciplined.

Considered Cheating
–
–

Two (or more) people working together on an individual assignment.
Someone finding out another student’s ID and copying their work.
Not Considered Cheating
–
–
Comparing assignments after they have been independently completed.
Helping another student with hints or suggestions on where to get
additional help.
Pet Peeves



Talking in Class
Cheating
Not Following Instructions
–
Let’s Discuss This Since It Is Very Important
Any Questions?
Your First Assignment







Your Name
Your Palm Beach State Email User-Id
Your current status, class and program (full time/part time, 1st
Year, 2nd Year)
A list of any other computer classes you have taken. Please
indicate if the class was at PBSC and the instructor's name.
A short paragraph of what you hope to learn from this course.
Any other information you would like to relate to me.
Email me this information to the appropriate email Account
–
Do This Now - Then Take a Break!!
Dot Net Platform


Platforms provide environments for development and execution
of programs
Two “largest” platforms out there today is Microsoft .Net and
Java
–
Both provide similar executable modules that rely on an
“interpreter” at execution time, but in different ways

.Net runs only on Microsoft Windows devices,
–
–

but there are many front end languages that can be used to generate the
“Common Intermediate Language” (CIL).
Only one IDE is available
Java provides only the Java programming language,
–
–
–
Open Source (although now owned by Oracle)
 Android Law Suite
Multiple IDEs that all pretty much try to do the same thing.
The resulting “bytecodes” can be used on several different operating
systems
Main Objective of .Net Platform

Provide component based support for Web Applications, Web
Services and Windows Application.
–

Classes are self-describing and reusable
When I had hair
–
One would compile a program to an object file, and then link the
object files into an executable


Same subroutine was compiled and placed into EXE over and over.
(Each EXE would have a copy)
When I had a comb over
–
Concept of DLL (Dynamic Link Library) introduced


Separate pre-compiled routines that could be called from main
programs to do work
Was a mess with the way it was managed usually resulting in multiple
DLLs on a machine that did the same thing, but different version.
Main Objective of .Net Platform

When I shaved it all off:
–
.Net Assemblies were introduced that used the Common
Intermediate Language (CIL) approach to produce reusable
components

Assemblies result in either an EXE or a DLL
Exe has a “Main” entry point
– DLL’s can have multiple entry points that are self-described
 What the heck does “self-described” mean?
– DLL’s can be shared between programs (or as a Web Service)
–

Assemblies are what execute through the Common
Languages Runtime (CLR)
.Net Platform Components

.Net Framework
–
CLR (Common Language Runtime)

–
Framework Class Library




Virtual machine that “interprets” the CIL and manages the
execution of the program or call to the library
A set of base classes used by C# that can be used by other
.Net Languages. (Types, Strings, Objects, etc)
Compilers
Interactive Development Environment (Visual Studio)
.Net Enterprise Servers (SQL Server, BizTalk,
Sharepoint for example)
From C To Shining C#




In the beginning there was machine code. Programs were entered with a
bunch of ones and zeroes (and if you were lucky, maybe in octal or hex). Every
machine was different. Life pretty much sucked.
Next came machine language which mapped a mnemonic to an instruction, and
introduced variables instead of direct addressing. Life sucked, but not as bad.
Then development programming took off and all the academic and business
types got their own damn programming languages. (COBOL, FORTRAN,
Basic, PL/1, LISP, etc.)
Finally, the “C” language (based somewhat on ALGOL) was introduced that
added a layer of abstraction for lower level system development making it
easier and more consistent to program, but still allowing for lower level “stuff” to
happen that may not be that welcomed in a development language like Basic,
COBOL or FORTRAN.
–
–
–
All the basics were there. If you needed something else (string manipulation for
example), you wrote it yourself or tried to find someone else that already did it and
borrowed the code.
Machine Language finally could be replaced with it’s own “higher level language”
Programs (and operating systems) that were traditionally written in Assembly
Language, quickly adopted “C”

–
Unix, Microsoft Windows for example
BTW – Yes, there was a “B” developed at Bell Labs. Not so sure about an “A”
though!!
From C To Shining C#

C++ was introduced to support Object Oriented Programming
and correct some “mistakes” in base “C”
–
–
–
–
–
Implementation of the New and Delete operators to better request
and remove memory allocations during run-time
Providing byRef type arguments to function calls
Basing types on Classes that can inherit their attributes from other
Classes allowing developers to create their own new data types
Improvements to the struct concept (well, really making a struct
and a class the same thing). Both classes and structures can
contain data definitions as well as functions and can specify the
visibility of these attributes.
Many applications written in C were upgraded to C++ when it
become available.
From C To Shining C#

Java was then developed from C++ to provide an overall IDE that
resulted in simplifying development and deployment.
–
–
–
–
–
–
Java Virtual Machine and bytecode meant that one could compile on one
operating system and run the resulting object on another
All Java code is contained in classes (a Java program is a collection of
classes, where at least one of these classes contains a main).
There is compile-time strong type checking between all the classes in a
program, regardless of which source files the class definitions are
contained in.
Therefore, there is no need for header files, and header files are not
supported.
Like C, and unlike C++, call by value is the only parameter passing
mechanism.
Java has much more restrictive use of pointers (no address or explicit
dereference operator).
From C To Shining C#

More Info on Java
–
–
–
–
Note that in Java, a variable is a local variable, parameter,
or a field.
In Java, all garbage collection is automatic.
The existence of a Java execution system (i.e., the JVM)
that guarantees how primitive types are implemented,
promotes safety, guarantees binary portability, and provides
dynamic linking.
A modified form of Java became the language for Android
App development.
From C To Shining C#

C# is a modification of Java (in an approximate sense, C# is an
enlargement of Java) that:
–
–
–
Includes some shout-outs from VB and Delphi
Corrects mistakes made in the Java design (e.g., call by reference
and printf style formatting put back in language).
Provides a type system that allows special objects (i.e., instances
of structs) to be treated as values, as opposed to Java where only
pointers and instances of primitive types are treated as values
(i.e., can be values of variables).

–
We’ll talk all this values and references next week
In C#, the primitive types are defined as structs, arguably providing
C# with a type system that is more unified than the one in Java,
because, in C#, all types derive from Object (including
ValueType), and all value types (i.e., enumeration types and
structs) derive from ValueType.
From C To Shining C#

In C#
– A type is either a value type (in which case it derives from ValueType) or a
reference type (such as a class).
– Incorporates improved versions of some C++ features (such as operator
overloading) that were excluded from Java.
– Provides the option of including unsafe code, in which unprotected pointers
are used, so that C# can replace C and C++ in low-level implementations
such as device drivers.
– Provides features (such as properties, events, and attributes) that are
useful for component-based programming.
– Provides features such as indexers that are convenient for implementing
collection types.
– Provides improved versions of statements from non-C-family languages
(e.g., the foreach statement).
Top Level Java to C# Comparison
FEATURE
JAVA
.NET
Execution system
JVM (Java Virtual
Machine)
CLR (Command Language Run Time)
Class library
Java class libraries
FCL (Framework Class Library(
Intermediate code
bytecodes
CIL (Common Intermediate
Language)
Unit of deployment
class file, jar file
assembly
IDE
JDeveloper, etc.
Visual Studio 2013
SQL API
JDBC, SQLJ; TopLink and
other ORMs
ADO.NET, ADO.NET Linq to
Entities
Web programming API
servlets, JSP (Java
Server Pages), JSF
(Java Server Paces)
ASP.NET Web Forms, ASP.NET MVC
(Model View Controller)
GUI programming API
AWT, Swing, JavaFX
(latter has RIA (rich
internet app)
support)
Windows Forms, Windows
Presentation Foundation
(latter has RIA support)
.NET Other Languages

Because of it’s Common Intermediate
Language (CIL) and Common Language
Runtime (CLR), .Net provides for many front
end languages including:
–
–
–
Visual Basic
COBOL (believe it or not)
F# (Best comparison is a .Net version of Fortran)
Download