<?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 Menelaos Kotsollaris on Medium]]></title>
        <description><![CDATA[Stories by Menelaos Kotsollaris on Medium]]></description>
        <link>https://medium.com/@mkotsollaris?source=rss-1c2607919fa5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tN9xjvrEoaLS4aqMyqMNlw.jpeg</url>
            <title>Stories by Menelaos Kotsollaris on Medium</title>
            <link>https://medium.com/@mkotsollaris?source=rss-1c2607919fa5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 22:52:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mkotsollaris/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[People also ask tool and AI Keyword Research @ kwrds.ai]]></title>
            <link>https://mkotsollaris.medium.com/people-also-ask-tool-and-ai-keyword-research-kwrds-ai-4a5e9a937270?source=rss-1c2607919fa5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a5e9a937270</guid>
            <category><![CDATA[ai-keyword-tool]]></category>
            <category><![CDATA[keyword-research]]></category>
            <category><![CDATA[content-marketing]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[people-also-ask]]></category>
            <dc:creator><![CDATA[Menelaos Kotsollaris]]></dc:creator>
            <pubDate>Sat, 09 Nov 2024 19:34:21 GMT</pubDate>
            <atom:updated>2024-11-10T02:45:25.174Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Build it and they will come.. But will they?</blockquote><p>While it’s true that SEO is a long game, it’s also true that it brings in free traffic from some of the most motivated prospects your product could have. Think about it: someone takes the time to search for a topic, lands on your page, and then does additional research to check out your product. By nature, this person is a warm prospect.</p><p>So, why do so many top founders and entrepreneurs advise against prioritizing SEO early on? The truth is, building an SEO-friendly website can be a time-consuming effort, and the payoff isn’t always immediate. As a result, the common recommendation is to allocate resources elsewhere in the early stages.</p><p>But that’s exactly why I built <a href="https://www.kwrds.ai/"><strong>kwrds.ai</strong></a></p><h3>People Also Ask Tool</h3><p>People Also Asked about an important feature in SEO. It helps you understand what your audience is looking for and what they are interested in. kwrds.ai offers a comprehensive <a href="https://www.kwrds.ai/people-also-ask">People Also Ask tool</a> that gives you up to 80 (🤯!) questions to be generated. Alongside with the questions, you get the authentic answer and the URL that is ranking for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HcuI2FrBTXjux_qS.png" /><figcaption>People also ask tool for “adidas shoes” results</figcaption></figure><p>With kwrds.ai, you can utilize this tool to help see what people are searching for, easily generate content with our LLM AI keyword research tool, and help drive organic traffic and interest.</p><h3>AI Keyword Research Tool</h3><p><a href="https://www.kwrds.ai/keyword-research">AI Keyword Research tool</a> is a fairly new emerging field. Traditionally, keyword research was achieved via Google’s Keyword Planner. However, Keyword Planner is quite primitive, as it will not give you possible content marketing ideas, but instead you have to bring your own data into it. The science behind finding possible permutations and combinations of words is what Keyword Research is; AI has multiplied the potential and mining approaches of these keywords and has opened the gateway of possibilities in terms of keyword research tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7KJMyXGm_a1ueaMr-BgOZA.png" /><figcaption>AI Keyword Research tool via <a href="https://www.kwrds.ai/">kwrds.ai</a></figcaption></figure><p>AI keyword research is quite exciting, as it can provide both breadth and depth to your content ideas. If you want to read more about it, here’s a <a href="https://www.kwrds.ai/blog/keyword-research-case-study">great blog post</a>.</p><h3>Is SEO Worth it?</h3><p><strong>YES! </strong>kwrds.ai has eliminated the barrier to entry, through an impactful product with a freemium transparent and affordable tool. It’s really painful to me, to watch companies and startups spend tremendous amounts of dollars in ads, and not focus on organic traffic. Gone are the days when you would need to have a significant sizeable investment for SEO; getting started is now easier than ever, and you are really missing out if you are not leveraging SEO to reach out to some of your most desperate customers lurking for your product. Get started for free today at <a href="https://www.kwrds.ai/">kwrds.ai</a> 🚀</p><h3>FAQ</h3><ul><li><strong>How much does keyword research cost?<br></strong>Get started for free using<a href="https://www.kwrds.ai/"> kwrds.ai</a>!</li><li>How to rank for people also ask?<br>To rank in the ‘People Also Ask’ boxes on Google, you should respond concisely towards the beginning of your content if the content delivers an exhaustive answer to a particular query. This brief reply should be approximately 2–3 sentences. By presenting this swift reply, Google may incorporate it in a featured snippet or People Also Ask tool box.</li><li><strong>How does people also ask work?<br></strong>The Google feature People Also Ask (PAA) operates by ascertaining and presenting supplementary queries related to the user’s initial search request. Conceived as a rich snippet, it enriches users’ search experiences by potentially answering connected questions they might have. To illustrate, if someone queries “how to start a garden,” the PAA box will populate with related questions about the primary search, thereby widening and enhancing the searcher’s understanding of the topic. Therefore, the PAA function can substantially contribute to a more comprehensive and rewarding search experience.</li><li><strong>Which keyword tool is most accurate?<br></strong>kwrds.ai is the most efficient keyword tool, giving you rich metrics such as CPC, trends, competition, and so on. Other tools like Keyword Planner from Google are also quite accurate, as they directly using Google’s datasets, therefore offering highly accurate keyword information.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a5e9a937270" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Facet]]></title>
            <link>https://medium.com/runfacet/announcing-facet-72c22748c16b?source=rss-1c2607919fa5------2</link>
            <guid isPermaLink="false">https://medium.com/p/72c22748c16b</guid>
            <category><![CDATA[rollbacks]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[feature-management]]></category>
            <category><![CDATA[features]]></category>
            <category><![CDATA[rollout]]></category>
            <dc:creator><![CDATA[Menelaos Kotsollaris]]></dc:creator>
            <pubDate>Mon, 08 Mar 2021 03:45:25 GMT</pubDate>
            <atom:updated>2021-03-24T05:28:34.828Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Introducing Facet: a low-code platform to manage features</blockquote><p>Managing feature delivery to customers is a crucial activity of virtually any software company. The established tools in the field rely on a code-heavy approach, <a href="https://en.wikipedia.org/wiki/Feature_toggle">feature flags, or toggles</a>. At Facet, we reimagine the way companies deliver features through a <em>low-code approach</em> that <strong>avoids temporary conditional statements</strong>.</p><h3>How do Established Feature Management Solutions Work</h3><p>The primary way to deliver features on a large scale is to use feature flags. Programmers set their feature flags by writing code, whereby they handwrite logic as to what will go out in production or not. The process looks something like this:</p><pre>// usually this is derived via HTTP call to the feature flag vendor</pre><pre>if ( enabled ) {</pre><pre>  return newVersion();</pre><pre>} else {</pre><pre>  return oldVersion();</pre><pre>}</pre><p>In a realistic scenario, the value <em>enabled</em> would be driven from a live-vendor configuration.</p><p>This process, repeated for each feature, would determine what would be displayed or not in production. Feature flag tools also require developer time for configuration and periodic maintenance.</p><h4>Pitfalls of the if-else-statement-syndrome</h4><p>As projects grow and more feature flags are added to the system, conditional statements are littered everywhere within the codebase. This code needs to be maintained and updated manually every time features are shipped. Furthermore, feature flags are meant to be short-lived and should be deleted after a feature is rolled out Failure to manually remove feature flags has led to irrecoverable disasters, including Knight Capital going bankrupt because of <a href="https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/">feature-flag mismanagement</a>.</p><p>These unique safety hazards are inherently the result of the temporary nature of feature flags: their code is written to be <em>eventually deleted</em>. These exploits are injected into core parts of the system, where small errors can render the entire platform useless. Relying on cross-department communication and manual changes all but guarantees errors will be eventually introduced. With or without ample resources, reliance on feature flags has been proven risky.</p><p>With solutions that rely heavily on developer time, having numerous or few resources creates issues. Small and medium-sized companies are discouraged from using feature flags due to scarce developer time. Larger companies prefer to develop in-house solutions to gain more control. For example, <a href="https://devblogs.microsoft.com/buckh/controlling-exposure-through-feature-flags-in-vs-team-services/?utm_source=thenewstack&amp;utm_medium=website&amp;utm_campaign=platform">Microsoft built their own feature flag implementation</a>, even though there are multiple well-established vendors.</p><p>As we were maintaining feature management logic in various previous projects, it struck us as odd that engineers need to write so much <em>boilerplate</em> code to deliver features.</p><blockquote>We, the engineers, write code intended to be long-lived, along with the features we deliver. However, for rollouts, we rely on a clunky short-lived mechanism. We were taken aback by the misaligned practices between the code we write to develop vs the code we write to deliver features.</blockquote><p>We saw the need for a scalable solution that required no manual configuration or maintenance. A solution that does not rely on the production of code that is destined to be manually discarded. That way, engineers could focus on developing products, while the<strong> feature rollout mechanism is maintained by a different platform </strong>— this was when <strong>Facet</strong> was born.</p><h3>The Facet Approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*deRQg1CterHbrjt1XpQ-ZA.gif" /></figure><p>We are on a mission to eliminate boilerplate code from feature management and to introduce an architecture of code-less continuous delivery. With Facet, rollout-declarations are achieved through GUI/CLI component(s). This means that there is no code maintenance as all logic is maintained within Facet.</p><blockquote>You will never need to write conditional statements when using Facet.</blockquote><p>This is a major shift from existing solutions. With feature flags, developers are required to deliver features into production. However, decisions about what features are delivered — and when they are delivered — usually come from different teams within a company. Product and project teams have a big say in this, and developers implement the changes.</p><p>This leads to delayed or unwanted outcomes caused by potential communication barriers between team members. Facet aims to solve this problem by offering full ownership of the process to the team that is in charge of product delivery.</p><p>Try the first version of our platform that focuses on front-end rollouts <a href="https://facet.run/documentation/">by clicking here</a>.</p><p>We are actively developing the backend limb of our platform, while we expand our platform to a full-blown replacement for feature flag-based management.</p><p>Some of the open Q&amp;A might be:</p><h4>Should code be determining what features are delivered to production?</h4><p>Traditionally with feature flags, project managers and engineers collaborate to choose what goes out and when. Wouldn’t it be nice if a framework could abstract the rollout mechanisms independently from <em>what</em> is developed versus <em>when</em> it’s derived to customers?</p><p>At facet, we focus on creating this layer of abstraction where engineers can focus on business logic and use our platform to determine what goes out or gets recalled.</p><p>We want to reinforce healthy communication between teams by removing bridges and unwanted communication traps that are presented during feature flag usage and maintenance.</p><h4>Can the same logic be applied to Backend projects?</h4><p>Unlike the frontend where it is quite straightforward to select a combination of elements to be rolled out, the backend could be a little more complicated. However, this does not make it unfeasible.</p><p>If we treat each function code block as a facet, we can define UI components containing every possible function. This way, we determine what’s rolled out or not through a GUI or CLI selection.</p><h3>Benefits of choosing Facet over Feature Flags</h3><ul><li>Declare what’s shipped or not independently from business logic</li><li>Eliminated the need for SDK implementation and maintenance</li><li>Eliminated the need for maintaining conditional code and remembering to delete it</li><li>Improve communication within team members and accelerate software delivery</li></ul><h3>But…. I like coding</h3><p><strong>We love to code, too!</strong> That’s <em>why</em> we created Facet. We know developer time is better spent on product development rather than repetitive and manual tasks. We believe in a more declarative and less conditional future of programming, one that will not include the use of conditional statements for every feature that we ship — and we are here to create it!</p><h3>So what’s next?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rL6_BIoYaHQ_MKa7sMltHw.png" /><figcaption>Manage facets through the Facetboard</figcaption></figure><p>This is just the start, many cool projects will follow, including:</p><ul><li>Backend facets</li><li>Embed analytics on how your facets are performing</li><li>Rollout multi-system facets through a single configuration</li><li>Personalized dashboard to maintain facets throughout the lifecycle</li></ul><p>We know this will be a long journey and we are excited to share what we learn as we progress.</p><p>Check our<a href="https://facet.run/documentation/"> Documentation</a> out to try our first versions. Your feedback would be tremendously useful as we expand our platform!</p><p>If you are interested in knowing more, <a href="http://facet.run/">subscribe to our newsletter</a> and<a href="https://twitter.com/runFacet/"> follow us on Twitter</a>.</p><p><strong>The Facet founding team </strong>— <a href="https://twitter.com/mkotsollaris">Menelaos</a>, <a href="https://www.linkedin.com/in/andrew-pinson-73565a2a/">Andy</a>, <a href="https://www.linkedin.com/in/vasilis-pallikaras-a87a58132/">Vasilis</a>, <a href="https://twitter.com/jkotsollari">Johan</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72c22748c16b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/runfacet/announcing-facet-72c22748c16b">Announcing Facet</a> was originally published in <a href="https://medium.com/runfacet">facet.run</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My experience @ MDA]]></title>
            <link>https://mkotsollaris.medium.com/my-experience-mda-226dc22a9027?source=rss-1c2607919fa5------2</link>
            <guid isPermaLink="false">https://medium.com/p/226dc22a9027</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Menelaos Kotsollaris]]></dc:creator>
            <pubDate>Sun, 19 Aug 2018 06:13:11 GMT</pubDate>
            <atom:updated>2018-08-19T06:13:11.199Z</atom:updated>
            <content:encoded><![CDATA[<p>I just completed a year with <a href="https://mdacorporation.com/">MDA</a> and prior starting at <a href="https://medium.com/u/21632f0cd659">Trulioo</a>, I will be summarizing my overall experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*Ma7ZStbS0gqjQSlSEc6wnQ.png" /></figure><h3>What is MDA?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bfe3ZhwflHRBZnmLlbu11A.jpeg" /></figure><p>MDA stands for <a href="https://en.wikipedia.org/wiki/Maxar_Technologies">McDonald, Detwiller and Associates</a>, which are the names of the founders. MDA was founded in 1969 and it has historically been known for its Geographic Information Systems development. MDA has recently shifted the core projects to the space engineering industry, under the wider umbrella of <a href="https://www.maxar.com/">MAXAR Technologies</a>, a conglomerative of <a href="https://mdacorporation.com/">MDA</a>, <a href="http://Digital Globe">Digital Globe</a>, <a href="https://www.sslmda.com/">SSL</a>, <a href="http://www.radiantsolutions.com/">Radiant Solutions</a> and <a href="https://www.google.co.uk/search?q=neptec&amp;rlz=1C5CHFA_enCA690CA690&amp;oq=neptec&amp;aqs=chrome..69i57j69i60l3j0l2.1094j0j4&amp;sourceid=chrome&amp;ie=UTF-8">Nepte</a>c. MAXAR has over 6,500 employees across all the business units.</p><h3>Interview Process</h3><p>Since I was working on the east coast prior to working for MDA, the whole interview process was remote. I applied through StackOverflow and the recruiter got back to me with 1 round of behavioural-type of questions. Then a 4-hour long interview took place with 3 MDA developers (senior, intermediate and junior) as well as with the engineering manager and project manager. There were several questions that I was shared via google docs and I was given 15 minutes to think about them, before the team start asking me about my solutions and thought process. The difficulty increased question after question. The focus was not given particularly on the solution as much as to see my way of how I think and solve problems. As for the programming language, it was up to me to choose the preferred language and I chose Java.</p><h3>Settling in Vancouver</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kI4GwbscIixlJzpd5zd7Og.jpeg" /></figure><p>Welcome to the Beautiful British Columbia. When people talk about Vancouver, you think that they exaggerate about the beauty and the of the city; but when you arrive here, you realize all that talk had basis and that Vancouver is awesome! One thing that I love about Vancouver is the healthy mentality that Vancouverites like to be known for.</p><p>The city is famous for its outdoors (biking, skiing, snowboarding, hiking etc.). The city emphasizes on a healthy lifestyle and is an advocate of eating healthy through its dynamic restaurant scene. Of course like all the other cities, Vancouver has some downsides as well. One drawback that you will hear every Vancouverite complain is of how expensive this place is and they are right to do so. The continuous rain in November can be depressing for many people that are not used to the rain as well. That being said, summer weather is great and very rewarding, assuming you make it through the rainy days.</p><h3>Projects</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5S657eJTt8ndb3c1d8eMUw.jpeg" /><figcaption>Dark Ship Tracking</figcaption></figure><p>I had the chance to work in one of the largest frontend applications that exist in the market. Due to the complexity of building scalable web mapping systems, MDA has a plethora of frontend applications built with Angular. The architecture is very unique. A lot of emphasis is given to code-reusability across different departments across MAXAR. For instance, when a Map component is implemented, the component is being pushed into a company-wide repo that can be used across different business units. This means that during each project, the public SDKs are enhanced and new features are added.</p><p>While this is a lengthy process as all components have to be tested and take a lot of time to be robust, in the long term, it adds up so much value to the business. The Map Component can now be reused for almost every (old and new) projects within MDA. The value of such an initiative is immense, since it is really hard to think of an application within MDA that does not need a map component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*stv7PbLZnXutHPADOft2nA.png" /><figcaption>git contributions</figcaption></figure><h3>Thoughts on Angular</h3><p>In the last year I used Angular2+ extensively from most of my work in MDA. There is no question that Angular is a powerful framework that has gotten much traction from the industry. I believe that larger and more established corporations like MDA would tend to pick a framework like Angular particularly because most of the engineers are mosly familiar with statically type-safe languages (Java, C#, etc.) and thus the learning curve will be shallower than choosing other frameworks such React, VueJS and so on.</p><p>Angular gets you started really fast. Its <a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a> structure makes it easy from programmers like myself who come from a Java background and the results come pretty fast. As the project grows, I noticed that there are several scalability concerns that come along with Typescript which I summarize below:</p><blockquote><strong>1. </strong><a href="https://en.wikipedia.org/wiki/Type_safety"><strong>Type safety</strong></a><strong> does not reassure </strong><a href="https://en.wikipedia.org/wiki/Type_signature"><strong>runtime type signature</strong></a><strong>.</strong></blockquote><p>One of the Typescript’s main purposes is to add type safety to javascript based. The main objective of type-safety is to help build better applications and can be scaled by allowing programmers type safety on <a href="https://en.wikipedia.org/wiki/Static_interpretation_of_time">static interpretation time</a>; <strong>but consequently, not on runtime</strong>. While this might be true, I personally found that type safety introduced more caveats rather than flexibility, particularly when trying to decompose http requests. While this type of errors get easier to spot with experience, they can be tricky for angular beginners. Type safety might seem like a great add-in initially but I personally didn’t feel that I was better of rather than writing pure javascript.</p><blockquote><strong>2. </strong><a href="https://angular.io/guide/attribute-directives"><strong>Attribute Directives</strong></a><strong> and </strong><a href="https://angular.io/guide/template-syntax"><strong>two-way binding</strong></a><strong> make the application more complex than simple.</strong></blockquote><p>Attribute directives allow bidirectional communication with <em>.ts</em> and <em>.html</em> files within each component. In non trivial cases, I’ve noticed that keeping track of the object state tends to be difficult <em>unless</em> controller logic is well-thought ahead of time. The difference is very noticeable when comparing to reactive programming. See this basic <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a> code:</p><pre>const MyComponent = {<br>  DatePicker: function DatePicker(props) {<br>    return &lt;div&gt;Imagine a {props.color} datepicker here.&lt;/div&gt;;<br>  }<br>}</pre><p>In the example above, I am able to directly reference to my object on-the-go through JSX. I find this to be very powerful because unlike backend development, frontend applications’ View, it terms of <a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a>, needs to interact much more frequently with the rest of the components. When building larger components, <em>.html</em> and <em>.ts</em> files tend to become larger and consequently harder to keep track. JSX makes it easier to keep track of each object state as it uses only 1 file for every action.</p><p>While building applications with Angular is really fun, I believe that scaling larger applications is trickier than choosing a framework such as React. At the moment, React seems to have better established the core patterns needed for scaling web applications.</p><h3>Acknowledgements</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IxzHGLN9UQgzrbm39c5Z2w.jpeg" /></figure><p>I would like to thank everyone in MDA for working with me this year. In MDA I realized that my passion lies on frontend development and I would have never had the chance to improve be part of so large web applications if it wasn’t for MDA. I had the chance to work with some of the best software engineers in the industry, and I was lucky enough to be mentored by <a href="https://github.com/evandigby">Evan Digby</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fM4kyruq21roFeYAdqvkDg.jpeg" /><figcaption>Playing soccer with my great colleagues</figcaption></figure><blockquote>Thanks to the MDA family for working with me and making this a wonderful experience!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=226dc22a9027" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applied Design Patterns & Software Architecture]]></title>
            <link>https://mkotsollaris.medium.com/applied-design-patterns-software-architecture-42a8e6835cf0?source=rss-1c2607919fa5------2</link>
            <guid isPermaLink="false">https://medium.com/p/42a8e6835cf0</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Menelaos Kotsollaris]]></dc:creator>
            <pubDate>Sun, 10 Sep 2017 05:23:44 GMT</pubDate>
            <atom:updated>2017-09-10T05:30:54.283Z</atom:updated>
            <content:encoded><![CDATA[<h3>Foreword</h3><p>This article aims to help developers answer 2 questions: how and why would someone implement the design patterns. The main reference will be the <a href="https://en.wikipedia.org/wiki/Design_Patterns"><strong>legendary Gang of Four (GOF) book</strong></a>. The project showcased in this article is “Lexi”, an open-source application for Android devices (<a href="https://play.google.com/store/apps/details?id=com.mkotsollaris.lexi">Google Play</a>; <a href="https://github.com/mkotsollaris/Lexi/tree/master/java/com/example/mkotsollaris/lexi">Github</a>; <a href="https://www.youtube.com/watch?v=fplVgI2RVQg">Youtube</a>).</p><p>Let’s start!</p><h3>Introduction</h3><p>What is a design pattern?</p><p>Design pattern is a description of standard/best practice solution for common/recurring Object Oriented Design problems. <strong>The</strong> <strong>design patterns are not invented</strong>. They are summaries of common solutions by experienced programmers using their best practices over time.</p><p>The design pattern are split into 3 categories:</p><ul><li><strong>Creational Patterns</strong>: They abstract the instantiation process.</li><li><strong>Structural Patterns</strong>: Concerned with how classes are related to each other (objects relationships).</li><li><strong>Behavioural patterns</strong>: Concerned with algorithms and the assignment of responsibilities between objects.</li></ul><p>In this article, 18 out of the 24 design patterns mentioned in the GOF are described and showcased.</p><h3><strong>1. Model-View-Controller (MVC) with the Observer pattern</strong></h3><p>This pattern is widely adopted by the most used frameworks (e.g., Java Spring, Ruby on Rails etc.). The core idea of MVC is to logically divide the main components of the program into three parts: Dataset (Model), UI (View) and Application logic (Controller). By following the MVC pattern the code becomes more readable and reusable. The main part of MVC is the Observer pattern, which is an interface with 1 method:</p><pre>interface Observer<br>{<br>    void update();<br>}</pre><p>Then, we can trigger update simultaneously for all of the MVC components. For more specifications on how to implement MVC, <a href="https://www.techyourchance.com/mvp-mvc-android-1/">read more here</a>.</p><h3><strong>2. Singleton</strong></h3><p>This pattern allows an object to be instantiated only 1 time at the runtime of the program. This is rather useful useful when an object is expected to be shared across different classes. Another benefit would be the initialization cost (speed or memory) of the object. An implementation of the Singleton would be the following:</p><pre>public class CustomCharacterFlyweightFactory<br>{<br>    //the instance which holds the flyweight<br>    private static CustomCharacterFlyweightFactory <em>instance</em>;<br><br>    public static CustomCharacterFlyweightFactory getInstance()<br>    {<br>        if(<em>instance </em>== null) <em>instance </em>= new CustomCharacterFlyweightFactory();<br>        return <em>instance</em>;<br>    }<br><br>    private CustomCharacterFlyweightFactory()<br>    {<br>        for(int i = 0; i &lt; characters.length; i++)<br>        {<br>            customCharacterPool[i] = new CustomCharacter(characters[i]);<br>        }<br>    }<br>}</pre><p>Simply making the constructor private and defining a private static object of the same class would be the tasks for someone to follow in order to implement the Singleton pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9jTYqxzF7bpslDHPYL6BVQ.png" /><figcaption>FileUtilities, CustomCharacterFlyweightFactory and EditTextStatus follow the singleton pattern</figcaption></figure><h3>3. Builder</h3><p>Instead of initializing the object at once, we can create an object part-by-part. That’s what the builder pattern states. There are many ways of implementing this pattern. In this example, I am following Bloch’s implementation of the Builder pattern (<a href="https://books.google.ca/books/about/Effective_Java.html?id=Ft8t0S4VjmwC">Bloch, 2008; Effective Java</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*y6le4bVWuG8TDVF5Sp0t4Q.png" /></figure><pre>class CompositeBuilder<br>{<br>    //stores the composites (RowComposites and CustomCharacters)<br>    private Stack&lt;RowComposite&gt; compositeRowStack = new Stack&lt;&gt;();<br><br>    CompositeBuilder()<br>    {<br>        compositeRowStack = new Stack&lt;&gt;();<br>    }<br><br>    <em>/**<br>     * Adds the new character to the RowComposite. If the RowComposite does not exist, then it&#39;s<br>     * created. In case of the same charPosition, the value replaces the old one.<br>     *<br>     * </em><strong><em>@param </em></strong><em>customCharacter the CustomCharacter<br>     * </em><strong><em>@param </em></strong><em>fontFace        the FontFace<br>     * </em><strong><em>@param </em></strong><em>fontSize        the FontSize<br>     * </em><strong><em>@param </em></strong><em>rowNumber       the row number<br>     * </em><strong><em>@param </em></strong><em>charPosition    the position where the character will be inserted<br>     */<br>    </em>void buildCharacter(CustomCharacter customCharacter,<br>            FontFace fontFace,<br>            FontSize fontSize,<br>            int rowNumber,<br>            int charPosition)<br>    {<br>        if(compositeRowStack.size() == 0)<br>        {<br>            buildRowComposite(0);<br>        }<br>        if(customCharacter.getChar() == &#39;\n&#39;)<br>        {<br>            buildRowComposite(rowNumber);<br>        }<br>        else<br>        {<br>            compositeRowStack.get(rowNumber)<br>                    .addChild(customCharacter, fontFace, fontSize, charPosition);<br>            setFonts(rowNumber, fontFace, fontSize, charPosition);<br>        }<br>    }<br><br>    <em>/**<br>     * Sets new fonts to the CustomCharacter.<br>     *<br>     * </em><strong><em>@param </em></strong><em>rowNumber    the row number<br>     * </em><strong><em>@param </em></strong><em>fontFace     the FontFace<br>     * </em><strong><em>@param </em></strong><em>fontSize     the FontSize<br>     * </em><strong><em>@param </em></strong><em>charPosition the position where the character will be inserted<br>     */<br>    </em>void setFonts(int rowNumber, FontFace fontFace, FontSize fontSize, int charPosition)<br>    {<br>        RowComposite rowComposite = compositeRowStack.get(rowNumber);<br>        rowComposite<br>                .setFontFace(fontFace.getFontFaceType(), fontSize.getFontSizeType(), charPosition);<br>    }<br><br>    <em>/**<br>     * Creates a new row and adds it last in the stack.<br>     */<br>    </em>void buildRowComposite(int rowNumber)<br>    {<br>        RowComposite rowComposite = new RowComposite(rowNumber);<br>        compositeRowStack.push(rowComposite);<br>    }<br>}</pre><h3>4. Abstract Factory</h3><p>Have class hierarchies to instantiate the <strong>logical hierarchies</strong>. Abstract factory uses the factory-classes to instantiate objects, without the clients having to modify code. In the following example, the FontFaceFactory and FontSizeFactory classes extend from the FontAbstractFactory class which implements the Abstract Factory pattern:</p><pre>public abstract class FontAbstractFactory<br>{<br>    abstract FontFace createFontFace();<br>    abstract FontSize createFontSize();<br>}</pre><pre>public class FontFaceFactory extends FontAbstractFactory<br>{<br>    @Override FontFace createFontFace()<br>    {<br>        return new FontFace(FontFace.FontFaceType.<em>SERIF</em>);<br>    }<br><br>    @Override FontSize createFontSize()<br>    {<br>        return null;<br>    }<br>}<br>public class FontSizeFactory extends FontAbstractFactory<br>{<br>    @Override FontFace createFontFace()<br>    {<br>        return null;<br>    }<br><br>    @Override FontSize createFontSize()<br>    {<br>        return new FontSize(FontSize.FontSizeType.<em>NORMAL</em>);<br>    }<br>}</pre><h3>5. Factory Method</h3><p>The factory pattern is a creational pattern. It can be implemented by having abstract methods within the class that are meant to create objects. This is an object-based pattern whereas, the abstract factory, was a class-based pattern since it required new classes to be defined. The Component class contains the createComponentObject method which implements the Factory method pattern.</p><pre>abstract class Component implements VisitorAccepter<br>{<br>    abstract Component createComponentObject();<br><br>    public void addChild(Component rowComponent)<br>    {<br>    }<br><br>    public void removeChild(int index)<br>    {<br>    }<br><br>    public Component getChild(int index)<br>    {<br>        return null;<br>    }<br><br>    public int childrenNumber()<br>    {<br>        return 0;<br>    }<br>}</pre><h3>6. Prototype</h3><p>This pattern is a creational pattern and it allows shallow or deep copy of an object. The implementation of this pattern is very straightforward and it can be achieved by either overriding object’s clone method or by creating a new function (e.g., cloneMe).</p><pre>import java.util.ArrayList;<br><br><em>/**<br> * Represents a Row. Saves the extrinsic state of the CustomCharacter (FontFace and FontSize).<br> */<br></em>class RowComposite extends Composite<br>{<br>    <em>/**<br>     * Implements the Prototype Pattern; uses Deep cloning.<br>     */<br>    </em>RowComposite cloneMe()<br>    {<br><br>        ArrayList&lt;FontFace.FontFaceType&gt; fontFaceListCopy = new ArrayList&lt;&gt;();<br>        ArrayList&lt;FontSize.FontSizeType&gt; fontSizeListCopy = new ArrayList&lt;&gt;();<br>        for(int i = 0; i &lt; fontFaceList.size(); i++)<br>        {<br>            fontFaceListCopy.add(fontFaceList.get(i));<br>            fontSizeListCopy.add(fontSizeList.get(i));<br>        }<br>        ArrayList&lt;Component&gt; childrenArrayListCopied = new ArrayList&lt;&gt;();<br>        for(int i = 0; i &lt; childrenArrayList.size(); i++)<br>        {<br>            childrenArrayListCopied.add(i, childrenArrayList.get(i));<br>        }<br>        return new RowComposite(rowNumber, childrenArrayListCopied, fontFaceListCopy,<br>                                fontSizeListCopy);<br>    }<br>}</pre><h3>7. Composite</h3><p>The composite pattern allows the implementation of logical-tree hierarchies. In this case, each row has a set of CustomCharacters, as it can be seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdkP6u5NmxLPvN6rk15Umg.png" /></figure><h3>8. Decorator</h3><p>This pattern allows decoration of the objects’ properties. For instance, creating an activity with and without a border.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNP52BcQDkGCzwZiWEVBqg.png" /></figure><h3>9. Flyweight</h3><p>As I mention in <a href="https://softwareengineering.stackexchange.com/questions/108630/does-anyone-have-a-specific-example-of-using-the-flyweight-pattern/347054#347054">this answer in Software Engineering</a>, The purpose on using the flyweight pattern is to avoid unnecessary object initialization and thus save space. As defined by GOF, an object can have two states, the intrinsic and the extrinsic state:</p><ul><li><strong>Intrinsic state:</strong> Is stored in the flyweight; it consists of information that&#39;s independent on the flyweights context, thereby making it shareable.</li><li><strong>Extrinsic state:</strong> depends on and varies with the flyweight&#39;s context and therefore cant be share. Client objects are responsible for passing extrinsic state to the flyweight when it needs it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e5huQjQ7Qclq00tM_npzUQ.png" /></figure><p>The CustomCharacter object gets instantiated using the Flyweight pattern. The CustomCharacter intrinsic state (char) is stored in the CustomCharacter and the existrinstic state (FontFace and Fontsize) is stored on the RowComposite. The FlyweightFactory contains the pool of the available characters that the user can insert.</p><h3>10. Adapter</h3><p>The CommandAdapter class implements the GOFList interface and it composes the Java ArrayList class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*ESIMvrb1UyrjykzVR5Z_-A.png" /></figure><h3>11. Facade</h3><p>Very straightforward and useful pattern. Simply encapsulate the behavior and have a service work as a gateway between the client and the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*bab7C5YlVhH0im9TY_C0Vw.png" /></figure><h3>12. Proxy</h3><p>The ColumnCOWProxy implements the Copy-on-write proxy for the Column class. Whenever a client changes the number of column, then a new Column object is created and returned, while the original object remains the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/184/1*sM_YWLAsf-jCQD0cLroUsQ.png" /></figure><h3>13. Iterator</h3><p>Super useful pattern, as it is implemented in all the common data structures used (e.g., java.util.List); the iterators allows traversing a logical hierarchy of a class. The CharacterIterator implements the Iterator pattern and iterates through the leafs (CustomCharacters) of the composite pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*TBRt-0xwKGqPI_p4ffkrOQ.png" /></figure><h3>14. Visitor</h3><p>The visitor’s purpose is to implement a specific functionality (e.g., compute the total sum of a tree). The Component impements the VisitorAccepter interface and the whenever a CustomCharacter is visited, then a counter is increases in the CharacterVisitor object which implements the Visitor pattern. This allows the count of the characters within the view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_YDemNT90Uw-2q5rQ-Yxw.png" /></figure><h3>15 &amp; 16. Command &amp; Memento</h3><p>The command pattern translates the user’s actions into programmable actions. The InsertCharacterCommand, DeleteCharacterCommand and UpdateCharacterCommand implement the Command interface. undo/redo is supported through these commands by storing increasing/decreasing the pointer in the command stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*Z90hBeqGpZyWgonrfACy5g.png" /></figure><p>The Memento pattern simply stores the state of the object in order to allow undo/redo operations. The Memento class gets and sets the state of the Composite and thus implements the Memento pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*Tv5L0S_TtAJoIEl_18A8DQ.png" /></figure><h3>17. Observer</h3><p>The Observer is used as an event scheduler that gets triggered whenever an event (e.g., click) occurs. The EditorObserver in collaboration with EditorSubject and EditorLogic implement the Observer pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*D1aZOzQNoHV0nwjw2091gQ.png" /></figure><h3>18. State</h3><p>This pattern helps The FontSize and FontFace classes and the FontListener interface implement the State pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*SiFhJK0wgO1BjzNJ70XUdA.png" /></figure><h3><strong>Final Thoughts</strong></h3><p>Design patterns are used in almost any major scalable framework. Without concise and reusable structure, projects cannot be scaled. Design patterns cannot be invented and <a href="https://softwareengineering.stackexchange.com/questions/49379/when-should-i-use-and-not-use-design-patterns">forced</a>. We, the developers, have to learn them and apply them, when suitable. Lexi offers a robust example of how the design patterns can be used to build a modern application.</p><p>It is my hope that I explained the complex concepts of the design patterns in a clear way.</p><h3>The complete UML Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlYon0ujcF0gCXdzzjimSw.png" /></figure><p>Lexi can be found at <a href="https://github.com/mkotsollaris/Lexi">Github</a>, <a href="https://play.google.com/store/apps/details?id=com.mkotsollaris.lexi">Google Play</a> and youtube (<a href="https://www.youtube.com/watch?v=FC_HQ-qM-mo">full</a> &amp; <a href="https://www.youtube.com/watch?v=fplVgI2RVQg&amp;t=1s">short</a> version).</p><p>Thanks for reading — Feedback and comments are always welcomed!</p><h3>Acknowledgements</h3><p>I would like to thank <a href="https://www.cs.unb.ca/~wdu/">Dr. Weichang Du</a> for helping me learn the design patterns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42a8e6835cf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>