Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

should we teach pointers in a "fundamentals of programming" course?

I will be teaching a course on the fundamentals of programming next Fall, first year computer science course. What are the pros and cons of teaching pointers in such a course? (My position: they should be taught).

Edit: My problem with the "cater your audience" argument is that in the first couple of years in University, we (profs) do not know if students would like to be scientists or not... we wish we knew, but we have to strike a balance between those who will remain in school (4 years does not a scientist make), and those who will be engineers.

Final decision: At least references, but possibly pointers without pointer arithmetic.

like image 276
Dervin Thunk Avatar asked Mar 18 '09 23:03

Dervin Thunk


People also ask

Is pointers important for programming?

No, pointers are not unavoidably required for a programming language. There are languages which have no pointers: Java and Python are well-known examples.

Are pointers still used in programming?

Modern LanguagesThe underlying system behind many modern programming languages still uses pointers but they do not expose the complexity & accessibility of pointers to the programmers.

Do all programming languages use pointers?

Technically, all languages use pointers. When you create an instance of an object in Java or C# or Javascript and pass it to a method you are actually passing a pointer to the piece of memory that contains that object by which you will manipulate the data on that piece of memory.

Should I learn pointers?

Yes. If they're using a programming language that exposes pointers, and they're developing non-trivial software, then they absolutely need to understand pointers.


1 Answers

At the very least you should teach references or some equivalent concept. I think you should probably take it easy on things like pointer arithmetic, c arrays and strings, but indirection is a very important concept in computer science, and students should be introduced to it.

like image 137
Brad Avatar answered Nov 09 '22 14:11

Brad