tag 标签: programs

相关博文
  • 热度 23
    2013-6-27 18:27
    1529 次阅读|
    0 个评论
    I recently got back from three weeks overseas. Despite daily trying to keep up with email, some just has to be done from the office; other items are less important and not worth dealing with from the road. So my e-mail inbox is stuffed to explosively-dangerous levels, the desk piled high with papers needed attention, and the voicemail is, well, happily minimal. E-comm has, for me at least, almost entirely replaced the phone over the last decade or so. A couple of coding themes have popped up, though, from reading clients' code and e-mail from various correspondents. First is an increasing trend I'm seeing where developers rely on an exquisite knowledge of precedence rules in C, usually inside of if statements. A generic example: if( variable1 operator1 variable2 operator2 variable3)do_something; Absent parenthesis to group elements of this expression, the result may be very surprising. The statement: if( variable1 variable2 == variable3)do_something; probably won't do what is expected. Ditto for: if( variable1 variable2 variable3)do_something; I strongly believe in using parenthesis in any instance where there is the slightest possibility of confusion. Cost: zero. Benefit: possibly saving a lot of debugging and maintenance time. (In fact, the code I read while traveling incorrectly combined operators and was the source of a long-lurking bug. That "exquisite knowledge precedence rules" was sorely lacking. There's a lot of complexity to the C standard, and it's a bad idea to assume one's own perfect understanding, or that of a colleague or future maintainer). Another construct that keeps surfacing looks something like: #define TIME 28*60 // Comment of some sort // This value may not exceed                      // 1800, for some reason The good news is that the max limit is carefully commented. Assume that TIME is defined in seconds; 28*60 is not a bad way to express 28 minutes in a clear way. However, this construct puts the burden of proving 28*60 1800 on the developer; later hurried changes, say editing 28 to 31 to meet some requirements change, will bust the limit. Add this: #if TIME 1800 // Enforce the 1800 second limit #error TIME exceeds 1800 seconds #endif Now the compiler will enforce the limit. (Some may encode the 1800 into its own #define). Further, TIME is a terrible name; since it has units, those units should be encoded in the name so later code doesn't confuse seconds with minutes, hours, or fortnights. Better: TIME_SECONDS. (I was at an Ada convention in Berlin on this trip; the careful use of Ada's strong typing makes such a mistake impossible.) Finally, frequent correspondent Bandit sent this link: http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ . Turns out, a scary number of developers can't construct the simplest programs in an interview test. Frankly, at first I thought the article a troll as such incompetence seems unlikely. Readers' comments though, in many cases prove the thesis. Surely there are others are far more capable than that article suggests.  
  • 热度 16
    2011-4-10 21:01
    1575 次阅读|
    0 个评论
    O death, where is thy sting? O grave, where is thy victory?   Those words ring with Shakespearian power. Hamlet ? King Lear ? Actually, the quote comes from the New Testament .   I imagine the Bible is the most-quoted book of all time. My parents would paraphrase a parable or cite a verse to make a point or correct our behavior. The nuns at St. Camillus did, too, and a sure way to curry favor with them was to quote chapter and verse. Even the most secular couples often use 1 Corinthians 13 in their weddings.   The world abounds in aphorisms that convey wisdom to the young, although that advice is usually ignored. Many aphorisms are by unknown authors: "A stitch in time saves nine" (although anyone who has repaired a sail knows that one stitch can actually save 9,000). "People who live in glass houses shouldn't throw stones." And many witty people have contributed their own, like this gem from Mae West: "Lead me not into temptation; I can find the way myself."   Pithy quotes and aphorisms can entertain and instruct. Often they do both.   Engineers can turn a clever phrase as well as Mae West. I've collected quips that relate, sometimes unintentionally, to development for many years. Here's some of the best:   Testing by itself does not improve software quality. Test results are an indicator of quality, but in and of themselves, they don't improve it. Trying to improve software quality by increasing the amount of testing is like trying to lose weight by weighing yourself more often. What you eat before you step onto the scale determines how much you will weigh, and the software development techniques you use determine how many errors testing will find. If you want to lose weight, don't buy a new scale; change your diet. If you want to improve your software, don't test more; develop better. —Steve McConnell   Programming can be fun, so can cryptography; however, they should not be combined. —Charles Kreitzberg and Ben Shneiderman   The sooner you start to code, the longer the program will take. —Roy Carls   Our developers never release code. Rather, it tends to escape, pillaging the countryside all around. —The Enlightenment Project   Perl is the crystal meth of programming: it's so incredibly useful when you need to do a large amount of work in a small amount of time that you tend to overlook the fact that it's basically precipitating the implosion of your vital organs. —Dan Martinez   Programmers are the tools for converting caffeine into code. —Unknown   If you lie to the compiler, it will get its revenge. —Henry Spencer   There are only two industries that refer to their customers as users. —Edward Tufte   Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. —Fred Brooks, Jr.   To iterate is human, to recurse divine. —L. Peter Deutsch   Good judgment comes from experience, and experience comes from bad judgment. —Fred Brooks   There are two ways to write error-free programs; only the third works. —Alan J. Perlis   When Leo Tolstoy wrote Anna Karenina, he could have been thinking about cubicles: "there are no conditions of life to which a man cannot get accustomed, especially if he sees them accepted by everyone around him." —Leo Tolstoy   The real value of tests is not that they detect bugs in the code but that they detect inadequacies in the methods, concentration, and skills of those who design and produce the code. —C.A.R. Hoare   The most important single aspect of software development is to be clear about what you are trying to build. —Bjarne Stroustrup   Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris. —Larry Wall   I did say something along the lines of C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows your whole leg off. —Bjarne Stroustrup   There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. —C.A.R. Hoare   Any fool can use a computer. Many do. —Ted Nelson   Trying to outsmart a compiler defeats much of the purpose of using one —Brian W. Kernighan and P. J. Plauger   UNIX is simple. It just takes a genius to understand its simplicity. —Dennis Ritchie   Putt's Law: Technology is dominated by two types of people—those who understand what they do not manage and those who manage what they do not understand.   An organization that treats its programmers as morons will soon have programmers that are willing and able to act like morons only. —Bjarne Stroustrup   Theoretically, software is the only component that can be perfect, and this should always be our starting point. —Jesse Poore   Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. —Damian Conway   Documentation is a love letter that you write to your future self. —Damian Conway   If you think good architecture is expensive, try bad architecture. —Brian Foote and Joseph Yoder   Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: nothing works and they don't know why. —Unknown   If the code and the comments disagree, then both are probably wrong. —Unknown   Those who want really reliable software will discover that they must find means of avoiding the majority of bugs to start with, and as a result, the programming process will become cheaper. If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. —Edsger Dijkstra   In theory there is no difference between theory and practice. In practice there is. —Yogi Berra   For a successful technology, honesty must take precedence over public relations for nature cannot be fooled. —Richard Feynman   One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs. —Robert Firth   Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.   PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals. —Jon Ribbens   If you want a girlfriend, avoid working in the computer games industry like the plague. If you work seven days a week, 15 hours a day for almost two years, with barely enough time for a pint, you have no time whatsoever for relationships. Plus computer-games makers are regarded as being about as hip and cool as abattoir workers. —Toby Gard   Your problem is another's solution; your solution will be his problem. —Unknown   Embedded lines of code are growing 26% annually but developers are increasing by 8%. —Venture Development Corporation   Productivity can decrease by as much as 25% when workers put in 60+ hour weeks for a prolonged time. And, turnover is nearly three times higher among workers who work extended hours. Absenteeism among companies with extended hours is more than twice the national average. —Reworded from Circadian Technologies Shiftware Practices 2005 survey   There's a fine line between being on the leading edge and being in the lunatic fringe. —Frank Armstrong   Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. —Albert Einstein   Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. —Jamie Zawinski   The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry. —Henry Petroski   One test is worth a thousand opinions. —Unknown   If the lessons of history teach us anything it is that nobody learns the lessons that history teaches us. —Unknown   The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. —Bertrand Russell   Debugging is like alien abduction. Large blocks of time disappear, for which you have no explanation. —Unknown   Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. —Alan Kay   If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. —Gerald Weinberg.   Ugly programs are like ugly suspension bridges: they're much more liable to collapse than pretty ones, because the way humans (especially engineer-humans) perceive beauty is intimately related to our ability to process and understand complexity. A language that makes it hard to write elegant code makes it hard to write good code. —Eric S. Raymond   Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. —Donald Knuth   The most unsuccessful three years in the education of cost estimators appears to be fifth-grade arithmetic. —Norman R. Augustine   No engineer looks at a television remote control without wondering what it would take to turn it into a stun gun. No engineer can take a shower without wondering if some sort of Teflon coating would make showering unnecessary. To the engineer, the world is a toy box full of suboptimized and feature-poor toys. —Scott Adams   I love deadlines. I like the whooshing sound they make as they fly by. —Douglas Adams   In handling resources, strive to avoid disaster rather than to attain an optimum. —Butler Lampson   There are various reasons that software tends to be unwieldy, but a primary one is what I like to call "brittleness". Software breaks before it bends, so it demands perfection in a universe that prefers statistics. —Jaron Lanier   People tend to overestimate what can be done in one year and to underestimate what can be done in five or ten years. —Joseph Licklider   Code generation, like drinking alcohol, is good in moderation. —Alex Lowe   Do you have favorites? Share them, too.
相关资源
  • 所需E币: 1
    时间: 2022-7-23 18:17
    大小: 10.43KB
    上传者: Argent
    TXD-RXDQuickstartPrograms
  • 所需E币: 0
    时间: 2022-1-22 17:52
    大小: 51.29MB
    上传者: samewell
  • 所需E币: 0
    时间: 2020-9-7 22:46
    大小: 309.5KB
    上传者: samewell
    Chapter7writingtheprograms
  • 所需E币: 0
    时间: 2020-9-7 22:47
    大小: 844KB
    上传者: samewell
    Chapter8testingtheprograms
  • 所需E币: 0
    时间: 2020-5-31 09:46
    大小: 2.49MB
    上传者: 星空下的屋顶
    StructureAndInterpretationOfComputerPrograms.pdf
  • 所需E币: 5
    时间: 2019-12-25 15:02
    大小: 174.11KB
    上传者: 978461154_qq
    ThereareseveralwaystocalculatetheDiscreteFourierTransform(DFT),suchassolvingsimultaneouslinearequationsorthecorrelationmethoddescribedinChapter8.TheFastFourierTransform(FFT)isanothermethodforcalculatingtheDFT.Whileitproducesthesameresultastheotherapproaches,itisincrediblymoreefficient,oftenreducingthecomputationtimebyhundreds.Thisisthesameimprovementasflyinginajetaircraftversuswalking!IftheFFTwerenotavailable,manyofthetechniquesdescribedinthisbookwouldnotbepractical.WhiletheFFTonlyrequiresafewdozenlinesofcode,itisoneofthemostcomplicatedalgorithmsinDSP.Butdon'tdespair!YoucaneasilyusepublishedFFTroutineswithoutfullyunderstandingtheinternalworkings.CHAPTERTheFastFourierTransform12ThereareseveralwaystocalculatetheDiscreteFourierTransform(DFT),suchassolvingsimultaneouslinearequationsorthecorrelationmethoddescribedinChapter8.TheFastFourierTransform(FFT)isanothermethodforcalculatingtheDFT.Whileitproducesthesameresultastheotherapproaches,itisincrediblymoreefficient,oftenreducingthecomputationtimebyhundreds.Thisisthesameimprovementasflyinginajetaircraftversuswalking!IftheFFTwerenotavailable,manyofthetechniquesdescribedinthisbookwouldnotbepractical.WhiletheFFTonlyrequiresafewdozenlinesofcode,itisoneofthemostcomplicatedalgorithmsinDSP.Butdon'tdespair!YoucaneasilyusepublishedFFTrou……
  • 所需E币: 3
    时间: 2019-12-24 22:11
    大小: 82.11KB
    上传者: 二不过三
    Abstract:TheAccuracyCalculator(ACCU)aidsinthedesignandanalysisofdata-converterapplicationcircuits.ItcalculatestheDCaccuracyofanidealdataconverter.TheprogramisforusewithaHP®50gcalculatororfreePCemulator.Maxim>DesignSupport>AppNotes>A/DandD/AConversion/SamplingCircuits>APP5060Maxim>DesignSupport>AppNotes>DigitalPotentiometers>APP5060Keywords:ADC,DAC,Accuracy,Calculator,analogdigital,designanalysis,dataconverter,applicationcircuits,DCaccuracy,HP50g,Resolution,bits,PPM,INL,LSB,AnalogCircuitDesign,HP50gPrograms,ACCUAug09,2011APPLICATIONNOTE5060ADC/DACAccuracyCalculatorTutorialBy:BillLaumeister,StrategicApplicationsEngineerAbstract:TheAccuracyCalculator(ACCU)aidsinthedesignandanalysisofdata-converterapplicationcircuits.ItcalculatestheDCaccuracyofanidealdataconverter.Theprogram……
  • 所需E币: 4
    时间: 2019-12-24 22:11
    大小: 91.07KB
    上传者: 16245458_qq.com
    Abstract:TheThermalNoiseCalculator(TNC)aidsintheanalysisofthermalnoisefoundinresistorsandothernoisesources.TheprogramisforusewithanHP®50gcalculatororfreePCemulator.Maxim>DesignSupport>AppNotes>A/DandD/AConversion/SamplingCircuits>APP5059Maxim>DesignSupport>AppNotes>AmplifierandComparatorCircuits>APP5059Maxim>DesignSupport>AppNotes>DigitalPotentiometers>APP5059Keywords:thermalnoise,noisevoltage,whitespectraldensity,Johnsonresistance,temperature,1/fcornerfrequency,calculators,analogcircuitdesign,HP50gprograms,designtool,circuitanalysis,signaltestmeasurement,bandwidth,clock,jitter,analogreferredAug23,2011APPLICATIONNOTE5059ThermalNoiseCalculatorTutorialBy:BillLaumeister,StrategicApplicationsEngineerAbstract:TheThermalNoiseCalculator(TNC……
  • 所需E币: 3
    时间: 2019-12-24 18:18
    大小: 82.11KB
    上传者: 2iot
    摘要:精度计算器(累加器)在数据转换器应用电路的设计和分析。它计算出一个理想的数据转换器的直流精度。该方案是使用与HP®50G计算器或免费的PC模拟器。Maxim>DesignSupport>AppNotes>A/DandD/AConversion/SamplingCircuits>APP5060Maxim>DesignSupport>AppNotes>DigitalPotentiometers>APP5060Keywords:ADC,DAC,Accuracy,Calculator,analogdigital,designanalysis,dataconverter,applicationcircuits,DCaccuracy,HP50g,Resolution,bits,PPM,INL,LSB,AnalogCircuitDesign,HP50gPrograms,ACCUAug09,2011APPLICATIONNOTE5060ADC/DACAccuracyCalculatorTutorialBy:BillLaumeister,StrategicApplicationsEngineerAbstract:TheAccuracyCalculator(ACCU)aidsinthedesignandanalysisofdata-converterapplicationcircuits.ItcalculatestheDCaccuracyofanidealdataconverter.Theprogram……
  • 所需E币: 4
    时间: 2019-12-24 18:18
    大小: 91.07KB
    上传者: 978461154_qq
    摘要:热噪声计算器(TNC)艾滋病在电阻和其他噪声源中的热噪声分析。该方案是®50克使用惠普计算器或免费的PC模拟器Maxim>DesignSupport>AppNotes>A/DandD/AConversion/SamplingCircuits>APP5059Maxim>DesignSupport>AppNotes>AmplifierandComparatorCircuits>APP5059Maxim>DesignSupport>AppNotes>DigitalPotentiometers>APP5059Keywords:thermalnoise,noisevoltage,whitespectraldensity,Johnsonresistance,temperature,1/fcornerfrequency,calculators,analogcircuitdesign,HP50gprograms,designtool,circuitanalysis,signaltestmeasurement,bandwidth,clock,jitter,analogreferredAug23,2011APPLICATIONNOTE5059ThermalNoiseCalculatorTutorialBy:BillLaumeister,StrategicApplicationsEngineerAbstract:TheThermalNoiseCalculator(TNC……