Cadastre-se Revistas DevMedia Cursos
 

Space de JOHANNES BRODWALL
Busca Autor


Últimas 20 atualizações de JOHANNES BRODWALL

Article - The Joys and Sorrows of Exceptions

The Joys and Sorrows of Exceptions

In my experience, the most serious bugs in programs in production are in error handling routines. Inventive programmers often try fancy things when dealing with errors, but error situations are often omitted during testing. This article examines the fundamental questions of exceptions: What causes exceptions, and what can be done with them?

Bad User, Bad Server, or Bad Programmer

Practices of an Agile Developer puts exceptional events into three categories:

  • The user has done something wrong, like entered a numeric value in a non-numeric field, tried to access data which he's not authorized to see, entered a negative amount where a positive was required and so on. These types of errors are not exceptional at all but part of the normal course of events. Nevertheless, exceptions are often used to handle them, and sometimes, this is even a good idea. In Java Integer.parseIntNumberFormatException if given a non-numeric string and new URL(String) throws an InvalidURLException if it is given something that can not be parsed as a URL. These events may be the result of user error. throws
  • Sometimes, a program depends upon things outside its control. Network and external servers are examples of this, as is the file system. No matter how good my code is, I can't stop people from knocking out the network cable. I call these kinds of exceptional situations system or resource exceptions.
  • Lastly, try as I may, I never write perfectly correct programs. Occasionally, that pesky NullPointerException brings my program down like a house of cards. In this situation, all bets are off. I know that the program contains a bug, but I cannot safely assume anything about the nature of the bug.

Not all exceptions are cut and dry in what category they fall in. For example, a NumberFormatException is a configuration bug if it occurs while reading a configuration file, but a user error if it occurs while reading input data from a web form.

Dealing with Failure

The overall strategies for handling each of the exceptional situations above are very different. We should program to handle user errors and return pleasant and helpful error messages. However, when it comes to bugs, my recommendation is to get out of Dodge with as little fuzz as possible. The exact nature of the problem is by its very definition something we didn't think about. A NullPointerException should be handled at the topmost level, along with similar errors. The user should be informed that "we're terribly sorry, but despite our best, honest efforts, we have messed up. We'll try and fix it as soon as we can. For now, the best you can do it to try something slightly different and pray." Make sure that you don't corrupt data, however. All persistent data operations must be rolled back.

...
Exibição do post interrompida. Para ler conteúdo completo, clique aqui
20/06/2007 10:07:00





Article - Agile Architecture

Agile Architecture

 

I am somewhat of an advocate of Extreme Programming (XP). However, for the last nine months or so, my title has been “Lead Software Architect”, and I am the (proud?) author of what Martin Fowler calls “the almighty thud” documents. XP is traditionally skeptical of architects, and often with just cause. I’ve frequently heard the term “architect” defined as someone who restricts the options of developers — a definition I don’t particularly care for. Is it possible to reconcile extreme programming and software architecture?

 

I have found more and more that my greatest strength is abstract thinking and simplification, but without losing touch with the code. For me, architecture is not about setting rules and honing checkstyle configurations. It is about seeing, defining, inspiring, and communicating the vision of a simpler, more robust, more secure software system. I think inspiring developers is key: A software architect has no way of forcing his will on the developers. If developers don’t like your cool architectural drawings, they will simply ignore them — and they are probably right to do so.

 

A good architectural description has the following characteristics:

·        

...
Exibição do post interrompida. Para ler conteúdo completo, clique aqui
31/05/2007 19:16:00





 

During the days, Johannes Brodwall (http://www.brodwall.com/johannes/blog/) works as a lead Java architect at BBS, the company that operates most of Norways banking infrastructure. To provide variation and inspiration, he enjoys doing consulting work during his spare time. Johannes is engaged in growing the software development community in Oslo, and has been organizing the Oslo XP Meetup, an Agile User Group with monthly meetings, for since 2005. He is especially focused on how to use automated testing as the key to unlock a more effective way of doing software development. Johannes lives in Oslo, Norway, with his wife Sarah and bulldog Ada Mae.
Arquivo de atualizações
 2007

Estatísticas do Autor:
Número de posts: 2
Características dos posts deste autor:
Conteúdo:
Utilidade:
1 0
 
DevMedia Group - Tel: (21) 3382-5038 - www.devmedia.com.br
Todos os Direitos Reservados a DevMedia Group