Q: I am writing an MFC based calculator but the b****** teacher wants me to put the functionality of the buttons in a seperate class called CCalculator. I got the calculator working using just one class, "mainframe" but when I try to move the functions to the seperate class I can't make it work. I should preface this with the fact that I can't program to save my arse and I'm only doing this because it is a required class for my real degree of computer engineering but two assignments stand between me and my degree and this is one of them.
A: Actually, I wrote a calculator some years ago that did that; it seemed the obviously correct decomposition. I rewrote it in C# a few months ago, and decomposed the CCalculator into classes for memory management, program execution, display management, and event handling. The point of the exercise is to understand what is meant by modularity. So your problem is that you are probably trying to put button handlers in your class; what you want to do is put the *functionality* of the buttons in the class, not the buttons handlers themselves, which have to be in the class of the window that contains them. If you can't program, perhaps you should consider another "real degree". I've had to deal with computers and computer peripherals created by people who have no idea what programming is about, and they are nightmares. If you can't program, you are in deep trouble already. No "computer" or hardware device exists in isolation, and the point where their functionality meets application need is called "programming". I've hung out with hardware designers for probably half my career, and indeed I've written the code to control devices that had never before existed. A good friend is a senior engineer at a major communications device manufacturer, and he has NOTHING good to say about computer engineers who don't know how to program. Because they build devices that cannot be programmed! And then hand them to him to make work in the context of a major product (such as a switch or router) Besides, most hardware devices I know of today have embedded processors in them which have to be programmed. And the difference between a FPGA (field-programmable gate array) and a program is fairly small, so small I don't detect it. One of the better programmers I know is also one of the world's experts on the programming of FPGAs, but they have to communicate to real computers and they have to be designed in a fashion that is programmable by said machine. If you don't know how to program, you can't build hardware that is usable. (And yes, I've done some small FPGA projects, one of which was for him.) A senior aerospace engineer pointed out to me that he hasn't designed a chip in at least 15 years. He writes programs, which some automated process takes and lays out on silicon. VHDL (Very High-level Design Languages). "I love it" he says, "chip design and it is merely programming". The advantage, of course, is that the entire "program" has been executed and debugged before the first silicon is ever cast. If you expect to ever do engineering at a major firm, you had better learn how to program. Nobody actually lays out silicon these days. The folks I know who design disk drives have written complex programs to simulate magnetic domains, read/write heads, etc. and they do this at the physics level. They know exactly what a particular head geometry can do, because they've written the code to prove it. What they're left with is designing heads that are actually manufacturable in mass quantity. I've designed peripherals in the past, and even toy computer-like devices. I've built hardware, and debugged it with osilloscopes and logic analyzers. And as a driver writer I've been a victim of hardware created by people who don't know how to program. Computer engineers who can't program are dangerous. Learn how to do it. Otherwise, you'll be in trouble. I don't know a single good hardware engineer who can't program. Sometimes it is only to program simulations of their devices before they commit them to silicon. This is not something you need to "get through". This is a skill you will need throughout your career. Learn it and learn it well. I don't care what aspect of "computer engineering" you end up in, you'll end up at some point having to write code. Or deal with those who do, and you need to understand what they need.
Most Popular Articles
- Home Improvement
- Income Tax