background preloader

Some lesser-known truths about programming

Some lesser-known truths about programming
My experience as a programmer has taught me a few things about writing software. Here are some things that people might find surprising about writing code: Averaging over the lifetime of the project, a programmer spends about 10-20% of his time writing code, and most programmers write about 10-12 lines of code per day that goes into the final product, regardless of their skill level. Good programmers spend much of the other 90% thinking, researching, and experimenting to find the best design. Bad programmers spend much of that 90% debugging code by randomly making changes and seeing if they work.A good programmer is ten times more productive than an average programmer. A great programmer is 20-100 times more productive than the average.

C Craft - Chapter 1. Introduction C is the desert island language. This is my favourite statement from a talk Rob Pike gave in 2001. Despite its age, despite many flaws, C is still the de facto standard, the lingua franca. Why? As with other older languages, inertia is partly to blame, but this cannot be the only reason. C must possess a near-perfect balance of vital language features. Or as Linus Torvalds puts it, “C is the only sane choice”. One of C’s designers, Dennis Ritchie, gives a modest account of the evolution of C. The canonical reference, Kernighan and Ritchie’s "The C Programming Language" is slim, yet contains much more than the language specification. Not only is C easy for humans to understand, but machines too can pick up the language quickly. I can roughly envision the assembly generated by a C statement, so I can make educated guesses about time and space efficiency. Brevity is the soul of wit. In my Eiffel days, I was encouraged to write "integer", not "int", "character", not "char", and so on.

Validation Library using C# 3.0 Lambda Expressions. Free source code and programming help Download source project - 12.68 KB Introduction In Enterprise Library - Validation Application Block we have attributes to define complex validation expressions. Background Imagine this business class: public class Foo { public string Name { get; set; } public int Index { get; set; } } Let's say that the Name property can't be null or empty and the Index should be in 0 and 100 range. [Validatable] public class Foo { Func< Foo, bool > NameRule = f => ! And we only need a solution to do the validation checks, this is why I am here for today. The Validation Library Attributes ValidatableAttribute: Indicates that a class or structure can be validated. Properties (all get/set) string Name: Name of the rule. Examples [Validatable] public class Foo { [Rule(Name = "NameRule")] Func< Foo, bool > RName = f => ! RName rule will be "NameRule" and linked to Name property by naming convention and RIndex rule will be "IndexRule" and linked to Index property by naming convention and will be disabled. Properties

Six ways to write more comprehensible code I learned to write, clear, maintainable code the hard way. For the last twelve years, I've made my living writing computer games and selling them over the Net using the marketing technique that was once charmingly known as shareware. What this means is that I start with a blank screen, start coding, and, a few tens of thousands of lines of code later, I have something to sell. This means that, if I make a stinky mess, I'm doing it in my own nest. So I have been well rewarded by learning about good, sane programming techniques. But there are many who, like me, stumbled into programming in an unexpected or unusual way and never had anyone drill this stuff into them. The example case For illustration purposes, our example program throughout this article is a hypothetical computer game called Kill Bad Aliens. Figure 1. The game will take place in periods of time called Waves. Killing an alien gives you some points. When a bomb hits you, your ship blows up and another appears. Back to top Oh?

Unit Testing Domain Persistence With NDbUnit, NHibernate and SQLite : Scott Muc Ever since I’ve begun using NHibernate the number one thing that’s caused me a lot of headaches is learning how to properly map my domain objects. Even the most basic mappings I wrote had bugs simple because I overlooked trivial items. This made me realize that I could save a lot of time and hassle if I unit tested by data access layer. I’m a neophyte when it comes to unit testing, but over the last six months I’ve started to understand the benefits of testing and where it fits in with my development cycle. In order to test my mappings I needed a simple way of placing dummy data into my database. With tools in hand I started creating an integration test suite for the CBC Radio 3 website codebase. Enough about my objectives, here’s how I plan on making a database testing suite that doesn’t get bogged down by the size of the domain or the number of repositories I have. Castle.WindsorRhino.Commons.BinsorCastle.Facilities.NHibernateIntegrationNHibernate

Advanced Programming Languages Introduction Research Syntax Semantics Static Semantics ( Type Theory ) Dynamic Semantics Semantic Related Developments Abstract Interpretation Program Transformation Decompilation Partial Evaluation Pragmatics ( Software Patterns , Generic Programming , Visual Programming , Persistence , Reflectiveness , Hyperprogramming) Semiotics Implementation Techniques: Garbage collection , Abstract Machines Some Conferences (not updated) People and Groups Teaching Introduction to Programming Languages Selecting First Programming Language Courses about Programming Languages Courses about Foundations of Programming Languages Courses about Language Processors Paradigms Comparing Programming Languages Functional Programming ( Haskell, ML) Logic Programming (Prolog) Object Oriented Programming (Java, C++, Smalltalk, ...) Cross Paradigms : Logic-Functional , Object Oriented-Functional , Object Oriented-Logic My List of Programming Languages Selected Bibliography Selected Papers Selected Books Acknowledgments Backus Naur Form (BNF) C.

Introducing WebMatrix Last week I published several blog posts that covered some new web development technologies we are releasing: IIS Developer Express: A lightweight web-server that is simple to setup, free, works with all versions of Windows, and is compatible with the full IIS 7.5. SQL Server Compact Edition: A lightweight file-based database that is simple to setup, free, can be embedded within your ASP.NET applications, supports low-cost hosting environments, and enables databases to be optionally migrated to SQL Server. ASP.NET “Razor”: A new view-engine option for ASP.NET that enables a code-focused templating syntax optimized around HTML generation. You can use “Razor” to easily embed VB or C# within HTML. Today we are also announcing a new lightweight web development tool that also integrates the above technologies, and makes it even easier for people to get started with web development using ASP.NET. What is in WebMatrix? Getting Started with WebMatrix Let’s create a new Web site.

Beginning Game Development: Part I – Introduction | Coding4Fun Articles Part I – Introduction Welcome to the first article of an introductory series on game programming using the Microsoft .NET Framework and managed DirectX 9.0. This series as aimed at beginning programmers who are interested in developing a game for their own use with the .NET Framework and DirectX. In this series, we are going to build a simple game to illustrate the various components of a commercial game. Tools: Before we start writing our first game we need to talk about the tools we will use. The most important tool for any developer is the Integrated Development Environment (IDE). Visual Studio 2005 (also known by the codename “Whidbey") is the third version of the standard Microsoft IDE for .NET Framework-based applications. The second important tool we need to create a great looking game is a graphics Application Programming Interface (API). At some point in your game development experience you are going to have to create or modify graphics. What makes a successful game? Our Game idea:

code school If you code HTML, Zen Coding will change your life If you write HTML for a living, and you don't know Zen Coding yet, you are missing out big time. This is basically the coolest thing I've seen all week. I have been using it for a few days now; at first it seemed kind of gimmicky and I wasn't sure I could grasp the syntax, but today I really got to explore it, and woah is it awesome. Okay, I'll stop tripping over myself with excitement over here and try to tell you what this thing does, in a nutshell: It expands abbreviations into complete HTML structures (divs, tables, cells, links, lists), and does it in the most freaking intelligent way I have seen in a long time. I'm serious! For instance, that arcane-looking string of text in the screenshot expands with a single keystroke into this: This thing leaves any other tag-completion method I have ever seen for HTML in the dust. There are existing implementations for multiple editors, such as Komodo Edit (which is the one I'm using). There are easy ways to wrap existing lines with tags.

Lesson: Object-Oriented Programming Concepts (The Java™ Tutorials > Learning the Java Language) If you've never used an object-oriented programming language before, you'll need to learn a few basic concepts before you can begin writing any code. This lesson will introduce you to objects, classes, inheritance, interfaces, and packages. Each discussion focuses on how these concepts relate to the real world, while simultaneously providing an introduction to the syntax of the Java programming language. What Is an Object? An object is a software bundle of related state and behavior. What Is a Class? A class is a blueprint or prototype from which objects are created. What Is Inheritance? Inheritance provides a powerful and natural mechanism for organizing and structuring your software. What Is an Interface? An interface is a contract between a class and the outside world. What Is a Package? A package is a namespace for organizing classes and interfaces in a logical manner. Questions and Exercises: Object-Oriented Programming Concepts

Bill the Lizard: Books Programmers Don't Really Read Mark Twain once said that a classic novel is one that many people want to have read, but few want to take the time to actually read. The same could be said of "classic" programming books. Periodically over on Stack Overflow (and in many other programming forums) the question comes up about what books are good for programmers to read. The question has been asked and answered several times, in several different ways. Books Most Programmers Have Actually Read I've read all of these books myself, so I have no difficulty believing that many moderately competent programmers have read them as well. Among the most commonly recommended programming books there is another group that deserves special consideration. Books Programmers Claim to Have Read Introduction to Algorithms (CLRS)This book may have the most misleading title of any programming book ever published.

Ruby Programming Language Sometimes, The Better You Program, The Worse You Communicate. 'peSHIr' on Fri, 05 Jun 2009 10:39:57 GMT, sez: So *this* is why I communicate so horribly! ;-) 'Mike Woodhouse' on Fri, 05 Jun 2009 11:34:33 GMT, sez: My Wife [giving some typically incomplete instructions]: You know what I mean Me: I don't. My wife doesn't program. 'DylanW' on Fri, 05 Jun 2009 11:56:36 GMT, sez: I have never before felt like my chosen career was actually doing me harm. (Kidding. 'Doekman' on Fri, 05 Jun 2009 12:06:01 GMT, sez: So what you are saying is actually that you have less than average programming skills? 'wpfleischmann' on Fri, 05 Jun 2009 12:56:12 GMT, sez: re: (1) Human communication is a lossy medium, so it requires significant redundancy. 'Stephan L.' on Fri, 05 Jun 2009 13:19:35 GMT, sez: Like Doekman says, you can read this the other way around: here are four reasons why the better you communicate with typical human beings, the worse you are as a programmer :-) 'Kyle Lanser' on Fri, 05 Jun 2009 13:55:44 GMT, sez: I Disagree. her: Crab's until 10, right? false; 1.

Related: