<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Soner Paycı on Medium]]></title>
        <description><![CDATA[Stories by Soner Paycı on Medium]]></description>
        <link>https://medium.com/@sonerpayci?source=rss-51752d4eade7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HPvgg48r3txFtMFz9-h9mA.jpeg</url>
            <title>Stories by Soner Paycı on Medium</title>
            <link>https://medium.com/@sonerpayci?source=rss-51752d4eade7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:59:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sonerpayci/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Aspect Oriented Programming(AOP) with C# and Cross-Cutting Concerns]]></title>
            <link>https://selectfrom.dev/aspect-oriented-programming-aop-with-c-and-cross-cutting-concerns-d4793ca6d5df?source=rss-51752d4eade7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4793ca6d5df</guid>
            <category><![CDATA[aspect-oriented]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[cross-cutting-concerns]]></category>
            <category><![CDATA[postsharp]]></category>
            <dc:creator><![CDATA[Soner Paycı]]></dc:creator>
            <pubDate>Sun, 30 Jul 2023 02:52:30 GMT</pubDate>
            <atom:updated>2023-08-13T12:07:20.880Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Aspect oriented programming (AOP)</strong> is a concept that ensures increased modularity by separating <strong>cross-cutting concerns</strong>. Well, what the hell is <strong>cross-cutting concerns</strong>?</p><h4><strong>Cross-Cutting Concerns</strong></h4><p>In short, <strong>cross-cutting concerns</strong> can be thought as a general expression of the features that should be implemented to a program for reaching better quality and robust execution like <strong>caching, monitoring, validation, logging, exception handling</strong>. Although these features do not constitute the main logic/purpose of the program, they should be used widely throughout the program for better execution and diagnosis.</p><p>Using these features frequently inside main logic code-blocks might be causes high dependency chains and low maintainability. Besides, code readability is reduced, and in large projects with multiple people working on, it may impair the cohesive work of the developers.</p><p>To minimize these issues, <strong>aspect-oriented programming</strong> helps to separate “<strong>cross-cutting concerns”</strong> from the main logic.</p><h4>A Quick and Basic Quide to Implement Aspect-Oriented Programming with using PostSharp</h4><p>Let’s say we are working on an API to perform crud operations on fruits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IY9WHgwF9NkwzDB4zy0ufA.png" /></figure><p>Since this is a demo project, we won’t communicate with real database, but rather act on our own custom repository which holds a collection for created objects and performs crud operations on that collection.</p><p>We have a Fruit entity which extends EntityBase class. EntityBase class holds common properties for an entity such as Id, CreatedDate, UpdatedDate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uprfqrs_YRU9_aHULM6GKg.png" /><figcaption>Fruit entity and EntityBase class.</figcaption></figure><p>Also, we have a FruitRepository that extends a generic BaseRepository&lt;T&gt; class which also implements a generic IRepository&lt;T&gt; interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5fbzkD5pRAQ4neEYnMg7Q.png" /><figcaption>FruitRepository and BaseRepository</figcaption></figure><p>At creation of an instance of an entity, we should set a unique identifier(Id) value for that instance. Also, setting transaction dates at operations like create and update is a good approach to track record lifecycle. What if we want to do these all with <strong>aspect-oriented programming</strong>? Well, let’s see.</p><p>Install PostSharp throught NuGet package manager. Next, let’s create an attribute to be triggered when the referencer method is called.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*0D9Cvmz1_rgcUyD_uXkabw.png" /><figcaption>CommonPropertySetterAttribute.cs</figcaption></figure><p>Then, let’s reference our [CommonPropertySetter] attribute on create and update method declerations on our interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*hAUX_BwQUHX_Vew5tuR9cw.png" /><figcaption>[CommonPropertySetter] attribute added on Create and Update method signatures.</figcaption></figure><p>Since it’s an interface, to distribute the [CommonPropertySetter] attribute to inheriting classes, we use AttributeInheritence with value of Multicast.</p><p>Also, we pass an OperationType value to our attribute to determine if current operation is a create or update.</p><p>Let’s call our /Fruit endpoint with an example Post request through swagger and see what’s happening.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEV_kQjmRMz2Nu30q7O9kw.gif" /></figure><p>As we see, when Create method invoked, the aspect described as [CommonPropertySetter] intercepts the method and perform its OnInvoke method to fill required common data to entity as we wanted. With <em>args.Proceed();</em> the execution context continues to execute original method.</p><p>In this short scenario, we have separated the concerns like setting values to common entity properties on create and update operations ​​for our own custom repositories from our main logic. Although it is not the best practice in cases such as manually assigning ids, it is used because it is a good example for aspect.</p><p>We could use similar approaches for purposes such as logging, caching, authentication and authorizing requests, notifying users and monitoring to make our software easier to maintain by grouping features and behavior into different manageable contexts which all have a specific purpose and business.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4793ca6d5df" width="1" height="1" alt=""><hr><p><a href="https://selectfrom.dev/aspect-oriented-programming-aop-with-c-and-cross-cutting-concerns-d4793ca6d5df">Aspect Oriented Programming(AOP) with C# and Cross-Cutting Concerns</a> was originally published in <a href="https://selectfrom.dev/">SelectFrom</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing ElasticSearch & Kibana & Filebeat Stack on the Existing Backend Service]]></title>
            <link>https://selectfrom.dev/implementing-elasticsearch-kibana-filebeat-stack-on-the-existing-backend-service-5b599bb92843?source=rss-51752d4eade7------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b599bb92843</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[generic-handler]]></category>
            <category><![CDATA[command-pattern]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[elastic]]></category>
            <dc:creator><![CDATA[Soner Paycı]]></dc:creator>
            <pubDate>Sun, 03 Apr 2022 12:08:11 GMT</pubDate>
            <atom:updated>2022-06-25T18:30:20.965Z</atom:updated>
            <content:encoded><![CDATA[<h3>Implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*3fgs6gDsvGd15jcL" /><figcaption><a href="https://unsplash.com/photos/dJw88I9GeNI">Image</a> by <a href="https://unsplash.com/@lazizli">Lala Azizli</a> on Unsplash</figcaption></figure><p>We have a backend API written with C# that accepts all requests through one single .ashx file and determines which service should handle the incoming request according to the type of the request it receives.</p><pre>The services layer uses the command pattern to perform its tasks.<br><br>Based on that, the system answers all incoming requests from a single place(.ashx), distributes them to the services, and the services call various commands and performs the operations. The produced results are returned as responses.</pre><p>We are using log4net package for ease of logging. It will be the same with this new approach, but we want to log all request and response information as well as all commands in a structured state.</p><figure><img alt="implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an existing backend service" src="https://cdn-images-1.medium.com/max/689/1*D2tA3YBpto1HT0SZRKh7tQ.png" /></figure><p>Let’s take a look at the current logging configuration and code.</p><figure><img alt="Existing Logging Configuration for implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an existing backend service" src="https://cdn-images-1.medium.com/max/641/1*RRZ7B9tln71zB7GegT14JQ.png" /><figcaption>Existing Logging Configuration</figcaption></figure><figure><img alt="Unstructured Logging Mechanism (.ashx file) when implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an existing backend service" src="https://cdn-images-1.medium.com/max/1024/1*ej83Xy0_YAHyM-a45cO4kQ.png" /><figcaption>Unstructured Logging Mechanism (.ashx file)</figcaption></figure><pre>We want to put our logs in a structural shape. But, on the other hand, we expect the logging mechanism to work in harmony with the past, since this change may take a very long time.</pre><p>Here is the new approach for logging structured data:</p><figure><img alt="The new configuration, FileLog for old logging logic and MethodLog for the new one that will be implemented using ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service" src="https://cdn-images-1.medium.com/max/1024/1*RJydqxat6s1kq4C_3CTzlA.png" /><figcaption>The new configuration, FileLog for old logging logic and MethodLog for the new one that will be implemented.</figcaption></figure><p>So, we are done with configuring the logging mechanism. Let’s implement logger logics at the related points in the API.</p><pre>We should change the logging logic in the .ashx file with the new one structured for Elastic to simplify the querying of logs later.</pre><figure><img alt="Structured Logging Mechanism / New Approach (.ashx file) when Implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service" src="https://cdn-images-1.medium.com/max/896/1*FSC-Ips6VVJioFy-6UzszQ.png" /><figcaption>Structured Logging Mechanism / New Approach (.ashx file)</figcaption></figure><figure><img alt="Command Base Class Log Method Implementation with ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service" src="https://cdn-images-1.medium.com/max/763/1*HldrNhbahYRlCH4hvNhpOA.png" /><figcaption>Command Base Class Log Method Implementation</figcaption></figure><figure><img alt="Caller point of generic Log method of Commands seen when Implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service" src="https://cdn-images-1.medium.com/max/783/1*2JI-5lENPwF5jMQ1XOpwpA.png" /><figcaption>Caller point of generic Log method of Commands</figcaption></figure><p>Let’s look at the new log files that were generated through log4net.</p><figure><img alt="new log files that were generated through log4net when Implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service" src="https://cdn-images-1.medium.com/max/811/1*o_l1H-O1Ath8Fz7jPNRNUQ.png" /><figcaption>!! TOP SECRET LOG !!</figcaption></figure><p>There are a few steps left before the happy ending. Creating the required services:</p><pre>1- Install Elastic.(this is the subject of a separate article, I will add it soon.)<br><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html</a></pre><pre>2- Install Kibana. (this is the subject of a separate article, I will add it soon.)<br><a href="https://www.elastic.co/guide/en/kibana/current/install.html">https://www.elastic.co/guide/en/kibana/current/install.html</a></pre><pre>3- Install Filebeat. (this is the subject of a separate article, I will add it soon.)<br><a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html">https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html</a></pre><figure><img alt="Kibana output when Implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on an Existing Backend Service" src="https://cdn-images-1.medium.com/max/1010/1*dHvYZNi94qH3VCTqH9jBTw.png" /><figcaption>An output from Kibana.</figcaption></figure><figure><img alt="Kibana dashboard" src="https://cdn-images-1.medium.com/max/1024/1*uEG9QXsnJYCw49LfpCAtfQ.png" /><figcaption>A Simple Dashboard from Kibana.</figcaption></figure><p>As a result, we improved our logging mechanism to keep track of the details of user operations and we made it easier to access the logs.</p><p>At the end, we can query the logs with specific values. We can create simple dashboards using properties on logs and also report errors with their exception details easily.</p><p>And with that, you’ve crossed another level to becoming a boss coder. GG! 👏</p><p>I hope you found this article instructional and informative. If you have any feedback or queries, please let me know in the comments below. And follow <a href="https://selectfrom.dev/">SelectFrom</a> for more tutorials and guides on topics like <a href="https://selectfrom.dev/tagged/big-data">Big Data</a>, <a href="https://selectfrom.dev/tagged/spark">Spark</a>, and <a href="https://selectfrom.dev/tagged/data-warehouse">data warehousing</a>.</p><p><strong>The world’s fastest cloud data warehouse:</strong></p><p>When designing analytics experiences which are consumed by customers in production, even the smallest delays in query response times become critical. Learn how to achieve <strong>sub-second</strong> performance over TBs of data with <a href="https://www.firebolt.io/?v=m"><strong>Firebolt</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b599bb92843" width="1" height="1" alt=""><hr><p><a href="https://selectfrom.dev/implementing-elasticsearch-kibana-filebeat-stack-on-the-existing-backend-service-5b599bb92843">Implementing ElasticSearch &amp; Kibana &amp; Filebeat Stack on the Existing Backend Service</a> was originally published in <a href="https://selectfrom.dev/">SelectFrom</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>