Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Teaching Programming to Freshman Engineering Students, Lecture notes of Programming Languages

The debate on whether or not freshman engineering students should be taught a programming language. It explores the traditional justifications for teaching programming, such as logical thinking and problem-solving, and argues that modern mathematical software tools like MATLAB can achieve these goals more effectively. The document also describes changes made to the first-year curriculum at Purdue University in 1995/96, which included the addition of a computer tools course and restructuring of the programming course.

Typology: Lecture notes

Pre 2010

Uploaded on 05/11/2023

francyne
francyne 🇺🇸

4.7

(20)

36 documents

1 / 3

Toggle sidebar

Related documents


Partial preview of the text

Download Teaching Programming to Freshman Engineering Students and more Lecture notes Programming Languages in PDF only on Docsity! Should Freshman Engineering Students Be Taught a Programming Language? G. Bjedov and P. K. Andersen Department of Freshman Engineering Purdue University West Lafayette, IN 47907 Abstract Many first-year engineering curricula include a course in programming in a high-level language (such as FORTRAN, Pascal, C, or even C++). Such courses have traditionally been justified as teaching logical thinking and problem solving, while providing the students with tools that they will use as practicing engineers. However, these goals can be achieved more readily today through the use of modern mathematical software tools such as MATLAB. Such tools are more powerful and easier to master than a traditional programming language, allowing the students to solve interesting and challenging problems earlier in the course. Consequently, there is little reason to teach traditional programming languages to freshman, and many reasons not to. Introduction During the 1995/96 school year, Purdue University reorganized the first-year curriculum for engineers. The most significant changes were the addition of a computer tools course, and the restructuring of the existing programming course. This change affects approximately 1600 students per year. Before the fall of 1995, engineering students at Purdue were required to complete a 3-semester-hour programming course in either the C or FORTRAN programming language during their freshman year. We taught ENGR 195A, “Introduction to C Programming.” The course had a well-deserved reputation as being difficult and time consuming. In the fall of 1995, this course was replaced by two 2-hour courses, the first of which is ENGR 106, “Introduction to Engineering Computer Tools.” The course begins by introducing students to the operating system that they will be using during their stay at Purdue (UNIX) with particular emphasis on information exchange and communications. After this brief introduction to UNIX, the emphasis of the course shifts to engineering problem solving using two different tools: MATLAB and a spreadsheet. Once the students have successfully completed ENGR 106, they are then required to take a 2-hour programming course in either C or FORTRAN. Why Teach Computer Programming? Almost all of the engineering schools in the country require their students to learn at least one high- level programming language such as C, FORTRAN, or Pascal. In our discussions with colleagues, we have heard a number of arguments in favor of this practice: • “Programming teaches students to think logically.” • “Programming allows students to solve problems.” • “They'll need to program on the job.” We shall consider each of these arguments in turn. Logical Thinking At first glance, the concern for logical thinking might appear to justify teaching traditional programming languages. Certainly we want our students to be able to attack problems systematically, and computer programming would seem to provide a vehicle for teaching this. But logical thinking is also required to use MATLAB or any other computer tool successfully. A student will not get very far trying to solve problems in MATLAB by randomly pressing the keys. A variation on the “logical thinking” argument is that students should understand the basic principles of programming—flow of control, program modularity, and so on. Those who advance this view often say it is not important which language the students are taught. In that case, MATLAB would serve just as well as C or FORTRAN, since MATLAB offers the usual programming constructs: loops (for and while), selection structures (if-else), functions, arrays, strings, and so on. Problem Solving Every problem that can be solved by MATLAB can also be solved in C or FORTRAN. The difference is that the MATLAB solution requires considerably less time to implement. In other words, MATLAB is more powerful than C or FORTRAN. Consider, for example, the solution of the system of equations Ax = b by LU decomposition. The MATLAB solution requires one line of code: x = A\b In contrast, a C program to carry out the same computation requires about 70 lines of code [1]. A skilled programmer would require many hours to design, code, test, and debug such a program. Even then, the program is likely to contain errors [2]. To make matters worse, most of our students are not skilled programmers. Over the last decade, in fact, programming language instruction in high school has significantly declined. The fraction of our engineering students who have taken a course in a high- level programming language before entering college has dropped below 50% [3]. Therefore, freshman programming classes must be taught on the beginning level, with the result that instruction tends to focus on the details of syntax. More importantly, the problems used in instruction must be chosen for their simplicity and ease of demonstration of a particular programming construct. We have found that it takes ten to twelve weeks to cover enough C or FORTRAN to enable students to write even fairly trivial programs. In the few weeks that remain, there is little time to deal with anything but the simplest practical problems. Usefulness on the Job At one time, a practicing engineer might have been expected to write his or her own programs in a language such as FORTRAN. This may no longer be the case. In a recent survey, 92% of practicing chemical engineers reported that they “never” or “seldom” programmed in FORTRAN; 84% “never” or “seldom” programmed in a language other than FORTRAN [4]. (On the other hand, 74% reported “frequent” use of spreadsheets.) Of course, computer and software engineers will continue to need high-level programming languages— for example, it would not make sense to write a compiler or develop a CAD package using MATLAB. However, the vast majority of engineers are not in the business of writing software. For them, MATLAB would be a more useful tool than C or FORTRAN. Sample MATLAB Problem One of the problems solved in our new computer tools class is as follows: “An engineering team is working on a cable design for a suspension bridge. They must determine the total length and weight of the supporting cables used to connect the top cable with the highway. The top cable is a second- order parabola passing through the points (10, 300), (250, 177), and (410, 350). The highway is a third-order parabola passing through the points (10, 20) (100, 30), (410, 15), and has a local maximum at the same point as the minimum of the top cable. The supporting cables are spread 40 meters apart. If the location of the first supporting cable is at x = 10 meters, and the location of the last cable is at x = 410 meters, find the total length of the supporting cables.” The MATLAB solution of the problem is relatively simple and elegant. It requires the student to visualize the problem and solve several separate sub- problems, and it allows them to do so without worrying about extraneous details such as data types, array sizes, etc. The solution is presented in Figure 1. x = [10 250 410]; y = [300 177 350]; top = polyfit (x, y, 2); slope = polyder(top); xmin = roots(slope); x = [10; 100; 410]; y = [20; 30; 15]; A(:,1) = x.^3, A(:,2) = x.^2; A(:,3) = x, A(:,4) = ones(3,1); A(4,1) = 3*xmin^2, A(4,2) = 2*xmin; A(4,3) = 1; b = [y; 0]; hway = A\b; x = 10:40:410; cable = polyval(top,x)-polyval(hway,x); length = sum(cable); format bank length length = 2225.36 Figure 1. MATLAB Solution of the Sample Problem All of the material necessary to solve the problem is covered in four weeks of MATLAB instruction. Although the students may not know how to calculate the inverse of a matrix, they are able to understand that the solution of a system of linear equations is given in MATLAB as x = inv(A) * b or x = A \ b. We tell the students that they will learn more about the theory of linear algebra in future courses. For now,
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved