6 ms·
I'm not sure how you can talk about concurrency without talking about locks and other such topics, which I think is very ambitious for new programmers. However
by apgwoz 18y ago
I'm not sure how you can talk about concurrency without talking about locks and other such topics, which I think is very ambitious for new programmers.
However, if universities start teaching programming with pure functional languages (which is highly unlikely), concurrency becomes a much easier topic for discussion.
Perhaps this is the sort of thinking that will lead to more universities adopting something like PLT Scheme, which in recent versions, has moved the notion of mutable pairs into a library. Doing this might bring functional languages out of academia and more into the mainstream, which would be fantastic.
I remember fellow students having trouble grasping pointers, even after a 2nd year architecture course, which I thought was completely absurd since they were writing assembly code without tremendous strain.
- stcredzero 18y agoOften when competent programmers are having trouble grasping pointers, they are actually doing fine with thinking about pointers in abstract, but having trouble with the notation describing a particular instance of them. (Especially with C programs.) One of the things that doing good OO and following the Law of Demeter does for you is to reduce the levels of indirection you have to deal with to one or two.
- lallysingh 18y agoWhat really helps in that situation is a good debugger, that lets you quickly look up blocks of memory (e.g. where the pointer references). Obviously it should be stable enough to handle bad pointers (giving an error message instead of crashing is nice). The old CodeWarrior debugger was great for this. Lots of windows you could pop up for every in-memory object you cared about. sigh
- a-priori 18y agoYou should take a look at ddd. I've never used CodeWarrior, but from your description it sounds a lot like ddd.
- lallysingh 18y agoddd's nice, but CW made it a lot easier to stay close to the machine-level. Nothing like a good window'd hexdump to browse :-)
- orib 18y agoFrom what I've seen helping people I know handle pointers, they're really actually having trouble with the concepts of pointers. Getting them to draw the box diagrams with pointers correctly is challenging. The notation is an extra challenge, but it's not the main difficulty. It's not the notation, it is the concept.
- stcredzero 18y agoOnly time I've seen difficulty with pointers in the abstract is when helping people in intro programming classes in C. Once you're past that level, programmers get it, but they get confused by what the code is actually saying.
- crabapple 18y agoI'm not sure how you can talk about concurrency without talking about locks that is because you have slept through the entire revolution of share-nothing concurrency
- 13ren 18y agoPlease elaborate.
- crabapple 18y agosearch "shared nothing concurrency"...read sutter's "the end of the free lunch"...
- bdotdub 18y agoI don't see how share nothing concurrency solves the "problem" of learning about locks. While locks in a share nothing concurrency architecture is not a problem, it is in other concurrency setups (you know, like threads?)
- apgwoz 18y agoI think his point was that you don't need to learn about locks to learn about concurrency, which is a valid point. The problem with the point, at least as I see it, is that first year programming classes (at this point in time at least) do not teach languages that have concurrency models that really support it, nor do they eliminate the problem of synchronization by providing immutable data structures. I, just this afternoon, heard Guy Blelloch give a talk about Parallel thinking today, and he seems to support the idea of teaching parallel programming throughout the curriculum almost instead of sequential programming--making sequential thinking the oddity. I think this makes sense, but it obviously has some flaws...
- bdotdub 18y ago* do not teach languages that have concurrency models that really support it* I don't know that I agree with that at all. My first college CS class taught Java, definitely supports concurrency. It's not Erlang-like concurrency, but concurrency nonetheless. Theres a trend to start teaching Python as a first language, that supports it as well.
- bdotdub 18y agoI'm not sure how you can talk about concurrency without talking about locks ... which I think is very ambitious for new programmers. I agree. I don't think it should start from CS1, but you can start with the Dining Philosophers problem in CS1 to introduce the ideas of locks and starvation.