background preloader

Code as a craft

Facebook Twitter

20 Pieces of Programming Wisdom. Graphing Calculator Story. Design Patterns and Refactoring. Macintosh Stories: Round Rects Are Everywhere! Bill Atkinson worked mostly at home, but whenever he made significant progress he rushed in to Apple to show it off to anyone who would appreciate it. This time, he visited the Macintosh offices at Texaco Towers to show off his brand new oval routines, which were implemented using a really clever algorithm. Bill had added new code to QuickDraw (which was still called LisaGraf at this point) to draw circles and ovals very quickly. That was a bit hard to do on the Macintosh, since the math for circles usually involved taking square roots, and the 68000 processor in the Lisa and Macintosh didn't support floating point operations. But Bill had come up with a clever way to do the circle calculation that only used addition and subtraction, not even multiplication or division, which the 68000 could do, but was kind of slow at.

Bill's technique used the fact the sum of a sequence of odd numbers is always the next perfect square (For example, 1 + 3 = 4, 1 + 3 + 5 = 9, 1 + 3 + 5 + 7 = 16, etc). Linear algebra for game developers ~ part 1. When I posted about decals last week, a number of readers commented that they would be interested in posts about linear algebra as it applies to game development. I decided if I'm going to write about that, I might as well start at the beginning!

This will be review to many of you who have written games before or taken classes in kinematic physics, so please bear with me for this introductory post -- I will get to more advanced topics later. Why do we care about linear algebra? Linear algebra is the study of vectors. If your game involves the position of an on-screen button, the direction of a camera, or the velocity of a race car, you will have to use vectors. The better you understand linear algebra, the more control you will have over the behavior of these vectors. What is a vector? In games, vectors are used to store positions, directions, and velocities. The position vector indicates that the man is standing two meters east of the origin, and one meter north. Vector addition Next time. MathSite: Stable Marriage Problem. CWE - 2011 CWE/SANS Top 25 Most Dangerous Software Errors. Summary Discussion Salt might not be good for your diet, but it can be good for your password security. Instead of storing passwords in plain text, a common practice is to apply a one-way hash, which effectively randomizes the output and can make it more difficult if (or when?)

Attackers gain access to your password database. If you don't add a little salt to your hash, then the health of your application is in danger. Prevention and Mitigations Related CWEs Related Attack Patterns CAPEC-IDs: [view all]16, 20, 49, 55, 97 Monster Mitigations These mitigations will be effective in eliminating or reducing the severity of the Top 25. A Monster Mitigation Matrix is also available to show how these mitigations apply to weaknesses in the Top 25. See the Monster Mitigation Matrix that maps these mitigations to Top 25 weaknesses.

Appendix A: Selection Criteria and Supporting Fields Prevalence Prevalence is effectively an average of values that were provided by voting contributors to the 2010 Top 25 list. Things Everyone Should Do: Code Review. As I alluded to in my last post (which I will be correcting shortly), I no longer work for Google. I still haven't decided quite where I'm going to wind up - I've got a couple of excellent offers to choose between.

But in the interim, since I'm not technically employed by anyone, I thought I'd do a bit of writing about some professional things that are interesting, but that might have caused tension with coworkers or management. Google is a really cool company. And they've done some really amazing things - both outside the company, where users can see it, and inside the company. There are a couple of things about the inside that aren't confidential, but which also haven't been discussed all that widely on the outside. The biggest thing that makes Google's code so good is simple: code review. Everyone should do this. What do you get out of code review? There's the obvious: having a second set of eyes look over code before it gets checked in catches bugs.

There's one more big benefit.