<?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 Jhora Zakaryan on Medium]]></title>
        <description><![CDATA[Stories by Jhora Zakaryan on Medium]]></description>
        <link>https://medium.com/@jhorazakaryan?source=rss-a284f91495cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*cAM1MGPUfGnDkp52dOp0qA.jpeg</url>
            <title>Stories by Jhora Zakaryan on Medium</title>
            <link>https://medium.com/@jhorazakaryan?source=rss-a284f91495cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:09:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jhorazakaryan/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[Things I Learned as a Software Engineer]]></title>
            <link>https://medium.com/@jhorazakaryan/things-i-learned-as-a-software-engineer-1ff59e3c7bfa?source=rss-a284f91495cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ff59e3c7bfa</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[personal-development]]></category>
            <dc:creator><![CDATA[Jhora Zakaryan]]></dc:creator>
            <pubDate>Mon, 21 Aug 2017 18:11:40 GMT</pubDate>
            <atom:updated>2017-08-21T18:11:40.592Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nOHl-lPOx6ZvIhQJxqnY2w.jpeg" /><figcaption>Photo Credit: Amanda Sandlin, Unsplash</figcaption></figure><p>I’m into the seventh year of my career as a software engineer. I’ve been involved in programming even before I started attending college, which was almost a decade ago. Now that I think about it, my passion for software was probably born when as a kid I used to sneak into my brother’s room to play Doom on his IBM PC. Living in a struggling post-soviet country, having a PC at home was a luxury which many couldn’t afford, and I consider myself lucky for the chance to get exposed to the industry that I came to love and make a living on.</p><p>This article is a collection of random thoughts and observations on the things I learned through my journey writing computer software.</p><h3>Languages and frameworks are just tools</h3><p>We all know that one guy who won’t stop telling on every occasion how wonderful Java is and how he wouldn’t even consider coding in another language. Well, in my opinion, this speaks to the person’s arrogance and lack of professional competence. It is OK to favor the features, syntactic style or other aspects of one language versus the other. But at the end of the day languages and frameworks are means to an end, and not something worth ‘worshiping’. It’s worthwhile to invest in learning the ins and outs of a popular programming language, but limiting your skill set to just that won’t take you far. Just like an artisan can’t make a chair by only using a hammer, a good engineer can’t build elegant solutions by unwilling to choose the right tools for the job and invest in learning new things.</p><h3>Learn concepts, not technical details</h3><p>If you want to sharpen your engineering skills, choose topics that delve into general concepts and ideas over the ones that dissect a specific technology and concentrate on technicalities. Instead of reading a book on yet another web service framework, watch an online course on network security. Put aside that API documentation and pick up a book on functional programming. While it may not make you instantly better at what you do when you return to office in the morning, grasping new ideas will change the way you look at things and will introduce new approaches to tackle technical problems at workplace.<br>Time is the most valuable resource in our lives. When investing time in something — whether it’s entertainment, a new relationship or something we choose to learn, we evaluate the returns that we expect to get from the investment. We often tend to look at just short-term gains and ignore the long term benefits. This is an important realization, which, when admitted, makes us better decision makers.</p><h3>People are the most valuable assets</h3><p>I don’t like when people are referred to as ‘resources’. Human resources, resource planning, resource management… Dictionaries define the word <em>resource</em> as a stock of supplies that are utilized to make the organization function as intended. When people are collectively referred to as ‘resources’, there’s one important factor that gets lots in generalization: individuality. As human beings, we all have strengths and weaknesses. When you replace 10 bricks with 10 other bricks in a construction site, you can expect zero changes in the way operations are carried out. The same is not true about humans.</p><p>A team of a few carefully selected, passionate individuals is capable of doing much more than a bigger team, twice the size, but with lack of a shared vision or ambition. Hiring the right people and keeping them motivated is what can make or break a company, and this is particularly true about startups.</p><h3>The smartest people are humble</h3><p>Think about people you enjoy being around at workplace and you feel privileged to learn from. The chances are that they are the kind of people who can convey their thoughts in a very systematic and understandable way, without tendencies to dramatize and over-complicate things. They are also people who can genuinely feel empathy towards other people, and see the picture from someone else’s perspective. What’s more important, they are never afraid to admit their mistakes and are eager to learn and improve from them. Being humble is a trait that is easy to lose when you advance your career a little bit and realize that you’re getting good at what you do. It is a valuable quality that leads to peer respect and admiration.</p><h3>Money is not so important</h3><p>It’s very easy to be lured in the materialistic trap of the modern society. Everyday we’re advertised that there’s a new car we need to own, fancier ways to entertain ourselves and a revolutionary toothpaste that threatens to leave dentists out of jobs. So we make the goals of our lives to earn reasonably enough money to feel the instant gratification of buying all of those things. And then somehow we find ourselves wanting more. It is a viscous cycle which, if not broken, will eventually lead to anxiety and unhappiness. Without trying to sound like a zen philosopher, I believe that happiness is not a function of the amount of money we spend. It should stem from the passion towards what you do, towards everyday moments and life in general. Money should be a by-product, not a goal.</p><h3>Health is a habit</h3><p>As much as we love what we do, writing software is an exhausting activity. There was a period in my life when I would do my full time job at the office, then commute home only to find myself working on a small freelance project, sitting in front of the laptop for the most part of the day. It was a path to disaster.<br>I did not understand the importance of this a couple of years ago: health — both physical and mental is invaluable. Whatever it is that works for you — lifting weights at the gym, jogging in the morning, yoga and meditation choose a thing or two that involve both physical activity and food for thought, dedicate enough time to make what you chose a habit. It can be surprising how that will affect your outlook and improve quality of life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ff59e3c7bfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The SOLID Cheat Sheet]]></title>
            <link>https://medium.com/@jhorazakaryan/the-solid-cheat-sheet-b383b01a4db?source=rss-a284f91495cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b383b01a4db</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Jhora Zakaryan]]></dc:creator>
            <pubDate>Sat, 19 Aug 2017 20:21:06 GMT</pubDate>
            <atom:updated>2017-08-19T20:42:46.656Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J5isra9i-OHph3c5YPeUmg.jpeg" /><figcaption>Photo Credit: Diz Play from Unsplash</figcaption></figure><p>Basic principles of object-oriented programming are taught in every computer science course. Every student is supposed to know what encapsulation, inheritance and polymorphism are about. It’s a frequent topic for interview questions in many companies.</p><p>The aforementioned concepts are simply tools in a developer’s toolbox. What some people don’t realize is that familiarity with those tools doesn’t necessarily make one good at designing software. I would go as far as to say that familiarity with the “great trinity” doesn’t tell you anything valuable about a candidate during an interview. Good design is a skill which comes with (a) working with high quality code written by someone else and to some extent (b) by trial-and-error — seeing what works/is easy to maintain vs what design choices end-up making your life harder at some point.</p><p>In this context, while SOLID may sound like yet another moniker for things everyone already knows, I think that it can serve as a much better guideline when designing software. Likewise, a good grasp on these principles tells a lot more about a candidate than any beaten, old OOP questions will ever do.</p><p>This article is a quick summary of all SOLID principles, each accompanied by an example in C#. I don’t claim that my understanding of the principles is super-accurate, so feel free to share your opinions and corrections in the comments section.</p><h3>1. Single-Responsibility Principle</h3><blockquote>Each and every class in your project should have one, and only one responsibility.</blockquote><p>Consider this Order class in an e-commerce application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f19fcfe58e626ffd6b96adf87403093/href">https://medium.com/media/5f19fcfe58e626ffd6b96adf87403093/href</a></iframe><p>If you lean back and think for a moment, you’ll see that the class doesn’t have a single responsibility. Rather, it does two different things — models a shopping order and takes care of its data storage. It will make sense to break the class down to two classes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fc8bfef7e3419c99d5565ef0fa8a9de/href">https://medium.com/media/6fc8bfef7e3419c99d5565ef0fa8a9de/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/017ab43df17c1a8436e056d90c4c617e/href">https://medium.com/media/017ab43df17c1a8436e056d90c4c617e/href</a></iframe><p>Designing your systems with classes that adhere to single responsibility principle makes your classes easier to maintain, replace, refactor and test.</p><h3>2. Open-Closed Principle</h3><blockquote>Entities in your software system should be open for extension, but closed for modification.</blockquote><p>To put it in other words, you need to allow others to extend the behavior of your entities, but in no way modify your source code. Let’s look at the OrderRepository class from the previous example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/017ab43df17c1a8436e056d90c4c617e/href">https://medium.com/media/017ab43df17c1a8436e056d90c4c617e/href</a></iframe><p>Let’s assume that OrderRepository currently works with an MSSQL database. What if we want to switch to, say, an API which is provided by a third party service, which in its turn, stores the data in one of those exotic in-memory databases? An obvious solution would be to dig into the bodies of the methods in OrderRepository and simply modify them to work with the new database system. This is exactly what you shouldn’t be doing, according to the Open-Closed Principle. Even if you put the SOLID principles apart, you already have a functioning class. Why would you want to get rid of it anyway? What if you will need to use it again at some point in the future?</p><p>OK, now that directly modifying OrderRepository is out of the table, let’s think of what else can we do. What if we derive from it and redefine the methods in the child class? This is much better than direct modification, but still has its complexities. What happens when a new function or property is added to OrderRepository? Your new repository class gets cluttered with that as well. In some cases, the new properties/functions added to OrderRepository may be MSSQL-specific. You don’t want to clutter your new repository class with such baggage.</p><p>Think for a moment, what makes repository a repository? It’s just a simple service-class which works with data. So why not model this in an interface which does exactly that, without specifying any implementation details? In C# you can achieve this by defining an <em>interface</em>. There may be other tools in the language of your choice to do that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12b2e9766eded9d2c32c6e3358f93f85/href">https://medium.com/media/12b2e9766eded9d2c32c6e3358f93f85/href</a></iframe><p>Now, having the interface, you simply need to make your different OrderRepository implementations adhere to it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af3917437fcaccc12c5c73003d981ce7/href">https://medium.com/media/af3917437fcaccc12c5c73003d981ce7/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/53a34ea4127e9ba2abe1d48b7c7247c7/href">https://medium.com/media/53a34ea4127e9ba2abe1d48b7c7247c7/href</a></iframe><p>You completely fulfill the Open-Closed Principle and your different implementations are completely decoupled. Not only that, but by programming against the IOrderRepository interface vs a concrete class, you gain additional benefits in the form of dependency injection (if needed).</p><h3>3. Liskov Substitution Principle</h3><p>LSP is by far the most complicated, and hard-to-grasp idea in the list of SOLID principles. I came across different definitions of the principle, and I think that the one that follows, found in <a href="http://stackoverflow.com/questions/56860/what-is-the-liskov-substitution-principle">this brilliant StackOverflow thread</a>, is the best.</p><blockquote>Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.</blockquote><p>The principle is best explained in a classic example of shape class hierarchy. Suppose you have to model a hierarchy of different geometric shapes. How would you model your Rectangle and Square classes? Intuitively, a square <em>is a</em> rectangle, so your intuition tells you to inherit Square from Rectangle. While, on many levels, this is the perfectly correct thing to do, this may lead to unwanted consequences in the future. Let’s look at the Rectangle class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c4ca9da86d7bce41f8617fd3915e129/href">https://medium.com/media/5c4ca9da86d7bce41f8617fd3915e129/href</a></iframe><p>If you inherit your Square from Rectangle, what would your SetWidth and SetHeight functions do? Most probably both will affect width and height at the same time, because in the context of a Square height and width are the same. The catch is that you may have code somewhere that will make assumptions based on width and heightfields being independent. And if that’s the case, and you refer to an instance of Square with your reference of type Rectangle, you will end up breaking that code.</p><p>To avoid this, be very careful when modeling your abstractions. If you feel that at some point such problems may occur, don’t inherit your abstractions from each other. In this example, just make Shape the base class of your Square.</p><h3>4. Interface Segregation Principle</h3><blockquote>Clients should not have to implement interfaces that they don’t use.</blockquote><p>Let’s look at the geometric shapes hierarchy once again.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b87897d5509199b04dabfc6fee19260e/href">https://medium.com/media/b87897d5509199b04dabfc6fee19260e/href</a></iframe><p>There’s too much happening in this interface. It defines your 2D shape model, how it looks on the screen, how is it rendered and how is it animated. What if you want to pass it to a module that saves the state of your geometric canvas on a disk, so that it can be restored after restarting the application? If your data saving module relies on the IShape2D interface, the class realizing your interface will have to define all the unnecessary drawing and animation logic. It makes sense to separate such concerns by introducing new interfaces for them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3886c43606608bc6a8528e828ae3af45/href">https://medium.com/media/3886c43606608bc6a8528e828ae3af45/href</a></iframe><p>Now that you’ve redefined your interfaces, you can model your Ellipse abstraction like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23da265f6b25fe9feac0c04431c7e3b3/href">https://medium.com/media/23da265f6b25fe9feac0c04431c7e3b3/href</a></iframe><p>To sum up, you end up with a much more robust object-oriented design. You can attach different behaviors to your classes by implementing just the interfaces you want. On the other hand, you’re not forced to implement anything that you don’t need.</p><h3>5. Dependency Inversion Principle</h3><blockquote>High level modules should not depend on lower level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.</blockquote><p>This last principle is a topic for a dozen articles of a similar length in and out of itself. During the last couple of decades, this principle has led people to rethink the way dependencies are introduced and managed in a complex software system and gave rise to concepts of Dependency Injection and IoC Containers. For the scope of this article, we will look at a small example which demonstrates a hard dependency between two entities and how we can redesign the hierarchy to get rid of it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb46cc9a8973483fdd714d4756bb1f33/href">https://medium.com/media/fb46cc9a8973483fdd714d4756bb1f33/href</a></iframe><p>Rectangle is a class that models the abstraction of the corresponding geometric shape. RenderingContext encapsulates all the logic associated with displaying your shape on the screen (incl. communicating with the graphics device, allocating buffers for the geometry etc). Here Rectangle has a dependency on RenderingContext. That means that each time something is changed in the RenderingContext, there’s a chance that something will break in your Rectangle. It may take significant time and effort to identify that something has gone wrong, localize the issue and fix it. To demonstrate the dependency between the classes, we can draw a class diagram.</p><p>To overcome this problem, you need to abstract away the implementation details of your RenderingContext in an IRenderingContext interface. After doing that, you need to modify your Rectangle to work with IRenderingContext instead of RenderingContext.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/81d968356e3fc62232a44ebee602ed92/href">https://medium.com/media/81d968356e3fc62232a44ebee602ed92/href</a></iframe><p>Before I end this oversimplified explanation of Dependency Inversion, I want to show what happens to the dependencies after introducing the interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*wCRNj2RKPqr_kq5i_xpJ7Q.jpeg" /></figure><p>I hope that after looking at this diagram, it will become clear why the term is called <em>Dependency Inversion.</em></p><h3>Afterword</h3><p>It is not always possible to follow SOLID guidelines, and based on your circumstances, it may not make sense to follow some of them. We don’t live in a perfectionist’s dream and more often than not we consciously choose to write low quality code. At the end of the day, it all comes to compromises. Having said that, I do believe that good software design matters. Even if the time-cost of writing high quality software may seem unjustified in the short term, a robust, clever and simple software system design will pay off later, and in tenfolds. SOLID doesn’t cover every aspect of the “craftsmanship”, but it’s a good start.</p><h3>More on the Topic</h3><ol><li>I can’t stress out how much I like <a href="https://lostechies.com/derickbailey/2009/02/11/solid-development-principles-in-motivational-pictures/">these motivational SOLID posters</a> by Derick Bailey.<br>2. Dependency Inversion, Dependency Injection and IoC containers are covered in great detail in <a href="https://www.amazon.com/Dependency-Injection-NET-Mark-Seemann/dp/1935182501">Mark Seemann’s “Dependency Injection in .Net”</a>. Although the book builds its examples on .Net, the core ideas and concepts are applicable everywhere.</li></ol><p>The article was originally published on <a href="http://zakaryan.io/">zakaryan.io</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b383b01a4db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>