4 ms·
I'm going to go off at a tangent here and rant a bit. Firstly, "C" is not a difficult language. When you compare it to the difficulty of say elementary calculu
by Untitled 16y ago
I'm going to go off at a tangent here and rant a bit.
Firstly, "C" is not a difficult language. When you compare it to the difficulty of say elementary calculus, you will notice that the concepts are simple.
Any person who studied computer science and do not know how a pointer works (or how to represent an access an array with a pointer) is grossly incompetent. C does not hide the basic programming concepts behind a nice IDE which you double click to type your portion of code.
I recently had another problem (with one person who was busy with a Masters degree at a fairly prestigious technology university). The project involved having video updates. I wrote a demonstration that performed the computation in a “while(1)” loop (i.e. fetch frame, do processing, display frame). The person was involved in writing a simple GUI program.
I tried to explain to him that he cannot use a “while (1)” loop in the event handler of the button that should start the event. Even drew nice graphs on a board explaining all about the thread of execution and how event handling usually works (e.g. a loop that handles events and call functions).
After 30 minutes of explanation the person came up with a very bright idea. He said that “Maybe we should set a sleep(1000) command in the loop to give the program time to react”. WTF?
- davidw 16y ago> Firstly, "C" is not a difficult language. Compared to other programming languages - most of which are significantly more complex than hammers. My 2 and a half year old daughter knows what a hammer is and has an idea of how to use it. I'm proud that she can point and say "C for cat!", but that's about the extent of her knowledge of the C programming language. Also, yes, C is a fairly simple language, but that doesn't mean that it's necessarily easy to use compared to other languages, that do nice things like GC.
- mattmcknight 16y agoIt's not so much the c language that is difficult, it's just that it tends to be more difficult to construct large programs with it, because it is a lower level abstraction than other languages. This gives more flexibility in memory management, etc., but also requires you to actually do it. (c is to higher level languages, as ASM is to c). I, for one, enjoy languages (and even frameworks) with sensible defaults, so the normal case is handled for you, but that let you override that default behavior or even drop down into a lower level language when needed.
- Untitled 16y agoThat is not the biggest problem. My problem is that people do not understand basic things (which higher-level programming languages hide). One thing is pointers (e.g. how a matrix is represented in a language) and another is the flow of execution. I understand that the utility of C is low when we are talking about web-applications. But the fact is that the concepts should be known. Everyone who writes event-based programs should at least have a rudimentary idea of how it works.
- tjr 16y agoAny person who studied computer science and do not know how a pointer works (or how to represent an access an array with a pointer) is grossly incompetent. Maybe so, but such folks exist in droves. C isn't hard, but it looks simpler than it is, and this clever disguise catches a lot of people off guard. And even so, there seems to be a practical difference between understanding C and having the discipline to use it correctly in the midst of a real project.
- kenjackson 16y agoI don't understand... don't you get a "ButtonClickedEvent" when the button is clicked? Why would he think he needs a while(1) loop in the button? Am I missing something? UPDATE: After rereading it... you guys are actually implmenting the button. Although surely you're not implementing the whole mouse stack... so I'm still confused :-)
- Untitled 16y agoHere is a very bad pseudo-code demo illustrating the problem and the proposed solution: http://pastie.org/1247590 http://pastie.org/1247590 I'm beginning to suspect that the willful incompetence on their part is maybe just a scheme of many to get others to do the work. Suspected a bit of professionalism from people who are about to graduate with master degrees.
- deleted 16y ago[deleted]
- wmil 16y agoI think the guy copied the video processing loop into the event handler. So the event handler goes into a while(1) loop instead of starting a new thread/process to do the video processing. That will lock the GUI and make the app unusable.
- kenjackson 16y agoOK, so from looking at the code, only DrawNow needs to be on the UI thread (unless DrawNow is actually not drawing to the screen). That makes sense. One thing to note though, the grad student may not be familiar with a model where UI is on a specific thread. I know some of the past systems I used had the rental model (even WPF had it early on), so maybe, giving him the benefit of the doubt... this is what he was thinking about (and assumed you had acquired all the correct locks in your code)?