Recently in Programming Category

http://technologytosoftware.com/css-javascript-cheat-sheet.html

Code coverage goal: 80% and no less!

| No Comments | No TrackBacks

http://googletesting.blogspot.com/2010/07/code-coverage-goal-80-and-no-less.html



Morgan Conrad asked: "What is Testivus' wisdom concerning the proper percentage of test coverage?"

Here you go Morgan.

Testivus On Test Coverage

Early one morning, a programmer asked the great master:

"I am ready to write some unit tests. What code coverage should I aim for?"

The great master replied:

"Don't worry about coverage, just write some good tests."

The programmer smiled, bowed, and left.

...

Later that day, a second programmer asked the same question.

The great master pointed at a pot of boiling water and said:

"How many grains of rice should put in that pot?"

The programmer, looking puzzled, replied:

"How can I possibly tell you? It depends on how many people you need to feed, how hungry they are, what other food you are serving, how much rice you have available, and so on."

"Exactly," said the great master.

The second programmer smiled, bowed, and left.

...

Toward the end of the day, a third programmer came and asked the same question about code coverage.

"Eighty percent and no less!" Replied the master in a stern voice, pounding his fist on the table.

The third programmer smiled, bowed, and left.

...

After this last reply, a young apprentice approached the great master:

"Great master, today I overheard you answer the same question about code coverage with three different answers. Why?"

The great master stood up from his chair:

"Come get some fresh tea with me and let's talk about it."

After they filled their cups with smoking hot green tea, the great master began to answer:

"The first programmer is new and just getting started with testing. Right now he has a lot of code and no tests. He has a long way to go; focusing on code coverage at this time would be depressing and quite useless. He's better off just getting used to writing and running some tests. He can worry about coverage later."

"The second programmer, on the other hand, is quite experience both at programming and testing. When I replied by asking her how many grains of rice I should put in a pot, I helped her realize that the amount of testing necessary depends on a number of factors, and she knows those factors better than I do - it's her code after all. There is no single, simple, answer, and she's smart enough to handle the truth and work with that."

"I see," said the young apprentice, "but if there is no single simple answer, then why did you answer the third programmer 'Eighty percent and no less'?"

The great master laughed so hard and loud that his belly, evidence that he drank more than just green tea, flopped up and down.

"The third programmer wants only simple answers - even when there are no simple answers ... and then does not follow them anyway."

The young apprentice and the grizzled great master finished drinking their tea in contemplative silence.

http://dotmac.rationalmind.net/2010/08/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:

  • 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 great lathe operator commands several times the wage of an average lathe operator, but a great writer of software code is worth 10,000 times the price of an average software writer." -Bill Gates
  • A good programmer is ten times more productive than an average programmer. A great programmer is 20-100 times more productive than the average. This is not an exaggeration - studies since the 1960′s have consistently shown this. A bad programmer is not just unproductive - he will not only not get any work done, but create a lot of work and headaches for others to fix.
  • Great programmers spend very little of their time writing code - at least code that ends up in the final product. Programmers who spend much of their time writing code are too lazy, too ignorant, or too arrogant to find existing solutions to old problems. Great programmers are masters at recognizing and reusing common patterns. Good programmers are not afraid to refactor (rewrite) their code constantly to reach the ideal design. Bad programmers write code which lacks conceptual integrity, non-redundancy, hierarchy, and patterns, and so is very difficult to refactor. It's easier to throw away bad code and start over than to change it.
  • Software obeys the laws of entropy, like everything else. Continuous change leads to software rot, which erodes the conceptual integrity of the original design. Software rot is unavoidable, but programmers who fail to take conceptual integrity into consideration create software that rots so so fast that it becomes worthless before it is even completed. Entropic failure of conceptual integrity is probably the most common reason for software project failure. (The second most common reason is delivering something other than what the customer wanted.) Software rot slows down progress exponentially, so many projects face exploding timelines and budgets before they are killed.
  • A 2004 study found that most software projects (51%) will fail in a critical aspect, and 15% will fail totally. This is an improvement since 1994, when 31% failed.
  • Although most software is made by teams, it is not a democratic activity. Usually, just one person is responsible for the design, and the rest of the team fills in the details.
  • Programming is hard work. It's an intense mental activity. Good programmers think about their work 24/7. They write their most important code in the shower and in their dreams. Because the most important work is done away from a keyboard, software projects cannot be accelerated by spending more time in the office or adding more people to a project.

Beej's Guide to Network Programming

| No Comments | No TrackBacks
http://beej.us/guide/bgnet/

Test Anything Protocol

| No Comments | No TrackBacks
http://testanything.org/wiki/index.php/Main_Page

http://www.htmlgoodies.com/beyond/javascript/article.php/3887346

Web developers often use JavaScript for common tasks on their websites. In this tutorial we'll show you the top 10 JavaScript snippets you can use on your webpages by just cutting and pasting!

In this article we're going to cover the following popular script snippets!

  1. Date display
  2. Calendar
  3. Close Window
  4. Copy Selected Text
  5. Back to Previous Page
  6. Focus OnLoad
  7. Break out of Frames
  8. Add to Favorites
  9. IP Address
  10. Specify Referring Page

P versus NP

| No Comments | No TrackBacks
http://en.wikipedia.org/wiki/Millennium_Prize_Problems#P_versus_NP

Suppose that you are organizing housing accommodations for a group of four hundred university students. Space is limited and only one hundred of the students will receive places in the dormitory. To complicate matters, the Dean has provided you with a list of pairs of incompatible students, and requested that no pair from this list appear in your final choice. This is an example of what computer scientists call an NP-problem, since it is easy to check if a given choice of one hundred students proposed by a coworker is satisfactory (i.e., no pair taken from your coworker's list also appears on the list from the Dean's office), however the task of generating such a list from scratch seems to be so hard as to be completely impractical. Indeed, the total number of ways of choosing one hundred students from the four hundred applicants is greater than the number of atoms in the known universe! Thus no future civilization could ever hope to build a supercomputer capable of solving the problem by brute force; that is, by checking every possible combination of 100 students. However, this apparent difficulty may only reflect the lack of ingenuity of your programmer. In fact, one of the outstanding problems in computer science is determining whether questions exist whose answer can be quickly checked, but which require an impossibly long time to solve by any direct procedure. Problems like the one listed above certainly seem to be of this kind, but so far no one has managed to prove that any of them really are so hard as they appear, i.e., that there really is no feasible way to generate an answer with the help of a computer. Stephen Cook and Leonid Levin formulated the P (i.e., easy to find) versus NP (i.e., easy to check) problem independently in 1971.

Code Refuse - The Daily WTF

| No Comments | No TrackBacks
From The Daily WTF:

Jeff emailed Carl an apology: "I withdraw my comments about the DAL and the UI being separate concerns. I was apparently mistaken." No sanely developed ASP.NET app would have access to Windows Forms objects. For the umpteenth time in his tenure, he re-invented the wheel and wrote his own DAL and business layer. In the end, Jeff was probably better off for it. The first rule of code reuse is that the code needs to be worth re-using.
http://www.globalnerdy.com/2010/05/09/new-programming-jargon/

Fear-Driven Development
When project management adds more pressure, such as by firing a member of the team.
From blogs.perl.org:

Let's be honest. Perl 5, Python, Ruby, they're almost the same. There are some differences, but when your compare them with C, Java, Haskell or some such they suddenly feel rather superficial. They suitable or unsuitable for pretty much the same tasks, occupying a niche that Perl pioneered: that of a high manipulexity and whipuptitude.

They each operate at the same abstraction level. Even if a language is lacking a feature that the others have, it's easily implemented using other constructs. There are plenty of valid reasons to prefer one over the other (taste, library availability, programmer availability), but they all offer the same power. Perl 6 is going to change that.

Continue reading...

About this Archive

This page is an archive of recent entries in the Programming category.

Mobile is the previous category.

Web is the next category.

Find recent content on the main index or look in the archives to find all content.