Ten Reasons to Use C# to Teach Introductory Computer Programming Kyle Lutes, kdlutes@purdue.edu Jack Purdum, jpurdum@purdue.edu Background Kyle Lutes Associate Professor Department of Computer Technology Purdue University West Lafayette, Indiana Introductory Programming Language Choices Basic Pascal Cobol C C++ Visual Basic Java others C# Why we use C# in our introductory programming course C# is a “true” object-oriented programming language – – – C# supports: Encapsulation Inheritance Polymorphism In C#, all types are derived from System.Object Constructors, garbage collection, method overloading, interfaces, multi-threading, etc. Why we use C# in our introductory programming course In addition to Windows forms-based applications, Visual Studio .NET and C# can be used to easily develop: – – – – – – – Web applications using ASP.NET Client/Server and enterprise applications Class library DLL components Pocket PC PDA and Smart Phone applications Windows Services Console applications Graphical and Game applications Why we use C# in our introductory programming course Easy to create Windows formsbased applications – – – More interesting to students More real-world than console-based applications Helps enforce object-oriented programming through reuse of GUI controls Why we use C# in our introductory programming course Visual Studio .NET IDE helps make programming enjoyable: – – – A form designer for designing Graphical User Interfaces Interactive debugging makes it easier to see how code executes (breakpoints, stepping through code, examining the contents of variables, etc.) Next version of Visual Studio .NET supports “edit and continue” debugging Why we use C# in our introductory programming course Microsoft makes it easy for educational institutions and students to get Visual Studio .NET – – – MSDN Academic Alliance Microsoft Campus Agreements Visual Studio.NET bundled with textbooks Why we use C# in our introductory programming course Microsoft will soon release Visual C# Express – “Visual C# 2005 Express Edition is a simple, lightweight, integrated development environment designed for beginning programmers and nonprofessional developers interested in building Windows Forms, class libraries, and console-based applications.” – http://lab.msdn.microsoft.com/express/vcsharp/default.aspx Why we use C# in our introductory programming course Visual Basic is widely accepted as an easy language for beginners to learn, its opponents label Visual Basic as a “toy” programming language limited to simple programming tasks – – – We have found many students share this uninformed opinion and object to having to learn Visual Basic Students would rather learn new technology Using C# reduces the “I-already-know-all-this” attitude Why we use C# in our introductory programming course Visual Basic gets more complex with each new version, and so loses its advantage over more complex development environments – C# has a smaller keyword set, yet still offers a robust development language Why we use C# in our introductory programming course More coding examples exist for C# than do for Visual Basic.NET and other .NET languages – Especially true for the MSDN help examples Why we use C# in our introductory programming course Software developers who use C# earn higher salaries than those who use Visual Basic – – “Developers who program primarily in C# earn 26 percent more than those who develop primarily in Visual Basic .NET” http://www.ftponline.com/vsm/2003_06/mag azine/features/salarysurvey/ Why we use C# in our introductory programming course Language used C# Average salary $98,813 Visual Basic .NET Visual Basic 4.0, 5.0, or 6.0 Visual C++ 6.0 $72,959 $72,461 $75,500 “C# Gets the Big Bucks. Last year, C# developers earned around $5,000 more than Visual Basic .NET developers. This year that gap has widened to an astounding $26,000. It literally pays to know C#—whereas salaries for developers who program primarily in Visual C++ remain flat with last year's numbers.” Why we use C# in our introductory programming course C# uses C-like language syntax making it easier for students to learn Java and/or C++ in postrequisite courses Why we use C# in our introductory programming course C# is available for non-Microsoft platforms – “Mono is a comprehensive open source development platform based on the .NET framework that allows developers to build Linux and cross-platform applications with unprecedented productivity. Mono's .NET implementation is based on the ECMA standards for C# and the Common Language Infrastructure.” – www.mono-project.com Our experiences using C# in our introductory programming course Jack Purdum, Ph.D. Assistant Professor Department of Computer Technology Purdue University Columbus, Indiana Our experiences using C# in our introductory programming course Fall 2004 and Spring 2005: >125 students Course assumed no prior programming experience Pace of material covered was fast Basic terminology: objects, classes, properties, methods, variables, constants Programming concepts: data types, math operators and methods, relational operators, logical operators, decisions, loops, arrays, lists, files, classes Our experiences using C# in our introductory programming course Daily quizzes served as incentive to keep up with reading Weekly programming assignments gave regular practice applying course topics Participation/attitude Four exams – – two objective (multiple choice) two coding exams in a lab setting Team programming project Our experiences using C# in our introductory programming course Team programming project – – – – Create a C# application for a high school athletic director to manage the athletic event schedules and related information of all high school sports Assigned teams had 3-4 students (one had 5) Flexibility given to teams to refine problem statement and customize their program for the target user Bonus points given for creativity, resourcefulness, addition of value-added features Our experiences using C# in our introductory programming course Team programming project – Attempt to balance skill-level of teams as evenly as possible All teams had at least one strong student and one student who was experiencing some difficulty Where possible, teams had students from different background – – few female students on different teams few minority students on different teams Our experiences using C# in our introductory programming course Student seem more excited learning C#. Especially those who have used Visual Basic because they feel they are learning something new Former CS students tell us how nice it is to develop with Visual Studio .NET rather than command-line tools Our experiences using C# in our introductory programming course When we used Visual Basic .NET, students who knew VB 6 assumed VB .NET was the same. Required some “unlearning” With Visual Basic, many student assumed that because they saw the word class in their code they were doing object-oriented programming. More “unlearning” was necessary Our experiences using C# in our introductory programming course We don’t have to spend weeks teaching the IDE instead of programming concepts We believe the reduced keyword count found in C# compared to Visual Basic is a plus Our experiences using C# in our introductory programming course Transition between the intro course and subsequent courses appears easier What they learn in C# is valuable in the web and Java courses Our experiences using C# in our introductory programming course Because there are fewer preconceived notions about the language by students, we feel it’s been easier to teach the course Crisp syntax helps, too Our experiences using C# in our introductory programming course C# syntax makes the movement from design to implementation fairly easy The students seem more willing to actual think about a lab assignment before they start writing the solution to it! Our experiences using C# in our introductory programming course Non-traditional students believe there is value added using C# (It appears that most felt they would never use VB in “real life”…not so with C#) Recommended Textbook An Information Systems Approach to Object-Oriented Programming using Microsoft Visual C# .NET – Kyle Lutes, Alka Harriger, Jack Purdum Available March 2005! Recommended Textbook Highlights: – – – – – – Teaches computer programming from an application developer perspective Object-oriented programming integrated throughout Teaches object-oriented programming with no prior programming experience assumed Use C# as the programming language Uses Windows forms-based applications (rather than console applications) Each chapter divided into Essentials and Bonus sections Summary We believe C# and Visual Studio .NET provide many advantages over Visual Basic .NET and Java for teaching introductory computer programming Summary 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. True Object-Oriented Language Easy to create GUI applications like students are used to using Can be used to create many other types of applications Visual Studio .NET makes programming enjoyable Easy for educational institutions to get Visual Studio .NET C# not seen as a "toy" language like VB VB gets more complex with each new version More coding examples for C# C# software developers earn more than Java developers C-like language syntax aids transition to Java and C++ Questions and Answers Kyle Lutes, kdlutes@purdue.edu Jack Purdum, jpurdum@purdue.edu