13 ms·
I teach at university as external lecturer. Teaching strings in C is the hardest thing I have to do every time. The university decided to explain C to first yea
by InvOfSmallC 6y ago
I teach at university as external lecturer. Teaching strings in C is the hardest thing I have to do every time. The university decided to explain C to first year student without previous experience. My feedback was to do a precourse in Python to let them relax a bit with programming as a concept and then teach C in a second course.
- austinl 6y agoMost of the C I wrote was while in college. I think understanding the question, "why are strings in C hard?" is a good gateway to understanding how programming languages and memory work generally. I agree with you though that teaching C as introductory is probably not the best — our "Programming in C" course was taken in sophomore year. I wouldn't want to use it my day job, but I'm glad that it was taught in university just to give the impression that string manipulation is not quite as straightforward as it's made to appear in other languages. The early days of Swift also reminded me of this problem – strings get even more challenging when you begin to deal with unicode characters, etc.
- c-cube 6y agoIt's also because other languages have better designed strings. D, go, rust, etc. have pointers too but their string handling is based on slices and arrays, which are approximately 10,000 times less footgunny.
- ritmatter 6y ago+1, my university's program seemed to work well with "program anything" (Python), "program with objects" (Java), "program some cool lower-level stuff" (C)
- _the_inflator 6y agoYep, agree. I used a lot of assembler on C64 and Amiga until I touched so called high level programming languages for the first time. For me thinking in strings was really a weird concept. Nowadays I find it extremely strange to think of bits and bytes when being confronted with strings.
- orwin 6y agoIn my school, we had two days to understand the basics of text editors, git (add, commit, rebase, reset, push) and basic bash functions (ls, cd, cp, mv, diff and patch, find, grep...) + pipes, then a day to understand how while, if/else and function calls work, then a day to understand how pointer work, then a day to understand how malloc(), free() and string works (we had to remake strlen, strcpy, and protect them). Two days, over the weekend, to do a small project to validate this. Then on the monday, it was makefiles if i remember correctly, then open(), read(), close() and write(). Then linking (and new libc functions, like strcat) . A day to consolidate everything, including bash and git (a new small project every hour for 24 hours, you could of course wait until the end of the day to execute each of them). And then some recursivity and the 8 queen problem. Then a small weekend project, a sudoku solver (the hard part was to work with people you never met before tbh). The 3rd week was more of the same: basic struct/enums exercises, then linked list the next day, maybe static and other keyword in-between. I used the Btree day to understand how linked list worked (and understand how did pointer incrementation and casting really work), and i don't remember the last day (i was probably still on linked lists). Then a big, 5-day project, and either you're in, or you're out. I assure you, strings were not the hardest part. Not having any leaks was.
- PoignardAzur 6y agoOoh, the Epitech cursus. Nice. Also, I'd say "not having segfaults" is the hardest thing to get right when you're going through that.
- reasonabl_human 6y agoEh, not really possible in my experience... more like ‘incidentally becoming a gdb wizard in order to be productive with C’!
- paganel 6y agoThis heavily filters for people who have had experience with programming in high-school or even before that, there's no way for a programming novice to pass that grueling routine. And then people rhetorically ask themselves why students coming from economically disadvantaged households are under-represented in this industry (one of the best paying industries in this time and age). Stuff like that has got to change.
- kazinator 6y ago> I teach at university as external lecturer. Teaching strings in C is the hardest thing I have to do every time. But if you keep up the good work you will one day go from extern void *lecturer; to static const lecturer;
- lvs 6y agoMore commonly volatile unsigned short lecturer;
- MaxBarraclough 6y agoIn C++ we'd have to decide if lecturer needs to support move semantics.
- offbyone 6y agoProbably just delete.
- kbenson 6y agoNot if they're tenured. Then you can assume they'll never move.
- swagonomixxx 6y agoProfessor(Professor&&) = delete;
- MikeTheGreat 6y agoMinor detail: lecturers don't get tenure. The job role of 'professor' may be able to get tenure (I think these roles usually do) but 'lecturer' really means 'full time temporary teacher, with a contract for a specified amount of time.
- ineedasername 6y agoI occasionally adjunct. What students call me at the beginning of the semester is always awkward: Them: "Hello Professor" Me: "Technically I'm not a professor." Them: "Okay, we'll just call you Doctor." Me: "Yeah, about that... not a doctor either." Them: "So why are we paying you?" Me: "Technically, you're paying the school. And the school is paying me... very little" Them: "Answer the question" Me: "Because I know stuff that you don't." Mostly they still just call me professor and I feel awkward every time.
- gravypod 6y agoSorry to bug you since this is unrelated. I'm a huge fan of teaching others and I was wondering how you got to be an external lecturer at a college? I'd love to teach classes related to software engineering and data structures. Would you mind emailing me (in my profile) about this?
- quickthrowman 6y agoI’d imagine you look for job openings for “adjunct professor” or “instructor” at universities. You can look forward to part-time employment with no benefits and no chance for tenure (this isn’t a dig at adjunct faculty, it’s unfair how it works in the US). Depending on the field of study and school, you need anywhere from bachelors to a PhD to qualify.
- InvOfSmallC 6y agoSo this is what happened for me: I went for a walk in the forest with my wife and some of her friends. There was one friend that had an husband working at university. We started talking and basically we discovered what he was teaching really related for what I do for work so he asked me to become a "mentor" meaning a professional that helps students with their thesys. In the meantime I went to talk during his class about product management as an engineer where basically I said "I'm an engineer like you, go and talk to customers, it's part of the job", plus extreme programming stuff etc... After that there was a position open and this professor recommended me because I told him it was one of my goals to be a teacher as well. And then from there I met the head of dept. He was happy with me being versatile, I usually handle C, database design or java. But the usual stuff is go to the university you like an look for open positions. I need to get confirmed every semester and apply again. Usually this job is done by people with a main job and sometimes it happens you don't have time in a semester.
- paganel 6y agoYou are a good teacher. 20 years ago I was in the exact situation of one of your students, i.e. I was put in front with the C language in the first semester of the first year. I barely, barely passed, failed with glory a similar course in the second semester which I only passed (with an A, to put it in US university terms) a couple of years later after I had managed to learn Python by myself in the meantime.
- InvOfSmallC 6y agoThanks! I just think that you can get out of practical programming concepts (like loops, conditions) without the need to understand that a string is an array of chars and that chars are actually integers. Because if remove the basics of programming with something like Python, you can fully concentrate on the second course on low hardware stuff, how to use memory etc..which is really important for my students, them being Electrotechnical engineers.
- cletus 6y agoIf I had to choose a language to teach programmers to absolute beginners, I think I'd actually go with Go. I understand the predilection for Python but there are some parts of Python that are just... odd.
- hguant 6y agoPython is great fun, and you can be really productive with it, but for people first coming into programming, a language with an explicit and strict type system is invaluable. I used to think that everyone should be taught python first, because it lets you focus on the meat of computer science - algorithms, data manipulation, actually _doing_ something - but after helping my girlfriend out with some comp sci 101-104 projects, I really think Go, Java, or Rust should be everyone's first language. It's hard for someone new to the field to understand the nuances that come with python's corner cutting. You can work yourself into some weird corners because of how permissive the language is, where in a (strongly) typed language, the complier just says no.
- kab_al_ashraf 6y ago> You can work yourself into some weird corners because of how permissive the language is, where in a (strongly) typed language, the complier just says no. Could you share an example?
- blahedo 6y agoHere's one my (intro programming, non-major) students have just been tripping over this week: if word == "this" or "that": ... Not an error, always runs. Very mysterious to a beginner. (Shared with C/C++) Another one: counter = "0" for thing in things: if matches(thing): counter += 1 The error is in the init, by someone who is overzealous with their quoting, but the error is reported, as a runtime error, on the attempted increment, which throws a TypeError and helpfully tells them "must be str, not int", and of course I know exactly why it's reporting the problem there and why it's giving that error, but it's a bit confusing to the newbie programmer and it doesn't even turn up until they actually test their code effectively, which they are also still just learning how to do.
- cblconfederate 6y agothats probably because pointers are considered "hard" , too hard to exist in other languages. It's interesting that in the 80s, the standard library modeled C++ iterators with pointer semantics because they assumed everyone could do pointer arithmetic, but nowadays the concept is not mainstream at all.
- kaba0 6y agoI don’t think the reason for hiding pointers is because they are hard — it’s just that arbitrary pointer arithmetics are especially error prone and can be avoided in most codebases.
- cblconfederate 6y agowell hard to get right anyway. in any case newer generations of programmers are less likely to be familiar with the pattern
- InvOfSmallC 6y agoBut that's point right? I have two hours per week for a semester. So basically I tried to be really fast at the beginning with if else and loops, gave then an exercise that counted towards final score and then it was pointers and pointers related stuff.
- monocasa 6y agoI've actually had more success teaching assembly as a first language than C. There's less magic, and you borderline have to start with the indirection of pointers in a way that people seem to grok a lot easier than the last month of the semester of learning C.
- exdsq 6y agoMy partner was on a doctoral training course at Oxford and they had to learn C over a few days; string manipulation is the hardest thing she remembers doing out of any medical science crash course they studied over 2 terms
- de6u99er 6y agoI am seeing Python becoming the go-to language for many academics because it's easy to hack something together that somehow works. Unfortunately most of those developers don't care much about efficiency and Python is out of the box inefficient compared to other high-level languages like Java [1] or C#. OO Java courses circulating in academia lack modern functional, and to be frank educational, concepts and must to be refreshed first. I personally would recommend to start with Java and Maven because it's still faster than C# [2], open source, and has a proven track record in regards of stability and backwards compatibility. Plus quickly introduce Spring Framework and Lombok to reduce boiler plate code. For advanced systems programming I suggest looking into Rust instead of C/C++. And last but not least the use of IDE's should be encouraged and properly introduced, so aspiring developers are not overwhelmed by them and learn how to use them properly (e.g. refactoring, linting, dead code detection, ...). I recommend Eclipse with Darkest Theme DevStyle Plugin [3] for a modern look. [1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python3-java.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... [2] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/csharp.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... [3] https://marketplace.eclipse.org/content/darkest-dark-theme-devstyle https://marketplace.eclipse.org/content/darkest-dark-theme-d...
- kaba0 6y agoI generally agree with you (especially on the update java guides), though I think it is important to teach C/C++ after some experience with a higher level language, if for nothing else, the large amount of already existing code bases. I also like the newfound interest in some FP languages, I for example had a mandatory Haskell course in first year — we did not take Monads in this course yet, but I think it is a great introduction for students for a different take from the more imperative world.
- toxik 6y agoPython and Java fill very different niches in the ecosystem. You're not going to cobble something together quickly in Java, the language just isn't designed to do that. Python is the software equivalent of cardboard-and-hot-glue prototyping, which is fairly common in academia.
- fho 6y agoQuestion: how do you teach for-loops? That is something I have a hard time convey as a teacher. My problem is that I have done this so long that I have no idea what there is not to understand about loops ... it's such a simple thing. But my (undergrad biology) students regularly have a hard time groking the concept no matter what explanation I use.
- dave84 6y agoNot OP but I'm teaching undergrad C. I'm assuming you have covered while loops before hand, if not, start there and cover the constructs with them that you would normally use a for loop for, example: int i = 0; //a while(i < 10) //b { printf("%d\n"); //c ++i; //d } and introduce for loops as a special case of the while loop: //a //b //d for(int i = 0; i < 10; ++i) { printf("%d\n",i); //c } Then outline situations when you would use a for loop over a while loop, fixed number of repetitions, use with arrays etc.
- InvOfSmallC 6y agoWell I took the time and made some simple animation of how that works. For that and pointers I use animation so they can visualize what's happening. (Wasn't my idea, I googled it "how to explain pointers")
- ajuc 6y agoI've studied IT in early 00s in Poland, the course was a little outdated, but it had some advantages. We've started from 0 with no assumption of any computer knowledge and first 2 years most courses were using Delphi (console only, no GUI stuff, basically it could just as well have been Turbo Pascal, some Linux enthusiasts used FPC instead of Delphi and it worked). We all complained that we want C++ then, but I've learnt to appreciate Pascal later. After first few months we've known every nook and cranny and there was very little corner cases and gotchas. So basically we focused on algorithms and not on avoiding the traps language set for us. Most people had no programming experience and after a few weeks they wrote correct programs no problem. I doubt this would happen if we started with C++ as most people wanted, and I think it's better than Python as a starting language because it teaches about static typing and difference between compile- and run-time. Sadly it's a dead language now.