Patterns matter... everywhere

2024 July 07 design patterns Comments

...And how big my surprise was when unexpectedly for myself, planning implementation for that application, I found my mind suggesting me some of those patterns! Separation of concerns, dependency injection, factories, singletones, chain of responsibilities and even visitor naturally found their place in that small application. Ancient wisdom came true - "whatever is in big, there is in small". I was so satisfied doing that 300-liner :)

Read More

How I advanced myself in 4 technologies in 2 months

2024 January 26 signalr Comments

...Recently I got an interesting task to investigate message exchange technology called SignalR for potential implementation in a product that our company is developing. SignalR implementation consists of backend thing called "hub" and frontend clients that basically can be of any type — web, mobile or desktop. So to advance my investigation and to update my frontend knowledge I decided to implement several different simple clients to observe their interoperability in regard of SignalR messaging for different users on different clients. I started with very simple console client and finally ended up with 2 web clients, which were built on React and Blazor, and one desktop, which was WPF.

Read More

Power of iterators

2023 November 09 iterator Comments

...The request could be like "I need to generate 1000 communication events of type 1, 2, 3 for any stakeholder that belong to project 42 and is linked to existing land titles 50..80. Also I want any of them be from country 10 or 11". Here we presume that database already contains necessary event types, projects, land titles and countries. The task is to generate partially fake communication event records that will contain real ids to establish valid relations with existing data.

Read More

Loopback mode for HTTP client

2023 April 23 http client Comments

...However, in this case infrasturcture layer would become difficult to be covered with unit tests properly. For each individual HTTP request, we would need to introduce branching and test behavior that is not the part of the application itself. When some requrement will change and expected response will change also, we will need to reflect this in two different places — in the real workflow and in the loopback workflow. Moreover, every method that makes request to external API, needs to deal with the parameter that is not part of the business but the part of launch context. In sum, all this started smelling not really good to me, so I started thinking for some kind of different solution.

Read More
Support Ukraine in the face of russian aggression!

ChatGPT excercises — mocking value of IOptions<T>

2023 April 05 Chat GPT Comments

...Basically, before starting asking Chat GPT for, let's say, consultation, I walked the whole mental path from the problem to the "solution" by myself, so I was not stuck with my problem, I just wanted to figure out if I'm missing anything and if there is some different approach to implement what I need. It was my first experience of interaction with this thing, so, like in real conversation with human being, I started with general question and then started rising step-by-step more and more specific ones. By the end of the conversation, I was deeply impressed to say the least... Although later, analyzing it this episode, I came to some interesting conclusion.

Read More

Plain string to JSON conversion challenges

2023 February 13 Deserialization Comments

...So, the problem came — how to deserialize a string of json into some c# object, to let serializer understand it properly at the moment of output and provide usable json on API response? All the recommendations that I found from the web were about strongly typed deserealization, but in my case the format of the json in the source string is unknown in advance. It can even be not flat, and properties can have values of any type — number, bool or string. Two options to experiment with came to my mind: anonymous objects or dynamics. I started with the latter and eventually came up with the working solution.

Read More

Upgrade netcore 3.1 to dotnet 7

2023 February 08 dotnet 7 Comments

...After upgrade to dotnet 7 the problem with message parameter cropped up. Turned out that Microsoft.Azure.ServiceBus.Message type is no longer used to contain both the message itself and its properties. In the new dotnet versions the message parameter is expected to be a string, object or strong class type to deserialize incoming data into.

Read More

Multi-paradigm SQL query

2023 February 05 SQL Comments

...At my first glance, big number of conditions and the need to aggregate on different criteria at once to return single result value, drawing thoughts to implement the algorithm in procedural way on the API side, using bunch of if-then-else's. However, as I mentioned at the beginning, development approach on this project required somewhat else, so to solve this task I mentally left territory of imperative programming and switched to the side of declarative SQL

Read More

© theyur.dev. All Rights Reserved. Designed by HTML Codex