Hacker News new | past | comments | ask | show | jobs | submit login
Principles of Imperative Computation (cmu.edu)
50 points by ggr2342 on June 25, 2023 | hide | past | favorite | 31 comments



"Principles of Imperative Programming" is a misnomer.

The course is really about developing techniques for reasoning about low-level software. You build up abstractions in C by leveraging contracts and writing proofs of correctness based on those contracts.

Explore the "Learning Objectives" section to read about what the course really entails: https://www.cs.cmu.edu/~15122/about.shtml#LO

This was the first computer science course that I took at CMU and it was absolutely mind blowing for me. I had previously taken AP CS and had played around with making games in flash and writing little programs for my graphing calculator. But this course taught me how to reason about my programs (and why that might be valuable, to begin with).


> You build up abstractions in C by leveraging contracts and writing proofs of correctness based on those contracts. […] this course taught me how to reason about my programs

That seems like an essential part of what programming should be about? And imperative programming has it’s own considerations on how to go about it. I don’t see how it is a misnomer.


How is it a misnomer?


This is a bit of a tangent, but I read the prerequisites for this course and felt the same annoyance that I did when I was in college.

I didn’t major in CS, but I wanted to take some CS classes. Several times I had to go back and forth with the course instructor and the director of undergraduate studies in the department, trying to convince them to let me take the class, or at least audit it or get access to the course materials if it was filling up.

I was mostly successful, but there were a couple times where I was told I simply could not take the class because I didn’t take the prerequisite. As a lifelong computer nerd and capable programmer, I could have sat the exam for the prerequisite classes without preparation and passed, but they did not allow this.

If there are open spots in the classes after all the CS majors signed up for it, then why not just let anyone take it if they’re up for the challenge? You can warn them about the prerequisite knowledge, so if they fail it’s completely on them.


There is an option to circumvent the prerequisites as a non-major:

  You may also get permission from an advisor if you performed very high on the CS Assessment on Canvas.
I took the course over the summer as a music major and subsequently took several other CS courses as a music major after having a discussion with an advisor in the CS department. I ended up finishing a CS degree a year after my music degree. CMU was really great about providing opportunities for students to explore courses outside of their majors, especially over the summer.


This varies by school. Some will allow you to skip prereqs with instructor or advisor permission, some make that almost impossible. Some may allow you to audit the course but not take it for credit.

Honestly for the larger CS classes I took, there were enough people in the class that I doubt anyone would have noticed a person slipping in to a back row seat and just quietly watching. More than once I sat in on classes that I thought I might want to take, to get a better sense of the content and the professor's teaching style.


It's not because they're idiots. It's because they want more money and although perhaps they lose your money (probably actually not as you'll take something else), there is more overall in putting up fences that lock people in for many classes.

I'm working on a Masters in Economics right now and laughed when they tried to make me take a pre requisite in college math that covered stuff like functions...when I have a bachelor's in engineering and had to take differential equations and multiple years of calculus. I told them flatly it wasn't going to happen and they rechecked and waived it as not being necessary. In your case, they can't see accredited proof of your years of programming experience and the beauracracy doesn't care enough to let you sit for the exams in the other class.


Pre-reqs are a simple way to ensure everyone in the course is starting at about the same place. Its very hard to teach a course if some students are lacking the foundational material you're building on.


But if you make a capable student take the pre-req as a box-ticking exercise, then they often enter that class (edit: the pre-req class) way ahead of everyone else.


That's what your advisor is for. And if your advisor doesn't help, speak with other faculty members. You're responsible for your own education in college, you're an adult (normally, and if you're that precocious that you're a child in college your progress will be very different from the norm anyways). In the ideal world you get a good advisor (like I did, skipped several 2xxx level math and CS courses as a consequence; still took the same number of courses to graduate). But you could also have a shitty advisor (like I did at first) so you have to shop around and find someone who will help you. Form relationships with faculty members in the department, demonstrate your competence so they can advocate for you to your advisor as well.


As a non-major, I did not have access to an advisor in the department. My general advisor was for the liberal arts college (which I belonged to), and he did not have any sway in the engineering college.

I ended up getting to know one faculty member and having them back me up when I needed it, but it was still a bureaucratic mess every time. Meanwhile in my own major’s department, anyone could basically sign up for any class freely, as long as they agreed to accept the consequences of not being prepared enough.


I was pushing back at the parent comment suggesting pre-reqs are some big conspiracy.

If a university blocks someone who is capable, but lacking pre-reqs, from taking a course there is no real cost to them, and little to the student. (At least for me there were more courses I was interested in taking than I had time to take.)

If a university lets someone take a course without pre-reqs, and that person lacks the required foundation and does badly in the course, it's bad for the student (time wasted) and bad for the university (disruptive to the course, bad in University ranking exercises).

Pre-reqs are not perfect, but it's also hard to assess what all potential students are capable of before before taking a course in the same way that job hiring is difficult. So they are a reasonable approach.


Why?

If retaking a prereq is a huge boost for you, you didn't learn it well the first time.


My last comment was a little ambiguous, sorry. I meant that you’ll often enter the pre-req well ahead of the others.

In many of my early college classes, there were people who already knew most or all of the material and were just there because they had to be.


This is why I’m glad I did not major in CS. I would have had to take all of these prerequisite classes to graduate at all, not just to get into more interesting classes.

I guess the rules make sense, but it does seem silly that I ended up better off studying something random and getting a job as a software engineer, than actually studying specifically to be a software engineer.


I also tried to get around prereqs in college (for EE rather than CS) and I was told by the professor that "It would not be good for the university." I believe my university had previously been in trouble with ABET, the accrediting organization, perhaps for the very issue of being too lenient with prerequisites. Apparently ABET wasn't invented to give people opportunities to learn, but to control who has those opportunities based on arbitrary criteria (like GPA).


> You must have gotten a 5 on the AP Computer Science A exam

> or passed 15-112 (Fundamentals of Programming)

> or equivalent.

> You may also get permission from an advisor if you performed very high on the CS Assessment on Canvas.

Maybe they feel that people who have trouble reading a syllabus would have trouble completing the course?


Prerequisites are mostly fake. You can just study what you need - depth first learning (assuming you are open to self-studying and this is not about academic bureaucracy)


Is this about Design by contract? [0] But why do they force students to use an imperative language?

[0] https://en.wikipedia.org/wiki/Design_by_contract


It's not about generating code from contracts, it's about formally verifying that the associated C0 code satisfies those contracts.


It's only about the course, not about principles of imperative programming.


It links to the individual lectures' notes and slides, as well as tutorial and documentation for the "C0" language...


Step 1: Go from the top.

Step 2: See a function.

Step 3: Ctl+Click on it.

Step 4: Read the code.

Step 5: Go to step 1.


If your codebase has zero documentation, yes indeed.


Documentation isn't a substitute for reading the code, and the best place for documentation is in the same file as the code.


Only Jira ticket numbers. Sometimes even a ticket title.


Ah yes, that's exactly my working situation.


Do you work at my firm :) the "documentation" is "ask the guy who wrote it, if they're still employed" ahaha


It's not really complex enough to require a full university course, is it now.


Teaching programming alone usually takes up several courses in a Computer Science programme. Why would reasoning about programming be any simpler? This course is about reasoning techniques for imperative programming. E.g. loop invariants, preconditions, postconditions, and so on. I imagine you could fill many University courses with all the verification community has to say about this topic.


What is 'it'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: