正在加载图片...
Introduction 11 h hile i more if you take n then if con ad s tha ren't you an error message that says ou"for programming.MATLAB will not give ??You don't deserve oxygen! A more likely message is something prosaic like ??Subscript indices must either be real positive integers or logicals. You might get an error message like the latter one in response to code such as Reaction Time For Trial(0)=680; All you have to do here is appreciate that it makes no sense to have the zero-th element of was entere e base error withou ting yo gpd0是efeothe t youcc the0通 Reaction_Time_For_Trial(1)-680 One reason for saying these things is that it bears message ve while machi membering that the erro not fr ou to ak f advice.Over time will get fewe ing low-level asp cts of coding (e g closing parentheses in a line of code),and you will learn what the error messages mean. More about error messages and debugging(correcting your programs)will come later in the text. Over time you will also leamn to guard against disaster when you program.We encourage you to do so by writing programs that are resilient rather than brittle.If you write a pro- gram that crashes or yields crazy results when it gets input of a different sort than what you anticipated,your program won't be of much good.For example,if you write a program that is used to collect questionnaire data.and a participant types in an age of-83.that could wreak havoc with subsequent data analyses.It doesn't matter why the participant put a minus sign in front of his or her age(if he or she is actually 83).Perhaps the partici pant thought this might help you see the number more clearly.perhaps it was just a typo or perhaps th ing cute The you anticipate can go wrong w en a program s being run.A good r gua uch th ng open t nore tha not letting your hur en the 0 ding constructively to negative fe eyou mi o means ng open allIntroduction 11 as signs of their lack of talent ( entity learners) and people who treat negative feedback as cues for ways to improve their performance ( incremental learners). It is important while programming to have the attitude of an incremental learner rather than an entity learner. You will learn more if you take negative feedback constructively than if you read such feedback as a sign that you werenÊt „cut out‰ for programming. MATLAB will not give you an error message that says ??? You don't deserve oxygen! A more likely message is something prosaic like ??? Subscript indices must either be real positive integers or logicals. You might get an error message like the latter one in response to code such as Reaction_Time_For_Trial(0) = 680; All you have to do here is appreciate that it makes no sense to have the zero-th element of an array. An array can have a first element, a second element, a third element, and so on, but it canÊt have an element numbered zero. Whether the 0 was entered in the code based on a misunderstanding or simply as a typo, you can correct the error without indicting your genes. If when you typed 0, you were referring to the first trial, you can replace the 0 with a 1 and all will be fine: Reaction_Time_For_Trial(1) = 680; One reason for saying these things is that it bears remembering that the error messages you receive while programming come from a machine, not from a person who knows what you are trying to say. When you receive an error message, it will help you to take the message as a piece of advice. Over time, you will get fewer error messages concern￾ing low-level aspects of coding (e.g., when you have an unequal number of opening and closing parentheses in a line of code), and you will learn what the error messages mean. More about error messages and debugging (correcting your programs) will come later in the text. Over time you will also learn to guard against disaster when you program. We encourage you to do so by writing programs that are resilient rather than brittle. If you write a pro￾gram that crashes or yields crazy results when it gets input of a different sort than what you anticipated, your program wonÊt be of much good. For example, if you write a program that is used to collect questionnaire data, and a participant types in an age of -83, that could wreak havoc with subsequent data analyses. It doesnÊt matter why the participant put a minus sign in front of his or her age (if he or she is actually 83). Perhaps the partici￾pant thought this might help you see the number more clearly, perhaps it was just a typo, or perhaps the participant thought he or she was being cute. The point is that you must anticipate such eventualities. All sorts of things can go wrong when a program is being run. A good programmer guards against as such eventualities. In this sense, being open to negative feedback means more than not letting your feelings be hurt when the computer beeps because you left out a punctuation mark or because you mistyped the name of a func￾tion. Responding constructively to negative feedback also means being open to all sorts of
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有