Skip to main content
added 27 characters in body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an enum type private variable. in your class. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable. If someone tries to write to a setter when the enum value is in the wrong state, then you can throw an exception.

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an enum variable. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable. If someone tries to write to a setter when the enum value is in the wrong state, then you can throw an exception.

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an enum type private variable in your class. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable. If someone tries to write to a setter when the enum value is in the wrong state, then you can throw an exception.

added 116 characters in body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an Enum variable.enum variable. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable. If someone tries to write to a setter when the enum value is in the wrong state, then you can throw an exception.

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an Enum variable. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable.

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an enum variable. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable. If someone tries to write to a setter when the enum value is in the wrong state, then you can throw an exception.

added 248 characters in body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an Enum variable. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable.

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In general, what you are describing is a workflow. More specifically, business functions that are embodied by states such as REVIEWED APPROVED or DECLINED fall under the heading of "business rules" or "business logic."

But to be clear, business rules should not be encoded into exceptions. To do so would be to use exceptions for program flow control, and there are many good reasons why you should not do that. Exceptions should be used for exceptional conditions, and the INVALID state of an application is entirely unexceptional from a business standpoint.

Use exceptions in cases where the program cannot recover from an error condition without user intervention ("file not found," for example).

There is no specific pattern for writing business logic, other than the usual techniques for arranging business data processing systems and writing code to implement your processes. If the business rules and workflow are elaborate, consider using some sort of workflow server or business rules engine.

In any case, the states REVIEW, APPROVED, DECLINED, etc. can be represented by an Enum variable. If you use getter/setter methods, you can control whether or not the setters will allow changes by first examining the value of the enum variable.

added 2 characters in body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683
Loading
edited body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683
Loading
added 306 characters in body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683
Loading
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683
Loading