Category: ADR

ADR MADR project

Introduction : This is a test for me to write ADR’s accordingly to https://github.com/joelparkerhenderson/architecture-decision-record . I will try those ADR and see the final result

ADR007 Exception Handling

TITLE: ADR 007 – Exception Handling

  • Status: accepted

  • Deciders: [“Andrei Ignat”]

  • Date: [2023-11-05]

Context and Problem Statement

In every program we need to handle the unexpected situations. One of those are configuration errors. Others are network errors, database errors, etc. However, there are many situations where the errors are of our own – like a bug in the code, errors in the database and so on…

Decision Drivers

In order to make a difference between the errors that are of our own and the errors that are not of our own, we need to have a way to handle them differently. That’s why a custom exception is needed.

Decision Outcome

Chosen option: “Use a custom exception” every time when the error is of our own. Also, use a custom exception when the error is not of our own, but we want to handle it differently.

Positive Consequences

Internal errors are handled differently than external errors. And some corrective measures can be applied.

  1. Domain-Specific Errors: When you have errors that are specific to your business logic or domain, custom exceptions can be used to represent these errors.

  2. Complex Error Handling: If your application has complex error handling requirements, custom exceptions can be used to differentiate between different types of errors.

  3. Enhanced Error Information: If you need to include additional information in your exceptions (like error codes or additional context), custom exceptions can be used.

  4. Control Flow: In some cases, custom exceptions can be used as a form of control flow. This is generally discouraged, but there are some scenarios where it can be useful.

  5. Third-Party Library Errors: If you’re using a third-party library that throws generic exceptions, you might want to catch those and throw your own custom exceptions instead. This can make your error handling code more consistent and easier to understand.

Negative Consequences

  1. Loss of Inner Exception: If not handled properly, the inner exception that caused the custom exception might be lost, making it harder to debug the issue – or should be added to help the developer to understand the error.

  2. Increased Development Time: Creating and maintaining custom exceptions can increase development time.

  3. Potential for Misuse: Custom exceptions can be misused or overused, leading to unnecessary complexity.

  4. Learning Curve: Other developers unfamiliar with the custom exceptions might have a learning curve to understand them.

  5. Dependency: If the custom exceptions are part of a library that is used across multiple projects, changes to the exceptions can impact all these projects.

Pros and Cons of the Options

Pros of Using Custom Exceptions
  1. Specificity: Custom exceptions provide more specific error information, making it easier to understand and handle the error.

  2. Control: They allow for more control over error handling, as you can create different exceptions for different error conditions.
  3. Clarity: They can make the code more readable and maintainable, as the exception names can reflect the error conditions they represent.
Cons of Using Custom Exceptions
  1. Complexity: Creating custom exceptions can add complexity to the code, especially if overused.

  2. Maintenance: They require more maintenance. If the error conditions change, the custom exceptions also need to be updated.
  3. Standardization: Using standard exceptions can sometimes be more straightforward and less error-prone, as they are widely recognized and understood by most developers.

ADR Business Case

Introduction : This is a test for me to write ADR’s accordingly to https://github.com/joelparkerhenderson/architecture-decision-record . I will try those ADR and see the final result

ADR006 Deploy

TITLE: ADR 006 – Deploy

  • Title

  • Status
  • Evaluation criteria
  • Candidates to consider
  • Research and analysis of each candidate
    • Does/doesn’t meet criteria and why

    • Cost analysis
    • SWOT analysis
    • Opinions and feedback
  • Recommendation

Where and how to deploy

The deployment could be done automatically or manually.

The deployment could be on a cloud provider or on premise or on a hosted server.

For automatically, the easy solution is a Github Action because the code is on Github.

Status

Accepted

Evaluation criteria

Low cost – 10000

Easy of deployment – 10

Easy of maintenance – 10

Easy of monitoring – 10

Easy of scaling – 10

Easy of rollback – 10

Candidates to consider

Amazon

Azure

Hosted Server

Research and analysis of each candidate

Because of having a sponsored account on Azure, Azure is the first candidate to consider.

Also, Github Actions is integrated with Azure.

Recommendation

Azure

ADR based on

https://github.com/joelparkerhenderson/architecture-decision-record/blob/main/locales/en/templates/decision-record-template-for-business-case/index.md

ADR Jeff Tyree and Art Akerman

Introduction : This is a test for me to write ADR’s accordingly to https://github.com/joelparkerhenderson/architecture-decision-record . I will try those ADR and see the final result

ADR005 Logging

TITLE: ADR 005 – Logging

  • Status: accepted

  • Deciders: Andrei Ignat
  • Date: 2023-10-07

Technical Story: Must add some logging library in order to debug problems

Context and Problem Statement

Every time there is a problem, logging could solve the problems by having more details about what is wrong

So I MUST add logging

Decision Drivers

  • Making one library for logging is not so complicated , however

    • the exporters to other systems are cumbersome and difficult

    • also threading is a problem when writing to a file
  • There are already production battle tested libraries that performs the work well.

Considered Options

Decision Outcome

Choosing NLog because it is simpler to configure from a text file

Positive Consequences

Devops should be happy – the logging file for production could be also put into SourceControl without problems.

Negative Consequences

Do not support yet SAMNE logging for a class. Could be alleviated by having DebuggerDisplayAttribute for the class and logging the function

Pros and Cons of the Options

Serilog
  • Good, because Widely adopted

  • Good, because A lot of documentation
  • Good, because Great community
  • Bad, because A bit harder to learn when coming from log4net
NLOG

Advantages

  • Good, because A lot of documentation

  • Good, because Having been around a long time, there are lots of blog posts
  • Good, because Easy to get started when coming from other logging frameworks
  • Bad, because Structured logging is still a bit behind Serilog
  • Bad, because C#-based API is harder to use than Serilog’s fluent API

Links

ADR based on

https://github.com/joelparkerhenderson/architecture-decision-record/tree/main/locales/en/templates/decision-record-template-by-jeff-tyree-and-art-akerman/index.md

ADR EdgeX Foundry

Introduction : This is a test for me to write ADR’s accordingly to https://github.com/joelparkerhenderson/architecture-decision-record . I will try those ADR and see the final result

ADR003 Tests

TITLE: ADR 003 – Tests

Submitters
  • Andrei Ignat

Change Log

Referenced Use Case(s)

All use cases, e.g.

  • UseCases001 – No Authentication , upload

must be enforced via an automated Test.

Context

The tests are an important part of the software – so the framework that I am using is important.

Also , the organization of the software must allow testing business rules more than endpoints / GUI that are changing very often.

Also, the code coverage is pretty important – should be at least 80%

Proposed Design

Every GUI application ( Desktop,Console, WebAPI ) must be skinny – i.e. passing data to a business component.

Also, Business should not call static functions ( e.g. DateTime.Now, Environment.CurrentUser) but pass interfaces or functions in order to be Mocked.

Considerations

Testing GUI’s / endpoints should be make at least possible in the developing of the app, because they are changing fast.

Decision

As frameworks we will have :

XUnit ( preferable constructor over [SetUp] ) – see https://testsigma.com/blog/nunit-vs-xunit/

FluentAssertion – to improve running and debugging

LightBDD – to display tests in a good form

NSubstitute – instead of Moq – see https://github.com/moq/moq/issues/1374

Rocks – https://github.com/JasonBock/Rocks/

dotCover CLI – https://www.jetbrains.com/help/dotcover/Running_Coverage_Analysis_from_the_Command_LIne.html

Other Related ADRs

Format:

  • ADR002 – Architecture of the application

References

ADR based on

https://github.com/joelparkerhenderson/architecture-decision-record/tree/main/locales/en/templates/decision-record-template-by-edgex/index.md

ADR Alexandrian

Introduction : This is a test for me to write ADR’s accordingly to https://github.com/joelparkerhenderson/architecture-decision-record . I will try those ADR and see the final result

ADR002 Architecture of application

TITLE: ADR 002 – Type of application

Prologue (Summary)

The app will be used the people that are powershell users and wants their profile shared.

In the context of

Use Case 1 : No Authentication , upload

and

Use case 3: User can see data for a user name

the decision an WebSite. In order to achieve Use Case 1 from powershell, an WebAPI should be implemented.

Discussion (Context)

From WebAPI we can decouple the GUI(SPA) from the WebAPI – and maybe modifying / trying different GUIs ( Angular, React, MVC)

Solution

It is the common way those days to split the app in BackEnd and FrontEnd.

Consequences

We have the possibility to upgrade separately the BackEnd and FrontEnd.

However, it will be more difficult to debug the SPA.

ADR based on

https://github.com/joelparkerhenderson/architecture-decision-record/tree/main/locales/en/templates/decision-record-template-for-alexandrian-pattern

ADR Michael Nygard

Introduction : This is a test for me to write ADR’s accordingly to https://github.com/joelparkerhenderson/architecture-decision-record . I will try those ADR and see the final result

ADR001 Engine for documentation

TITLE: ADR 001 – Engine for documentation

Status : accepted
Context

Need to have a static documentation site with blog also .

In those days there are many engines on the market. And I can built one 😉 .

Read https://docusaurus.io/docs#comparison-with-other-tools . The only that seems to fit the bill are REACT based – I cannot afford learning VUE after Angular and React.

The problem with REACT is that he is going also to server side …

Decision

Docusaurus it is because

  1. Apparently is it the best on REACT

  2. I know REACT
  3. It has BLOG and Documentation
Consequences

The build process will be somehow different.

Could be hard to transfer what I have written to another engine

ADR based on

https://github.com/joelparkerhenderson/architecture-decision-record/tree/main/locales/en/templates/decision-record-template-by-michael-nygard

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.