Error Handling: Separating from Code for Easier Maintenance

  • Thread starter Thread starter 0rthodontist
  • Start date Start date
  • Tags Tags
    Error
Click For Summary
Error handling can clutter code, making it difficult for readers to focus on the main functionality. While some argue for integrating error handling directly within algorithms for locality, others suggest handling errors at a higher level to maintain clarity. Techniques like argument validation and contractual assertions can help separate error handling from core logic, but require advanced design skills. There is a debate about whether error handling should be an afterthought or integrated from the start, with some advocating for a clear distinction between mainstream code and special cases. Ultimately, achieving clean code with effective error handling remains a complex challenge in programming.
  • #31
0rthodontist said:
Have you ever seen any programmer make use of this commenting style you are describing? If you're referring to the takes/alters syntax from another thread, I made it extremely clear that it would need to be automatically generated, and that in fact that was part of the point, so that it would provide documentation that a programmer might not have created on his own.

You're the one claiming that this coding style with "separated" error handling is superior to simply having the error-handling intermingled with the code it protects -- not me. I have never seen anyone besides you argue that this would be a good idea, so no, I have never seen anyone else do it.

- Warren
 
Technology news on Phys.org
  • #32
Chroot, were you actually talking about the takes/alters syntax in the other thread as I thought in my last post?
 

Similar threads

  • · Replies 40 ·
2
Replies
40
Views
933
  • · Replies 4 ·
Replies
4
Views
3K
Replies
73
Views
6K
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 1 ·
Replies
1
Views
3K