Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/10/08 06:58
Read: times


 
#160809 - ... and that is the problem with many products ...
Responding to: ???'s previous message
Per Westermark said:
I don't want to be blunt, but you always seem to miss the point. Assembler is great for producing small and/or fast programs. But the programs will only be small and/or fast if the programmer is skilled enough. If I have access to a programmer that can produce a 10kB working and sellable program in C, or can produce a 3kB broken disaster in assembler, then it really does not matter if the real solution could be fitted into 1kB of carefully crafted assembler. I go for the 16kB chip and collect the money from the customer.

Once your customer figures out what you've done, he probably will call someone else for any follow-on work he may have, since you've increased HIS cost for YOUR convenience.

It's no different with 'C' or Pascal, or with BASIC. If the programmer can do his job, he'll usually do it. My experience has been that the majority of programmers can't. They can't program in 'C' any better than in ASM. Most HLL programmers take longer to produce a work product than a competent ASM programmer would take. Now, that's because of the culture associated with today's HLL's and the folks who use them for small tasks, rather than with the language. Just look at the crap that's presented here! Hundred-line 'C' programs to do what could have been done in 15 minutes in 'C', Pascal, Basic, or ASM, if the programmer had understood the task and known even the minimum about his MCU. I see the separation from the host architecture that HLL's provide as the problem, rather than the solution. If the guy were programming ASM, he'd get nowhere at all until he learned the architecture. HLL's are a tool, and not a shortcut! Further, it's not possible to get faster or smaller code from a compiler than can be written in ASM. It's very seldom, indeed, that what a compiler produces is anywhere as small or as fast as what a competent programmer can produce in ASM. If the programmer can't program in ASM, he's simply not competent. ASM is simple and utterly straightforward to understand. Once one has learned the MCU and the instruction set, anything is possible, and, not only that, it is easy to understand. With HLL's, things vary from compiler to compiler, and from implementation to implementation. Few people use all the features of a HLL, yet the compiler must account for all possible ways of expressing oneself. That's true of ASM, too, but it's simple to use an assembler, whether one uses all the instructions or just a subset.

Look around you: Even if you wanted to, you can't employ truly talented and experienced developers for ASM jobs, if your goal is to go 100% assembler. A tiny fraction of the programmers of this world can write anything at all in assembler. And a tiny fraction of them will produce "good" code. That is a huge reason why it doesn't matter what you say that you can do in assembler. What matters is what tools that will end up in food on the table.

A competent programmer can program, whether in 'C' or in ASM, and an incompetent one can't. If he can't do it in ASM, however, it's unlikely he can do it in 'C' or any other language on one of these small MCU's.

A C solution may consume 300% more processor capacity to solve a problem. But most probably the hw cost will be the same. And the delivery times will be faster. And the original developer can be replaced. The only loser might be the environment, in the form of slightly higher energy costs. Most companies accept that.

So, you don't believe that it's a loss to the company paying for the product development if the processor resource (MCU, ROM, RAM) cost goes up by 300%? I'd bet the management will disagree. Yes, HLL's allow for a lot of crap to be on the market very quickly. Doing the job well takes time, and not just in ASM. Moreover, I've found that, for one example, doubling the speed makes some things work much better and more easily. Likewise, slowing down the code, not because the clock is slower, but because the code is not as thrifty with time, can make some tasks impossible in HLL. The result is that they have to be written in ASM. Fortuantely, that is possible.

I'm persuaded that ASM is the only avenue that can be used to "make it fit."


You may write a top-of-the-line assembler implementation. And you may still produce the larger solution if the C developer went for a little byte-coded virtual machine - each byte of a byte-coded VM can be specifically optimized for a problem and hence contain more problem-related information than assembly instructions.

Perhaps, but how often is that done? A few comments can take care of any missing information in an ASM program. Most of the 'C' I've had to read/review, lacks enough even to name the algorithm in use, let alone clarify how it's implemented.

Yes, after thinking about the VM, you can rewrite it in assembler and cut away a few percent of the total size. But if you didn't think about it, then you lost on algorithm - not on language.

I prefer a developer who always selects the best algorithm for a job, than a developer who always writes the smallest, or the fastest code.

I worked with a couple of products programmed in PLM-51. Two years later, they had quite a lot of new features, but more free space than when I got them in my lap. I have worked with C projects where I got a full unit, and then regularly got requests to add new featues. Yes, I know what it means to run out of space. But this is not applicable to all projects. And the skill of the original developer does affect the code size a lot - in any language. I often take the cost of fighting for the last bytes of code when I know that that is the only acceptable solution to the problem.

I suppose it looks different to the guy who has to write the code than it does to the guy who has to pay for the code space with each unit. I haven't kept up on the cost impact of, say, doubling the size of the program store. However, I doubt it's free. If you're not afraid to use code that's writen in 'C' but demands 300% of the MCU capability in either code space or performance, I'd like to know what you'd do if you were in my place. I have a piece of code right here that I'm working, and it's 61KB in size, with lots of table space, written in ASM and which uses every last bit of performance I can wring out of this 805x-type MCU and its capabilities in order to meet requirements. Do you think I should attempt to rewrite it in Pascal, BASIC, or 'C'?

I'm not trying to be difficult. I have written huge amounts of code in assembler. And I have rewritten the code again for another processor. And again for yet another processor. And in several cases I have failed to sum up any real gain from the original use of assembler. The total life-time bottom line for the product has indicated that I should have written the code in C. How fun is it to deliver a product and five or ten years later still have the same product on your table because it contains assembler, and if the code is shown to another developer they look like a deer in the headlight? How fun is it to fight a critical deadline with one project and then find out that this old product needs a new feature added now and no one who can do it?

It's the lack of adequate documentation that makes most programmers called upon to perform product maintenance or upgrades shiver. That's consistent everywhere, whether the product is coded in ASM or in HLL.

Companies think bottom-line, not number of bytes or clock cycles saved. And they do not like one-man-shows, where they get stuck if someone gets run over by a truck.

That's a problem, perhaps, but experience has taught me that competent programmers are always a one-man-show, since they're very scarce. They seldom work well with others, but, provided with proper specifications, a good programmer can produce, typically, 1000 lines of properly documented, debugged, and ready-for-acceptance-testing, code per week, whether it's 'C', ASM, or COBOL. Competent programmers who can/will properly document their code are even scarcer than you probably realize, though. Managers who insist on it are pretty rare, too.

So yes, I still claim "Maybe". Maybe if the developer is good enough. Maybe if the developer is even possible to find. Then ASM may produce a smaller and/or faster program. Probably without any receivers who cares.


They only care when they have to pay for the additional resources the HLL demands. It's good if there aren't any, but if that's the case, perhaps the hardware has been incorrectly sized.

RE



List of 50 messages in thread
TopicAuthorDate
Which programming language is the best?            01/01/70 00:00      
   depends on compiler            01/01/70 00:00      
   Who is "we"            01/01/70 00:00      
   Creativity            01/01/70 00:00      
      Responding to Andy Neil "Who is we?"            01/01/70 00:00      
         apples and oranges            01/01/70 00:00      
            Re: apples and oranges            01/01/70 00:00      
               Correct            01/01/70 00:00      
               Calling conv more depending on target than language            01/01/70 00:00      
                  Re: Calling conv...            01/01/70 00:00      
         not the rule            01/01/70 00:00      
   Do you think Spanish is better than Mandarin?            01/01/70 00:00      
      Concise?            01/01/70 00:00      
         fair question            01/01/70 00:00      
            Maybe            01/01/70 00:00      
               There is no question about it!            01/01/70 00:00      
                  Does it work ?            01/01/70 00:00      
                     Unless it impacts cost ...            01/01/70 00:00      
                  Bottom line            01/01/70 00:00      
                     ... and that is the problem with many products ...            01/01/70 00:00      
                        Not true            01/01/70 00:00      
                           low-volume/high-volume tradeoffs            01/01/70 00:00      
                        Bottom line price is more than just consumed kB code space            01/01/70 00:00      
            Oh no, not that old chestnut            01/01/70 00:00      
               Assembler and processor size            01/01/70 00:00      
                  Is that relevant to this environment?            01/01/70 00:00      
                     Human brain            01/01/70 00:00      
               You will have trouble convincing me ...            01/01/70 00:00      
                  I agree with you there!            01/01/70 00:00      
      Re: Spanish better than...            01/01/70 00:00      
         That's the point!            01/01/70 00:00      
         not so            01/01/70 00:00      
   In a war which is the best weapon ?            01/01/70 00:00      
      the language in which programmer feels comfortable            01/01/70 00:00      
         Comfort is not the issue!            01/01/70 00:00      
            true, but            01/01/70 00:00      
         It's about the right tool(s) for the job            01/01/70 00:00      
   My two cents            01/01/70 00:00      
      If it fits ...            01/01/70 00:00      
         that is (ir)relevant            01/01/70 00:00      
            What is small?            01/01/70 00:00      
               Would that be appropriate on 805x?            01/01/70 00:00      
                  more on big/small series            01/01/70 00:00      
                     Does this approach fit 805x and other small MCU?            01/01/70 00:00      
                        Already have full Linux solutions too            01/01/70 00:00      
   Yes..C and asm is the best            01/01/70 00:00      
   I prefer KEIL U2V , C programming language.            01/01/70 00:00      
      Magic with Kel C?            01/01/70 00:00      
      Makes no sense!            01/01/70 00:00      
   Pascal is not dead            01/01/70 00:00      

Back to Subject List