The classic model to building software is: "Code it first, and then test to find errors". That is how most of us started software development. In fact, that is the practice most developers and development companies follow. There are software companies I know which have lengthy quality assurance processes and huge teams with QA people and testers, but still what they simply do is write it first, and test it second.
This type of testing keeps the developer away from testing. Normally, developers don't like to consider themselves as testers. Although, if the developer himself performs testing, it is less likely that he/she will exercise or discover every possible edge case. Developers are normally overconfident about what they code; they blindly guess it will run without any problems. However, that is not true in almost every case. The bugs in code can pop up at any time, even after years of operation in production systems. It is cheaper to find the bugs and fix them early in the project life cycle than it is to correct them after you put the system into operation.
Test first development (a.k.a Test Driven Development TDD), as opposed to code first development, emphasizes writing the test code before you write the actual implementation code. The tests are written for a particular piece of functionality known as a unit. (Hence, they are known as unit tests). Usually, this is done by the same developer who then write codes for the functionality which is under test. The developer, even before running his code, can first run the test to find it fails and then write enough implementation code to get the test to pass. Then, she goes to next step. Writing tests for the next unit of functionality, running the test, watching it fail, and again writing enough code to make it pass. The developer continues this cycle until all the customer requirements get implemented. The final outcome of this process is an operational software which is fully tested and confirmed as bug free. Because the tests were written for the functionality of the system, the tests can also serve as a documentation.
Test first development has gotten a lot of attention and buzz in recent years. These days, writing code without first writing tests is generally considered bad practice. However, it is still the most common practice.
Test first development can be done in most current popular development languages.