三维虚拟互动技术

本人专注于计算机三维虚拟互动技术领域,希望能与广大的朋友进行技术交流、项目合作。为您提供最完善、最先进的技术服务和最广泛、最理想的产品。

导航

Share your mind, maybe is better than share your code

Posted on 2007-08-17 20:27  dscky  阅读(752)  评论(3编辑  收藏  举报
    本文转载自http://sailortony.cnblogs.com/,我很欣赏它的标题,寻找出处未果,故作者不详,有知道者望告知。
   
    Here with, some thoughts on fast code, game programming, software development, and more:

    The three secrets to success are:
    1) Hard work,
    2) Hard work, and
    3) Hard work.

    Learn by doing. Thinking is great, but the only way you ever really learn something thoroughly is by doing it-and particularly by finishing it, which is harder than it sounds because shipping software is an unnatural act (thanks to David Stafford for the phrase).

    Accept reality: no software is ever going to be perfect, and perfection is a moving target anyway. Make the necessary tradeoffs and get it out the door.

    Success is more than just a big paycheck-or, as John Carmack put it, "The Ferraris are only gravy, honest!" You're going to be financially solvent-or better-anyway, so why not do what you love? If you do what you love and work hard and passionately, you're building the foundation of a rewarding life, and in the long term you'll succeed in every way that's important to you.

    If you like it, game programming is about the best software job there is. It touches on practically every area of programming, and it's one of the few places where code can still be written clean instead of patched over or pieced together from canned parts. It's also one of the few places where optimization still really matters.

    Aim high, think big. Right now is a particularly good time for ambitious game programming, because so much more is possible now than ever before, thanks to CPU performance and 3D accelerators.

    Great software is more than just great code. First, a great design is needed, before the code can be written. Don't write code until you have a clear model in your head of what you're trying to accomplish. Take the time to get this right, and don't jump on the first workable idea you come up with.

    Design and optimize from the highest levels of your model on down, focusing on the big architectural issues first. Premature optimization-including premature low-level design--is the root of all evil.

    Keep looking for new, better approaches, and be ready and willing to change the model constantly as you learn more-or even throw it away entirely. Until you start running out of time, think of whatever design you have as just a jumping-off point for a better one.

    Get past the abstractions and know what your code does. Profile in many ways: profilers, NULL drivers, bracketing key code with timing calls, breaking into the debugger at random and seeing where you are. If you don't do this, you're guessing.

    Knowing what to optimize matters as much as knowing how to optimize. Otherwise, you'll optimize the wrong thing, and end up with really fast slow code.

    When it seems you've made your code as good as it can be, and you still need more from it, try to change the way you're seeing the problem. You may be solving your abstraction of the problem rather than the problem itself. Terje Mathisen says, "Almost all programming can be viewed as an exercise in caching." David Stafford views almost all programming as a form of compression. There are infinitely many programming perspectives available to you-use them.

    Check your assumptions.

    Assume nothing. Always ask yourself questions and challenge your assumptions, and just laugh and be glad for what you've learned when you find you could have done something better.

    Stand on the shoulders of giants. There are few brand-new ideas in the world; read what others have done rather than trying to invent everything yourself. Most of programming success lies in engineering and integrating and finishing and being flexible, rather than in raw invention. Sure, it's fun to reinvent things, but there's a huge amount you have to know now, so it's hard to do it all on your own. Besides, there's plenty of cool stuff to figure out after you learn what's already been solved.

    Learn as much math as you can stand. Then learn some more. The industry is moving from broad, seat-of-the-pants programming to software more dominated by content and deep knowledge of areas like physics. Programming itself is easy; it's expertise in knowledge-intensive areas that will increasingly set programmers apart in the future.

    Be patient. It takes one year to become competent at something new, three years to become an expert.

    Stretch until it hurts. Be flexible. Don't get attached to your designs or code. Be willing to listen to new viewpoints, admit it when you're wrong, and change your mind as appropriate.

    Embrace change… or watch it run you over and leave you behind. Accept that the goals, techniques, and rules will constantly change.

    The only thing standing between you and great software ideas is you. Think past the limits you've unconsciously set.

    TANSTATFC: There ain't no such thing as the fastest code (with apologies to Robert A. Heinlein and thanks to Terje Mathisen, who came up with the phrase).

    Turn your right brain loose. Try lots of stuff, even wild stuff. Listen to that little voice. Relax. Let yourself be creative. Accept that many ideas will fail. This is the only way to learn and make real progress.

If your code is getting more complex, you're probably fine-tuning. Step back and look at the bigger picture for more global solutions. Try to change the rules so you can succeed, rather than straining to be mediocre under the current constraints.

    Don't get too comfortable. Aspire to excellence. Fight that satisfied feeling about your code, and constantly ask how to improve. Fight code entropy.

    Simplify. Try to do better with less, in a different way.

    Programming is not a zero-sum game. Unless you have legal or employer restrictions, share what you've learned, and learn from others. Having to explain something forces you to know it cold. It also makes you known, and leads to interesting opportunities.

    Remember to have fun! It's about the best job around, but like anything else, game programming can turn into a job if you let it. Don't let it. You're one of the luckiest people in the history of the planet, getting incredibly well rewarded for doing something challenging, fun, and just plain cool. Remember that and count your blessings every day. Then get out there and write some great software!