Linked Questions
0
votes
2
answers
513
views
Why does File.Open in .Net throw exceptions and not follow exception handling best practices? [duplicate]
I have read at many places including this - http://msdn.microsoft.com/en-us/library/seyhszts.aspx - that you should use exception handling when something is truly exceptional.
The .Net File.Open ...
0
votes
1
answer
999
views
Either Monad and Exceptional Circumstances [duplicate]
I have a function returning an Either such as GetUserFromDb(int id).
If the database is offline, should I catch the error in the function and wrap it in a failure / Left case or should I let it ...
0
votes
1
answer
125
views
Simple but frequently throwing vs reasonable but rarely throwing vs complex but never throwing [duplicate]
A lot of code that's designed to convert or parse some data of type Foo into a Bar is written with the assumption that one wouldn't intentionally pass it invalid inputs. As such, it assumes that ...
0
votes
3
answers
112
views
Should I use an Exception in a case like this? [duplicate]
I have a Windows service with a fluent interface like this:
aRequest = Repository.getRequest()
.createProcess()
.validate();
Sometimes getRequest() could ...
355
votes
19
answers
59k
views
How would you know if you've written readable and easily maintainable code? [closed]
How would one know if the code one has created is easily readable, understandable, and maintainable? Of course from the author's point of view, the code is readable and maintainable, because the ...
47
votes
14
answers
7k
views
Why are errors named as "Exception" but not as "Error" in programming languages?
I've been thinking about that for quite a while actually. I am not a native English speaker myself but still, I have years of programming experience and I always asked myself this. Why is it named as ...
34
votes
8
answers
13k
views
Is throwing an exception an anti-pattern here?
I just had a discussion over a design choice after a code review. I wonder what your opinions are.
There's this Preferences class, which is a bucket for key-value pairs. Null values are legal (that'...
17
votes
11
answers
5k
views
What is better IllegalStateException or silent method execution? [closed]
Let's say I have a MediaPlayer class which has play() and stop() methods. What is the best strategy to use when implementing the stop method in case when the play method has not been called before. I ...
12
votes
5
answers
7k
views
Should service throw exception or return when no items specified for deletion
I have a piece of code that can be represented as:
public class ItemService {
public void DeleteItems(IEnumerable<Item> items)
{
// Save us from possible NullReferenceException ...
8
votes
2
answers
3k
views
Error handling and exceptions in a layered (or onion) architecture [closed]
Given an onion architecture, what are the advantages and disadvantages of throwing exceptions in the business logic (which is in the center of the onion) for invalid parameters provided by the user?
...
0
votes
2
answers
776
views
Exception Handling: When and Why?
The main languages I use are C++ and Java.
Both languages support exception handling.
I confess, I may not actually understand exception handling, at least, I certainly don't understand why you ...
0
votes
1
answer
93
views
Sending Out Functions To Return Or To Die
Which is preferable for both solid technique and secure coding?
Example #1:
function_one()
blah;
function_two()
blah;
print blah;
exit;
...
Example #2:
...