<?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 Ilyas Karimov on Medium]]></title>
        <description><![CDATA[Stories by Ilyas Karimov on Medium]]></description>
        <link>https://medium.com/@mrilyaskarimov?source=rss-245e1b68b62b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Bzy6NN1WoV58ayyn.</url>
            <title>Stories by Ilyas Karimov on Medium</title>
            <link>https://medium.com/@mrilyaskarimov?source=rss-245e1b68b62b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:17:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mrilyaskarimov/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[Design Trade-offs]]></title>
            <link>https://mrilyaskarimov.medium.com/design-trade-offs-abe6806d3585?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/abe6806d3585</guid>
            <category><![CDATA[market]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[trade-off]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Mon, 28 Dec 2020 08:54:50 GMT</pubDate>
            <atom:updated>2020-12-28T14:39:10.240Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, Folks! Today’s article is about hardware/software trade-offs. Make sure to check other articles of mine for other topics.</p><p>Speaking of design trade-offs today, I can say that it is impossible not to mention hardware when talking about software trade-offs, or vice versa. It is almost impossible not to think of the two of them together. There are territories of the compromise which are the sole preserve of the manufacturer and his hardware/software group. Various regions of the compromise are the duty of the client or autonomous hardware producers. Trade-offs can be found in almost any area of computer design and application. Some computers are micro-programmed and those microprograms are referred to as firmware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*RugkSNZ-6Ixib-SCUUk3Ew.png" /></figure><blockquote><strong>Microprogramming</strong>, Process of writing microcode for a <a href="https://www.britannica.com/technology/microprocessor">microprocessor</a>. Microcode is low-level <a href="https://www.britannica.com/technology/machine-language">code</a> that defines how a microprocessor should function when it executes <a href="https://www.britannica.com/technology/machine-language">machine-language</a> instructions. Typically, one machine-language instruction translates into several microcode instructions. On some computers, the microcode is stored in ROM and cannot be modified; on some larger computers, it is stored in <a href="https://www.britannica.com/technology/EPROM">EPROM</a> and therefore can be replaced with newer versions.</blockquote><p>There are several trade-offs.</p><p>The trade from <em>hardware to software</em>: Such a trade-off may involve transferring whole functions, such as memory protection from one system to the other.</p><p>The trade from <em>software to firmware</em>: As I said earlier, some computers are micro-programmed. Sometimes, instead of offering users new hardware, trade is created between software and firmware to increase system speed. This can be done by avoiding fetch cycles in the main memory.</p><p>The trade from <em>firmware to hardware</em>: In the case of micro-programmed devices, the designer decides which functions are under the control of the hardware, or which functions will be broken down into smaller micro-instructions. The designer must also decide what fundamental data paths and functional units will exist within the machine.</p><p>There are several reasons for performing hardware/software trade-offs:</p><ul><li><strong>Achieve the unachieveable performance goal </strong>— This cycle goes from the consideration of inward highlights, for example, gliding point number-crunching and list registers through the expansion of specific processors, for example, sorters and quicker Fourier change processors. These processors might be added to either to the input/output system, the memory interface, or the CPU. Nowadays, these advanced features and trades are decided by the designer or manufacturer.</li><li><strong>Minimize overal system cost </strong>— In today’s system, cost is actually very important. Let’s not forget that in addition to hardware costs, there are also software costs. Many systems offer optional features such as floating point arithmetic which may be performed either by hardware or by software. Two patterns are obvious in the commercial center today. One pattern is to give frameworks in which a lot of capacity is being allotted to the firmware in inclination to software and the other pattern is to grow little quick PCs with negligible instruction sets.</li><li><strong>Reduce software complexity</strong> — This goal and feature is accomplished by adding more hardware components and features which reduce the overall code, provide enhanced run-time support, and save the programmers from concerns about limitations of memory space.</li><li><strong>Increase overall system reliability</strong> — As for software, it suffers from over-writing problems or quick changes. Therefore moving critical functions to more secure locations. The most secure location is in the firmware or hardware. Another trend relevant to reliability is moving I/O recovery functions from the software to peripheral controllers or channels.</li><li><strong>Extend system life </strong>— As for the computing field, this criterion is measured by adaptability. This is achieved by assigning hardware functions to software and firmware.</li><li><strong>Enhance debugging assistance</strong> — Software errors are costly to handle only with software, however, debugging can help if this monitoring feature is built into the software. Other hardüare aids include firmware monitors, which perform flow tracing and intterupt schemes, which monitor violations of system conventions.</li><li><strong>Accomplish compatibility</strong> — An emulator consolidates hardware, software, and firmware to execute guidelines for a machine other than the machine on which the emulator is run. The choice of the limit between the three parts can altogether influence the presentation of the emulator. The similarity might be accomplished by methods for up-product exchanges the lower execution end of a computer family.</li><li><strong>Accomplish market position</strong> — One is directed to estimate that inspiration for performing equipment/programming compromises is to accomplish item separation and make hostage clients who rely upon the presence of an extraordinary component. These clients can only with significant effort move to an alternate PC. Advertising contemplations have driven a large number of the minicomputer makers to give system software that was not needed when the principal minicomputers were presented. It is sensible to estimate that this necessity will animate new and imaginative equipment/programming compromises for these little machines.</li></ul><p>Thank you very much for your time and patience. I hope, you gained new knowledge. Peace ✌🏼</p><ul><li><a href="https://dl.acm.org/doi/10.1145/1479992.1480056">Hardware/software trade-offs | Proceedings of the December 5-7, 1972, fall joint computer conference, part I</a></li><li><a href="https://www.britannica.com/technology/microprogramming">Microprogramming | computer science</a></li><li><a href="https://www.sciencedirect.com/science/article/abs/pii/0026271483913768">On hardware/software trade-offs in computer system design</a></li><li><a href="https://link.springer.com/chapter/10.1007/978-1-4757-2629-9_1">A Model for Exploring Hardware/Software Trade-offs and Evaluating Design Alternatives</a></li><li><a href="https://lucaongaro.eu/blog/2017/11/13/on-software-engineering-and-trade-offs.html">Luca Ongaro</a></li><li><a href="https://www.nemil.com/on-software-engineering/think-in-tradeoffs.html">Think in Tradeoffs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abe6806d3585" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Architecture]]></title>
            <link>https://mrilyaskarimov.medium.com/software-architecture-a26f032ffa57?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a26f032ffa57</guid>
            <category><![CDATA[views]]></category>
            <category><![CDATA[viewpoints]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Fri, 25 Dec 2020 01:50:34 GMT</pubDate>
            <atom:updated>2020-12-25T01:50:34.384Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello, Folks. In this article, we’ll be talking about architecture and some specific terms, stakeholders, views, and viewpoints. This topic might be new to most of us, enjoy!</strong></p><p>I think to understand what a software architect does, we must first understand what an architect does. An architect is a person who plans, designs, oversees the construction of buildings, and makes the image in their head the reality. <strong>Architects</strong> create the overall look of buildings and other structures, but the design of a building involves far more than its appearance. This work has special responsibilities, communicating with clients and business owners to understand the requirements, designing, engineering, and supervising.</p><blockquote>The software architecture of a system is the set of structures needed to reason about the system, which comprises software elements, relations among them, and properties of both.</blockquote><blockquote>A software architect is a software development expert who makes high-level design choices and tries to enforce technical standards, including software coding standards, tools, and platforms.</blockquote><p>I would say a software architect is a person who endeavors to solve a business or technical problem with the means of technology. Many people perform architectural activities, such as engineers when they are trying to come up with a solution for a specific issue. It maybe low-level architecture, but it’s still architecture. Engineers just mostly focus on how to implement the solution, yet architects focus on how to solve the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*5viU_Y1U0BRb2jmav7qffQ.png" /></figure><p>Who are the stakeholders? A stakeholder is either an individual, group, or organization who is affected by the project. They can be within the team or outside the project i.e customers, clients, and users, or sponsoring the project.</p><blockquote>Stakeholders are the people for whom we build the systems.</blockquote><p>A key part of your role as an architect is knowing how to work with stakeholders in order to meet their requirements. I would say that this is a time-consuming process. There is often a misunderstanding of requirements, so architects meet with stakeholders not just once, but several times during requirement gathering and understand their wishes.</p><p>There are views and viewpoints, which are defined in slightly different ways in different places:</p><p>An architectural view — the representation of the architecture how he approaches the concerns held by stakeholder(s) from one or more appearances</p><p>A viewpoint — the collection of patterns and templates for building a view. Viewpoints consist of the proven architectural knowledge to guide the creation of architecture, described in a particular set of views (each view being the result of applying the guidance in a particular viewpoint).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*5I9Ucolhqk6gMz3Ei7wUiw.png" /></figure><p>Thank you very much for your time. Make sure you’re reading my other articles too. Peace</p><ul><li><a href="https://www.globallogic.com/insights/blogs/what-makes-a-software-architect/">What Does a Software Development Architect Do - Roles and Responsibilities | GlobalLogic</a></li><li><a href="https://medium.com/@nvashanin/the-path-to-becoming-a-software-architect-de53f1cb310a">The Path to Becoming a Software Architect</a></li><li><a href="https://www.indeed.com/career-advice/careers/what-does-a-software-architect-do">Learn About Being a Software Architect</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a26f032ffa57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Patterns]]></title>
            <link>https://mrilyaskarimov.medium.com/design-patterns-f6ee70d13296?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6ee70d13296</guid>
            <category><![CDATA[creational]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[behavioral]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[structural]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Fri, 18 Dec 2020 17:24:59 GMT</pubDate>
            <atom:updated>2021-03-15T01:56:55.842Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hey, Folks! This article might be useful for future software engineers. We will talk about patterns and explain why they are used. If you don’t know about patterns, don’t worry. Without further ado…</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*A2AcvKc2koOevA59nDbZfw.jpeg" /></figure><p>In software engineering, a design pattern is a repeatable solution to the frequently happening issues in software design. A design pattern is not a complete pattern; it cannot be transformed into code directly. A pattern is a template that can be used to solve a problem in different situations. We have different patterns for implementing the <em>undo </em>feature, and one of them is the <strong>Memento</strong> pattern. Therefore, a design pattern shows you how a user should structure the classes and how the class should communicate with each other. Historically speaking, software engineers ignored to used existing patterns, but rather design their own solutions to problems. One of the reasons for this state of affairs used to be the lack of easily accessible, standard solutions for common software architecture and design problems. There are many different types of patterns available today.</p><p>There exist 23 design patterns that were originally documented in the 90s in the book called <em>Design Patterns, Elements of Reusable Object-Oriented Software</em>. The book was written by four authors, often referred to as Gang of Four. Therefore, those 23 design patterns are often referred to as the Gang of Four patterns. I personally recommend you to read the book.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*neJUTHxqhEYSBS4V7U8VnQ.jpeg" /></figure><p>There are 3 design pattern types, creational, structural, and behavioral. Creational patterns are all about different ways to create objects. Structural patterns are about the relationships between these objects. Behavioral patterns about negotiation and communication between these objects. Don’t forget that these design patterns do not represent all patterns and their work, there are unofficial and undocumented ones, but these are classic ones that every software engineer must understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*ux9RbCzxelawCjKdMwQVug.png" /></figure><p>Before introducing some of the patterns, let’s see why software engineers should study this topic. First, it helps to communicate with other developers at an abstract level, for example, telling your colleague that we need the <em>command </em>pattern to improve this code simply by mentioning its name. Second, it makes you a better designer, you learn how to build reusable extensible, and maintainable software. Last but not least, they help you learn and use new frameworks faster.</p><p>Before starting to learn the patterns, I kindly ask you to learn and revise your knowledge about OOP; classes, interfaces, encapsulation, abstraction, inheritance, polymorphism, UML.</p><p><strong>Creational</strong> Design Patterns are all about class instantiations.</p><ul><li><a href="https://sourcemaking.com/design_patterns/abstract_factory"><strong>Abstract Factory</strong></a><br>Creates an instance of several families of classes</li><li><a href="https://sourcemaking.com/design_patterns/builder"><strong>Builder</strong></a><br>Separates object construction from its representation</li><li><a href="https://sourcemaking.com/design_patterns/factory_method"><strong>Factory Method</strong></a><br>Creates an instance of several derived classes</li><li><a href="https://sourcemaking.com/design_patterns/object_pool"><strong>Object Pool</strong></a><br>Avoid expensive acquisition and release of resources by recycling objects that are no longer in use</li><li><a href="https://sourcemaking.com/design_patterns/prototype"><strong>Prototype</strong></a><br>A fully initialized instance to be copied or cloned</li><li><a href="https://sourcemaking.com/design_patterns/singleton"><strong>Singleton</strong></a><br>A class of which only a single instance can exist</li></ul><p><strong>Structural</strong> Design Patterns about how classes and objects can be composed, to form larger <strong>structures</strong>. The <strong>structural</strong> design <strong>patterns</strong> simplify the <strong>structure</strong> by identifying relationships.</p><ul><li><a href="https://sourcemaking.com/design_patterns/adapter"><strong>Adapter</strong></a><br>Match interfaces of different classes</li><li><a href="https://sourcemaking.com/design_patterns/bridge"><strong>Bridge</strong></a><br>Separates an object’s interface from its implementation</li><li><a href="https://sourcemaking.com/design_patterns/composite"><strong>Composite</strong></a><br>A tree structure of simple and composite objects</li><li><a href="https://sourcemaking.com/design_patterns/decorator"><strong>Decorator</strong></a><br>Add responsibilities to objects dynamically</li><li><a href="https://sourcemaking.com/design_patterns/facade"><strong>Facade</strong></a><br>A single class that represents an entire subsystem</li><li><a href="https://sourcemaking.com/design_patterns/flyweight"><strong>Flyweight</strong></a><br>A fine-grained instance used for efficient sharing</li><li><a href="https://sourcemaking.com/design_patterns/private_class_data"><strong>Private Class Data</strong></a><br>Restricts accessor/mutator access</li><li><a href="https://sourcemaking.com/design_patterns/proxy"><strong>Proxy</strong></a><br>An object representing another object</li></ul><p><strong>Behavioral</strong> Design Patterns are concerned with algorithms and the assignment of responsibilities between objects.</p><ul><li><a href="https://sourcemaking.com/design_patterns/chain_of_responsibility"><strong>Chain of responsibility</strong></a><br>A way of passing a request between a chain of objects</li><li><a href="https://sourcemaking.com/design_patterns/command"><strong>Command</strong></a><br>Encapsulate a command request as an object</li><li><a href="https://sourcemaking.com/design_patterns/interpreter"><strong>Interpreter</strong></a><br>A way to include language elements in a program</li><li><a href="https://sourcemaking.com/design_patterns/iterator"><strong>Iterator</strong></a><br>Sequentially access the elements of a collection</li><li><a href="https://sourcemaking.com/design_patterns/mediator"><strong>Mediator</strong></a><br>Defines simplified communication between classes</li><li><a href="https://sourcemaking.com/design_patterns/memento"><strong>Memento</strong></a><br>Capture and restore an object’s internal state</li><li><a href="https://sourcemaking.com/design_patterns/null_object"><strong>Null Object</strong></a><br>Designed to act as a default value of an object</li><li><a href="https://sourcemaking.com/design_patterns/observer"><strong>Observer</strong></a><br>A way of notifying change to a number of classes</li><li><a href="https://sourcemaking.com/design_patterns/state"><strong>State</strong></a><br>Alter an object’s behavior when its state changes</li><li><a href="https://sourcemaking.com/design_patterns/strategy"><strong>Strategy</strong></a><br>Encapsulates an algorithm inside a class</li><li><a href="https://sourcemaking.com/design_patterns/template_method"><strong>Template method</strong></a><br>Defer the exact steps of an algorithm to a subclass</li><li><a href="https://sourcemaking.com/design_patterns/visitor"><strong>Visitor</strong></a><br>Defines a new operation to a class without change</li></ul><p>Thank you very much, stay tuned for new articles. Peace✌🏼</p><ul><li><a href="https://sourcemaking.com/design_patterns">Design Patterns and Refactoring</a></li><li><a href="https://refactoring.guru/design-patterns">Design Patterns</a></li><li><a href="https://www.tutorialspoint.com/design_pattern/design_pattern_overview.htm">Design Pattern - Overview</a></li><li><a href="https://www.freecodecamp.org/news/the-basic-design-patterns-all-developers-need-to-know/">The 3 Types of Design Patterns All Developers Should Know (with code examples of each)</a></li></ul><p>Rozanski, N. (2014). <em>Software systems architecture: Working with stakeholders using viewpoints and perspectives</em>. Place of publication not identified: Addison-Wesley.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6ee70d13296" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concurrency]]></title>
            <link>https://mrilyaskarimov.medium.com/concurrency-b8e5515f7e98?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8e5515f7e98</guid>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[deadlock]]></category>
            <category><![CDATA[parallelism]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Sun, 13 Dec 2020 23:01:16 GMT</pubDate>
            <atom:updated>2020-12-13T23:01:16.992Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello, Folks. I hope the articles increase your interest in programming. First of all, let’s talk about the concept of concurrency. We will also talk about deadlock and race condition.</strong></p><p>Concurrency control mechanisms help to increase program flexibility. It’s used when more than one task is done concurrently. For example, web browsers. They send and receive data to web servers at the same time. It’s usually confused with parallelism. The difference between concurrency and parallelism is that concurrency occurs in interfering periods of time. Parallelism is when tasks completely run at the same time, e.g., on a multicore processor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*k1_Jo-mY3lEqDQ9usP3omg.jpeg" /></figure><p>Concurrency occurs at four levels:</p><ol><li>Instruction level — executing two or more machine instructions simultaneously</li><li>Statement level — executing two or more high-level language statements simultaneously</li><li>Unit level — executing two or more subprogram units simultaneously</li><li>Program level — executing two or more programs simultaneously</li></ol><p>Concurrency is called <strong>scalable </strong>if the speed of execution increases when more processors are available.</p><p>There are two categories that used multiple data streams: Single Instruction, Multiple Data (SIMD), and Multiple Instruction, Multiple Data (MIMD) architecture computers. In an SIMD computer, each process has its own local memory (a single decoder) and in MIMD, computer architecture consists of multiple decoders. SIMD required less memory and is synchronous programming. MIMD can appear in two configurations: distributed and shared memory systems.</p><p>There are 2 categories of concurrent unit control:</p><p>Physical concurrency — Multiple program units from the same program that literally execute simultaneously.</p><p>Logical concurrency — Multiple processors providing actual concurrency, when in fact the actual execution of programs is taking place in an interleaved fashion on a single processor</p><p>Concurrency is used to <em>deadlock</em> and <em>race conditions</em>. Deadlock happens when the processes cannot access the resource because it’s locked. Suppose Process 1 requests resource B from Process 2 and Process 2 required resource A from process 1 but resource A and B are locked during processes 1 and 2 are running. The point is that no process can continue until the other is over, and they are constantly waiting for each other. This process is called deadlock.</p><p><em>Race condition </em>or <em>race hazard</em> is the unexpected or undesirable situation that happens when the system tries to perform operations at the same time. Suppose the variable TOTAL has the value of 3 before modifications. If A puts its value back before B fetches it, TOTAL will be 6. If B puts its value back before A fetches its value, TOTAL will be 4. If B completes its operation before task A beings, TOTAL will be 7. This is called race condition because two or more tasks are racing to use the shared resource and the behavior of the task is dependent on which task arrives first or wins the race.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXB51A1hR7PxhKDQ5k9kWA.png" /></figure><p>Processes, also known as tasks fall into two categories:</p><p>Heavyweight task — It executes in its own address space</p><p>The lightweight task, also known as threads — All processes run in the same address space. This task runs under the address space of a normal (heavy-weight) process, and the lightweight tasks under the same process may share variables</p><p>Thank you very much for your time. Don’t forget to read more articles. Take care. Peace ✌🏼</p><ul><li><a href="https://www.computerhope.com/jargon/t/thread.htm">What is a Thread?</a></li><li><a href="https://www.toptal.com/software/introduction-to-concurrent-programming">Introduction to Concurrent Programming: A Beginner&#39;s Guide</a></li><li><a href="https://techterms.com/definition/deadlock">Deadlock</a></li><li><a href="https://searchstorage.techtarget.com/definition/race-condition">What is a Race Condition?</a></li></ul><p>Sebesta, R. W. (2019). Examples of Multiple Selectors. In <em>Concepts of programming languages</em>. NY, NY: Pearson.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8e5515f7e98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Programming and Dynamic Binding in OOP.]]></title>
            <link>https://mrilyaskarimov.medium.com/object-oriented-programming-and-dynamic-binding-in-oop-7b56401dd500?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b56401dd500</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[programming-paradigms]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Fri, 11 Dec 2020 12:15:57 GMT</pubDate>
            <atom:updated>2020-12-11T12:15:57.583Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello, Folks. In this article, I wanted to dig deeper into concepts of Object-oriented Programming (OOP) and dynamic binding for the purpose of in-depth study and teaching. I hope that you will learn new things or refresh your knowledge through my articles. Meanwhile, this article will talk about dynamic binding too. If you have no information about binding, I would recommend reading my article called </strong><a href="https://mrilyaskarimov.medium.com/variables-96d863c8f35b"><strong>variables</strong></a><strong>.</strong></p><blockquote><strong>Object-oriented programming</strong> (<strong>OOP</strong>) is a <a href="https://en.wikipedia.org/wiki/Programming_paradigm">programming paradigm</a> based on the concept of “<a href="https://en.wikipedia.org/wiki/Object_(computer_science)">objects</a>”, which can contain <a href="https://en.wikipedia.org/wiki/Data">data</a> and code: data in the form of <a href="https://en.wikipedia.org/wiki/Field_(computer_science)">fields</a> (often known as <em>attributes</em> or <em>properties</em>), and code, in the form of procedures (often known as <a href="https://en.wikipedia.org/wiki/Method_(computer_science)"><em>methods</em></a>).</blockquote><p>Many of the languages that support OOP are high-level languages with a multi-paradigm concept. Examples of these languages are Java, Python, and C++. With the advent of OOP, programming has become easier, faster, more secure, and dynamic. This explains why the languages I have listed are on the list of most used languages today. OOP has four major building blocks, which are Abstraction, Encapsulation, Inheritance, and Polymorphism.</p><p><strong>Abstraction</strong> — Objects reveal mechanisms that are relevant for the use of other objects, hiding unnecessary implementation code. This concept is thought of as an extension of encapsulation and helps developers more easily make changes and additions over time. We can guess what it does when you press any specific button on the phone, but its implementation is hidden from us. For example, when you press the home button on the iPhone, it can give different results in different places, when it is in the program, it returns to home, but we can not see how it is implemented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*7FZickK7a5gVQuPqsbkkng.png" /></figure><p><strong>Encapsulation</strong> — Having logically-different objects within the class, which can neither be accessed nor modified by other classes. The implementation and state of each object are <em>private</em>, as they are defined within the class. The object can manage its state through methods. With this data hiding feature, encapsulation provides high security and avoids unintended data corruption. Three main data modifiers are used during encapsulation. Java supports four modifiers for the visibility of classes, methods, and attributes.</p><p><em>Public — </em>Classes, methods, and variables can be accessed by all the classes.</p><p><em>Private</em> — Most restrictive modifier, which methods and variables can be accessed within the same class.</p><p><em>Protected</em> — Methods and variables can be accessed from the package by classes and subclasses.</p><p><em>No Modifier </em>— Or called package-private because when you don&#39;t use any modifiers, you can access it within classes from the package.</p><p><strong>Inheritance</strong> — When objects are similar or share some common logic, but not entirely the same, the inheritance comes to help. We create a child class, subclass, from the parent class, superclass. Through this way, we form a hierarchy. Let’s say we have the <em>person</em> superclass, and <em>teacher</em> and <em>student</em> inheriting from that superclass.</p><p><strong>Polymorphism</strong> — Polymorphism means existing in many forms. Let’s say we have a parent class and several child classes. We would like to use the method of the parent class with some modifications for each subclass and each subclass can keep its own version of these methods. We create three objects and treat them like the same type of object. After writing the appropriate methods for each, for example, If the object is <em>triangle</em>, the CalculateSurface() method for the triangle, and if it is <em>circle,</em> the method implemented for the surface will be called. This is called <strong>overriding, </strong>the ability to define a behavior that’s specific to the subclass type. So subclass can implement a parent class method based on its requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*El_iEhJEA-MdleFKlPbolA.png" /></figure><p>Dynamic binding (dynamic dispatch/run-time binding/late binding) — the process of linking procedure call to a specific sequence of code (method) at run-time. So all calls to overridden methods are resolved at run-time. Let’s say we have a superclass <em>Animal </em>that has a <em>move</em> method, and subclasses of <em>Cat</em> and <em>Fish </em>(with the implementation of move methods in each class).</p><pre>Animal myAnimal = new Fish(); <br>myAnimal.move();  /*calls the method of Fish, not animal. */</pre><p>Now let’s add <em>Pirana</em> that derives from Fish, which doesn’t override the <em>move</em> method, but has an extra method called <em>bite</em>.</p><pre>Animal myAnimal = new Pirana(); <br>myAnimal.move(); /*Pirana doesn&#39;t override move, look for one-level up. */<br></pre><p>Now let’s try this:</p><pre>Animal myAnimal = new Pirana(); <br>myAnimal.bite(); /* this won&#39;t compile, because myAnimal is a <br>variable of type Animal and Animal doesn&#39;t have the method of bite*/</pre><pre>((Pirana)myAnimal).bite(); /* We need to cast! or we can create an <br>object for pirana. */</pre><pre>Pirana p = (Pirana)myAnimal; <br>p.bite();  </pre><p>I hope this article has shed light on some dark parts of OOP in your brain. Stay tuned for new ones. Peace ✌🏼!</p><p>References</p><ol><li><a href="https://searchapparchitecture.techtarget.com/definition/object-oriented-programming-OOP">https://searchapparchitecture.techtarget.com/definition/object-oriented-programming-OOP</a></li><li><a href="https://www.freecodecamp.org/news/object-oriented-programming-concepts-21bb035f7260/">https://www.freecodecamp.org/news/object-oriented-programming-concepts-21bb035f7260/</a></li><li><a href="https://www.nerd.vision/post/polymorphism-encapsulation-data-abstraction-and-inheritance-in-object-oriented-programming">https://www.nerd.vision/post/polymorphism-encapsulation-data-abstraction-and-inheritance-in-object-oriented-programming</a></li><li><a href="https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html">https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html</a></li><li><a href="https://stackify.com/oop-concept-for-beginners-what-is-encapsulation/">https://stackify.com/oop-concept-for-beginners-what-is-encapsulation/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b56401dd500" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exception vs Event Handling]]></title>
            <link>https://mrilyaskarimov.medium.com/exception-vs-event-handling-84f29fc47304?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/84f29fc47304</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[exception-handling]]></category>
            <category><![CDATA[handling-events]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Mon, 07 Dec 2020 09:24:08 GMT</pubDate>
            <atom:updated>2020-12-10T08:58:08.483Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello, Folks! Today’s topic is exception and event handling. We will talk about keywords, mechanisms, and differences shortly.</strong></p><p>Exception handling is an unexpected problem that happens during the execution of a program. With the help of this mechanism, the control from one part of the program can be passed to another. The process eases determination of error handling and the mistake in the actual functionality of the program.</p><p>If there are exceptions in your program, you can handle that with some provision of code which will take care of that exception. There are three main keywords in C++ to handle the exceptions; <strong>try, catch &amp; throw. </strong>Some programming languages use raise instead of throw. C/C++ uses the word throw because, in the standard C library, there exists a function called <em>raise </em>unrelated to exception handling.</p><p><strong>try</strong> — The block of code that may cause an exception is usually placed in the <em>try</em> block. When the exception occurs, it’s raised in the <em>try</em> block. Try block is followed by many <em>catch</em> blocks. Do not forget that every <em>try</em> block should have at leaast a corresponding <em>catch</em> block. A <em>try </em>block might have multiple <em>catch</em> blocks too.</p><p><strong>catch — </strong>The <em>catch </em>block catches the block from the <em>try</em> block, and the code which handles the exception is written inside the current <em>catch</em> block.</p><p><strong>throw</strong> — A program throws an exception when a problem occurs. This is done using a throw keyword.</p><p>Some programming languages have predefined exceptions, which are raised by the system implicitly such as Java. Unlike Java, C/C++ does not have such exceptions, the exceptions are only user-defined. All Java exceptions are objects of classes that are descendants of the <em>Throwable</em> class. There are two predefines subclasses of <em>Throwable</em>: <em>Error</em> and <em>Exception</em>. The <em>Error</em> class and its descendants are related to errors thrown by the Java run-time systems, such as running out of heap memory. There are two predefined subclasses of <em>Exception</em>: <em>RuntimeException </em>which<em> </em>is thrown when a user program causes an error. <em>ArrayIndexOutOfBoundsException </em>and<em> NullPointerException </em>are also descendants from <em>RuntimeException. IOException </em>is thrown when an error has occurred in an <em>input </em>or<em> output</em> operation. Exceptions of <em>Error</em> and <em>RuntimeException</em> and their descendants are called <strong>unchecked exceptions</strong>. All other exceptions are called <strong>checked exceptions</strong>.</p><p>in Java, there’s an additional <em>finally</em> clause, which is placed at the end of the list of handlers. If <em>try</em> clause throws no exception, <em>finally</em> is executed before executions, after the <em>try</em> construct. If try clause throws an exception and if it’s caught by the handler, the <em>finally</em> clause is executed after the handler completes its execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uViq-e_saweY5gisGE46Hg.png" /></figure><blockquote>Error handling refers to the anticipation, detection, and resolution of programming, application, and communications errors. Specialized programs, called error handlers, are available for some applications.</blockquote><p>Errors in the programs can happen in different phases. During the development, errors might occur due to syntax and logic. Syntax problems occur due to misspellings. It is possible to solve syntax problems by proofreading. Logic errors happen when the output of the executed code is not as expected. Logic errors are also called bugs. The solution to handling such errors are debugging programs.</p><p>During the execution of the program, run-time errors can happen because of hostile service or invalid input data. Lack of a satisfactory amount of memory or memory conflicts with another program can also cause run-time errors. Run-time errors can be resolved or their impact can be minimized.</p><p>I hope, you enjoyed and learned about the current topic. Don’t forget to read other articles of mine. Have fun, Peace ✌🏼</p><p>References</p><ol><li><a href="https://searchsoftwarequality.techtarget.com/definition/error-handling#:~:text=Error%20handling%20refers%20to%20the,are%20available%20for%20some%20applications">https://searchsoftwarequality.techtarget.com/definition/error-handling#:~:text=Error%20handling%20refers%20to%20the,are%20available%20for%20some%20applications</a>.</li><li>Sebesta, R. W. (2019). Examples of Multiple Selectors. In <em>Concepts of programming languages</em>. NY, NY: Pearson.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84f29fc47304" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Variables]]></title>
            <link>https://mrilyaskarimov.medium.com/variables-96d863c8f35b?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d863c8f35b</guid>
            <category><![CDATA[variables]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 05:20:35 GMT</pubDate>
            <atom:updated>2020-12-06T05:20:35.886Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello, dear programming lovers. I’m glad to see you again in another article of mine. Today we will talk about the most common topic, variable. Many of you probably don’t think about how deep the variables actually are but</strong> <strong>believe me, this topic is not shallow at all. To better understand them, let’s start.</strong><br>Many programmers even think that variables consist only of a memory location. However, it can be characterized by 6 attributes, name, address, value, type, lifetime, and scope.</p><p><strong>Name</strong> — A string of characters used to identify some entity in a program. Some names are common to all programming languages, such as i, j, var1, and so on. Previously, the name of the variable was limited, only 1 character was allowed. Although this limit has been removed in some languages (C # and Java), some programming languages such as C still has up to 31 character restrictions. The first thing we need to consider the names of variables is that they are case-sensitive. Thus, the same names written in uppercase and lowercase letters are actually different variables, such as color and COLOR. Note that there can be no space in the variable name. It is also recommended to use Camel notation when naming variables. The first letter of words other than the first word is capitalized and written together.</p><p><strong>Address</strong>—A machine address of a variable, also known as l-value (l stands for left because address appears on the left side of an assignment when the name of a variable appears). Think of it as a home. For example, you can find people in their homes. Different variables have different addresses, but let’s not forget that just as two people can live in the same house, different variables can be related to the same address. This is called <strong>aliasing</strong> in programming. Aliasing reduces readability because by changing the value of one variable, we affect the other. Suppose that the variables a and b point to the same address. By assigning the variable a to 5, we also make the value of variable b equal to 5. I know, it’s a bit confusing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*7bRkhPbggcv3DBTehnoiAQ.jpeg" /></figure><p><strong>Value</strong> —The contents of the memory cell or cells associated with the variables, also known as r-value (r stands for right because value appears on the right side of an assignment when the name of a variable appears). Cells are imagined to be abstract cells because the value of any variable can take up to 16 bytes of memory depending on the programming language. Computer memories consist of 8-bit units and are called bytes. For example, in C ++, floating-point values may take 4 bytes.</p><p><strong>Type</strong> — In some programming languages, with the declaration of variables the type is also specified. The type determines position, size of variable memory, the range of values the variable can store, and the set of operations that are defined for values of the type. There are <strong>primitive data types</strong>, which are built-in and predefined implicitly and can be directly used by the users, <strong>derived data types</strong>, which are derived from primitive data types, and <strong>abstract/user-defined data types</strong>, which are defined by the user itself.</p><h3>Type Bindings</h3><p><strong>Binding</strong> is the association between an atribute and entity, such as a variable and its type or a variable and its value. The time the binding happens is called <strong>binding time.</strong> There are several binding times:</p><p><em>Language design time</em> — The syntax and semantics are typically set here.</p><p><em>Language implementation time</em> — Fixation of implementation contants such as numeric precision, run-time memory sizes.</p><p><em>Program writing time</em> — The time spent for the programmer’s choice of algorithm and data structure.</p><p><em>Compile time</em> — The time of translation of high-level language to machine code.</p><p><em>Link time</em> — The time at which machine code files and libraries are combined into an exetuable file.</p><p><em>Load time </em>— The time at which the operating system loads the executable in the memory</p><p><em>Run-time</em> — The time at which the program executes.</p><p>A binding is <strong>static </strong>if it occurs before run-time begins and remains unchanged thoroughout program execution. A binding is <strong>dynamic</strong> if it occurs during run-time or can change during the program execution.<em> Static Type Binding</em> can be through <strong>implicit declaration</strong>, associating variables with the types through default conventions, and <strong>explicit declaration, </strong>a statement in a program which states a list of all variables. From the point of writeability, it is beneficial, yet it is detrimental to reliability. <em>Dynamic Type Binding</em> requires no declarations and a variable is bound to the type when it’s assigned to a value during assignment. Although this type of binding is flexiable, it is costly and the type error detection by the compiler is difficult.</p><p><strong>Lifetime</strong> — It is the time between an object’s creation and its destruction.</p><p>Categories of variables by lifetime</p><p><em>Static — </em>It’s bound to memory cell before execution</p><p><em>Stack dynamic </em>— Storage binding is created when their declaration is elaborated.</p><p><em>Explicit heap-dynamic — </em>Allocated and Deallocated by explicit directives. It’s specified by the programmer and referenced only through pointers.</p><p><em>Implicit heap-dynamic — </em>Allocation and Deallocation caused by assignment statements. It’s flexible, yet it lacks error detection.</p><p><strong>Scope</strong> — The range of statements in which the variable is visible to. The variable is visible if it can be references or assigned in that statement. in <em>Static Scoping, </em>we need to find the declarations in the ancestors. Statis scoping is also called lexical scoping. <em>Dynamic Scoping </em>is based on calling sequences of program units. Programs in static-scoping is easier to read and reliable, that’s the reason why dynamic scoping is not used much.</p><p>This is the end of the article. Feel free to ask questions and don&#39;t forget to read more articles of mine about programming conceps. Peace ✌🏼</p><p>References</p><ol><li>Sebesta, R. W. (2019). Examples of Multiple Selectors. In <em>Concepts of programming languages</em>. NY, NY: Pearson.</li><li><a href="https://www.php.net/manual/en/language.oop5.late-static-bindings.php">https://www.php.net/manual/en/language.oop5.late-static-bindings.php</a></li><li><a href="https://www.geeksforgeeks.org/c-data-types/">https://www.geeksforgeeks.org/c-data-types/</a></li><li><a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;ved=2ahUKEwjqlc-c0LPtAhVOsKQKHalFAL0QFjABegQIBBAC&amp;url=https%3A%2F%2Fcseweb.ucsd.edu%2Fclasses%2Fsp05%2Fcse130%2Flecture_notes%2Ftypes_student.txt&amp;usg=AOvVaw1PbQDZSF0Aohs9xTJ2GAXx">https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;ved=2ahUKEwjqlc-c0LPtAhVOsKQKHalFAL0QFjABegQIBBAC&amp;url=https%3A%2F%2Fcseweb.ucsd.edu%2Fclasses%2Fsp05%2Fcse130%2Flecture_notes%2Ftypes_student.txt&amp;usg=AOvVaw1PbQDZSF0Aohs9xTJ2GAXx</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d863c8f35b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compiler vs Interpreter]]></title>
            <link>https://mrilyaskarimov.medium.com/compiler-vs-interpreter-535d7d8096dc?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/535d7d8096dc</guid>
            <category><![CDATA[interpreters]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Mon, 30 Nov 2020 15:43:06 GMT</pubDate>
            <atom:updated>2020-11-30T15:43:06.258Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello, programming geeks. Today’s topic is something we’re not mostly concerned about for running the code we wrote. I’d like to ask you a question before starting the subject. Did you know that before running the code, the source code should somehow be converted to machine code and there are two main ways to that? Also, make sure to check out other articles of mine to grasp the concepts of programming in an uncomplicated way.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*p6jGp0KMmgw3lc9ZEDoCQQ.png" /></figure><p>Programing Languages can be implemented by 3 general methods. Translating programs to <strong>machine languages </strong>is called <strong>compiler implementation</strong>, which has the advantages of very fast execution and a complete translation process. However, the translation process itself is very slow and time-consuming. The language the compiler translates is called the <strong>source language</strong>. So what happens exactly? The compiler goes through that source code and creates a separate file, which contains the machine code. The file is called an <strong>executable</strong> file as it can directly be executed/run. Let’s not forget that the source program has to go through several phases to generate and result in output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPmiGd0C9ZKrojPS1axO0A.png" /></figure><p>The lexical analyzer collects the characters of the source program into lexical units, which are identifiers, special words, operators, and punctuation symbols. Syntax analyzer uses the lexical units and creates a parse tree to illustrate the syntactic structure of the program. The intermediate code generator produces a program between the source program and the final output of the compiler (the machine language program). The semantic analyzer is a fundamental part of the code generator and checks for errors, such as type errors. The code generator translates optimized code to an equivalent machine language program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qZVtffV1oydvuwql9PZzbQ.png" /></figure><p>With an interpreted language, the source code is not compiled beforehand. Instead, a copy of it is sent to be interpreted by the machine whenever the program runs. The whole process differs from the compilation. A pure interpretation has the advantage of easy implementation, yet the disadvantage outweighs the advantages. Since it is decoding high-level language statements, the execution time is 10–100 times slower compared to the compiler. Another drawback of pure interpretation is the amount of space it takes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uR_NoRP6tlDOtjdOy_v0aw.png" /></figure><p>Last but not least, there’s a hybrid implementation system, which is a compromise between compilers and pure interpreters. Their job is to translate high-level programs to an intermediate language designed to allow easy interpretations. It’s worth mentioning that hybrid implementation is faster compared to pure interpretation.</p><p>Thank you very much for your attention, I hope you deepened or refreshed your knowledge. Peace ✌🏼</p><p>References</p><ol><li>Sebesta, R. W. (2019). Examples of Multiple Selectors. In <em>Concepts of programming languages</em>. NY, NY: Pearson.</li><li><a href="https://whatis.techtarget.com/definition/compiler#:~:text=A%20compiler%20is%20a%20special,a%20time%20using%20an%20editor">https://whatis.techtarget.com/definition/compiler#:~:text=A%20compiler%20is%20a%20special,a%20time%20using%20an%20editor</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=535d7d8096dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pass-by-value vs Pass-by-reference — with C++ examples]]></title>
            <link>https://medium.com/star-gazers/pass-by-value-vs-pass-by-reference-with-c-examples-911e7e81ae65?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/911e7e81ae65</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[values]]></category>
            <category><![CDATA[reference]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Fri, 27 Nov 2020 16:28:12 GMT</pubDate>
            <atom:updated>2021-03-12T07:23:12.074Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pass-by-value vs Pass-by-reference — with C++ examples</h3><p><strong>Hello, Folks! I’ve been thinking for days about how to explain this topic so that newcomers understand it better and don’t need to read further. I think I found that way, but after reading the article, how about you tell me if I am right.</strong></p><p><strong>P.S. My code will be thoroughly commented.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*GXoMWqljArmbjB0ReNioag.gif" /><figcaption>pass-by-reference vs pass-by-value</figcaption></figure><p>When calling a function, the arguments in the function can be either <strong>passed-by-value</strong> or <strong>passed-by-reference</strong>. There are also <strong>callee</strong> and <strong>caller</strong> terms used as a function called by another and a function that calls another function(a callee) respectively. Additionally, the value that is passed in the function call is called the <strong>actual parameter, </strong>and the value received by the function from the call is called the <strong>formal parameter</strong>.</p><h3>Pass-by-value</h3><p>When the variable is passed-by-value, the copy of the actual parameter’s value is stored in the memory, and the callee and caller have two independent variables with the same value, but the caller cannot see the modification by the caller. To put it simply, if we want to access and modify a variable within a function, the original value will remain untouched, i.e. the value will not change. What we use is usually pass-by-value.</p><h3>Pass by reference</h3><p>In this case, the memory address of that variable is passed directly to the function. Callee and Caller run the same variable, so if the callee makes any modifications, it is also seen by the caller, that is, it affects its variable. In many programming languages, passing by reference can be achieved by putting &amp; symbol in front of a variable.</p><p>Now let’s write a simple exponentiation code. You can understand it by paying attention to the following code and comments. So, the program will print the answer after multiplying that number by itself. I write this as an example of pass-by-value.</p><pre>#include &lt;iostream&gt;</pre><pre><strong>int</strong> expo(<strong>int</strong> x){//callee - the function itself, x- formal parameter</pre><pre><strong>return</strong> x= x*x;// return should be int type, returning x*x.</pre><pre>}</pre><pre><strong>int</strong> main() {</pre><pre><strong>int</strong> n; //actual parameter</pre><pre>scanf(&quot;%d&quot;, &amp;n); //scanning from console</pre><pre>printf(&quot;%d %d\n&quot;, expo(n), n); <br>/* expo(n) is caller here. printing expo(n) and also actual parameter, to show you actually n is not affected. the answers will be still 25 and 5. the variable n is not affected. */</pre><pre>}</pre><p>For example, if you enter 5 during a scanf (when you enter a number from the console), the answers will be 25 (the answer returned from expo(n)) and 5, ie the value of the variable n. The answer will look like this: 25 5. Remember to look carefully at the printf function to understand it better. That’s why this is called passing-by-value, check that coffee gif again at the start.</p><p>Now let’s look at the pass-by-reference code.</p><pre>#include &lt;iostream&gt;</pre><pre><strong>int</strong> expo(<strong>int</strong> &amp;x){ //callee - the function, referenced by &amp;. </pre><pre><strong>return</strong> x = x*x; // return should be int type, returning x*x.</pre><pre>}</pre><pre><strong>int</strong> main() {</pre><pre><strong>int</strong> n; //actual parameter</pre><pre>scanf(&quot;%d&quot;, &amp;n); //scanning from console</pre><pre>printf(&quot;%d %d\n&quot;, expo(n), n);</pre><pre>/* expo(n) is caller. printing expo(n) result and also actual parameter, to show you actually n is not affected. */</pre><pre>}</pre><p>Here, if you enter 5 during the scan, you will see 25 25 answers. The first 25 is the response returned from the expo (n) function, and the next is the value of the variable n. If you don’t believe the answer, you can copy and paste the code yourself into a C++ programming compiler.</p><p>We have come to the end of today’s article. Don’t forget to ask questions about the unclear part(s). Don’t forget to read my other articles. Peace ✌🏼</p><p>References:</p><ol><li>N, T. (2018, March 08). Passing by Value vs. by Reference Visual Explanation. Retrieved from <a href="https://blog.penjee.com/passing-by-value-vs-by-reference-java-graphical/#:~:text=The">https://blog.penjee.com/passing-by-value-vs-by-reference-java-graphical/#:~:text=The</a> terms “pass by value,where the value is stored.</li><li>Pass by value vs. pass by reference. (n.d.). Retrieved from <a href="https://www.educative.io/edpresso/pass-by-value-vs-pass-by-reference">https://www.educative.io/edpresso/pass-by-value-vs-pass-by-reference</a></li><li>Sebesta, R. W. (2019). Examples of Multiple Selectors. In <em>Concepts of programming languages</em>. NY, NY: Pearson.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=911e7e81ae65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/star-gazers/pass-by-value-vs-pass-by-reference-with-c-examples-911e7e81ae65">Pass-by-value vs Pass-by-reference — with C++ examples</a> was originally published in <a href="https://medium.com/star-gazers">Star Gazers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Language Evaluation Criteria — Cost]]></title>
            <link>https://mrilyaskarimov.medium.com/language-evaluation-criteria-cost-e536efbf060b?source=rss-245e1b68b62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e536efbf060b</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[cost]]></category>
            <dc:creator><![CDATA[Ilyas Karimov]]></dc:creator>
            <pubDate>Mon, 23 Nov 2020 15:43:14 GMT</pubDate>
            <atom:updated>2020-11-23T15:43:14.213Z</atom:updated>
            <content:encoded><![CDATA[<h3>Language Evaluation Criteria — Cost</h3><p><strong>Hello and welcome back to the last-but-not-least language evaluation criteria article. If you haven’t read about </strong><a href="https://medium.com/swlh/language-evaluation-criteria-readability-cde47a46f20"><strong>readability</strong></a><strong>, </strong><a href="https://mrilyaskarimov.medium.com/language-evaluation-criteria-writability-and-reliability-1a4c8ae369a9"><strong>writability, and reliability</strong></a><strong>, I encourage you to do so!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*OvRsCC9ohcYvd3OgzBUa0w.jpeg" /><figcaption>Icon by Icon-library</figcaption></figure><p>The cost of a language is dependent on many factors and criteria. Starting from the basics, there’s the cost of a new generation of programmers learning a programming language, which is a function of simplicity and orthogonality of the language. It even includes learning a new language by seniors. It is undeniable that no matter how professional we are, we cannot know every language.</p><p>Secondly, there is the cost of writing programs, which a function of the writability of the language. This cost is also linked to programming environments. A good programming environment affects both the cost of training programs and writing programs in a language positively. Historically, high-level programming languages have been created to reduce the cost of creating software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*laBlv7k43IL5N81LwaKvOw.png" /><figcaption>Icon by Clipartmax</figcaption></figure><p>Thirdly, there’s the cost of execution. Different languages exhibit different behaviors due to language design. In a language that requires many runtime type checks fast code execution would be impossible, regardless of the quality of the compiler, because run-time type checking is a time-consuming and expensive process, such as in Java.</p><p>There’s also a correlation between the cost of compilation and the speed of execution.</p><blockquote>In computer science, program <strong>optimization</strong>, code optimization, or software optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources</blockquote><p>If the code is not optimized at all, the compilation will be faster depending on the compiler, or conversely, compilation in optimized code will take longer. That’s why for new programmers, who run their programs often, there is no need for optimization, but for large software, we can say the exact opposite. I attribute this to the fact that different compilers run on different hardware and have different memory space requirements.</p><p>Then comes the cost of poor readability. If a designated program fails at critical and noncritical moments, and the correction of these errors involves a revision of old materials or more than half of the code, then the cost of that program is high. It can also lead to business collapse and even false cases. For example, any mistake of the X-Ray machine can lead to wrong results.</p><p>Finally, the characteristic that affects cost is maintenance. When we say maintenance, we mean both corrections and modifications to add a new function. As for why this is associated with readability, if the author who wrote the program has to make changes to the code over time and has difficulty understanding what he has written, it will cost him dearly.</p><blockquote>The importance of software maintainability cannot be overstated. It has been estimated that for large software systems with relatively long lifetimes, maintenance costs can be as high as two to four times as much as development costs (Sommerville, 2010).</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*hJYATDzbTPR2mQdW0jL_dA.gif" /><figcaption>GIF by SDPdeveloper</figcaption></figure><p>Other criteria influence the evaluation of a programming language:</p><p><strong>Portability </strong>is the transfer of a program from one implementation to another, which is impacted by the degree of standardization. For a language that is not standardized, the migration process is difficult. I would also like to say that standardization is a complicated and time-consuming process too. So, it took about 10 years to standardize and approve the standardization of C++. <strong>Generality</strong> and <strong>well-definedness</strong> can also be added to these terms. Generality is the applicability of a program’s wide-range of applications, and well-definedness is the completeness of an official defining document.</p><p>In conclusion, I would like to say those language evaluation criteria can, of course, be evaluated differently in the eyes of different people. But programmers are usually concerned about writability first, and then readability. Finally, if we look at this article, we can see the effects that will affect the Cost below.</p><h3>Cost:</h3><ul><li>Training- Simplicity, Orthogonality</li><li>Writing- Writability</li><li>Execution- Efficiency</li><li>Compilation</li><li>Poor Readability</li><li>Maintenance- Readability</li></ul><p>References:</p><ol><li>Sebesta, R. W. (2019). Examples of Multiple Selectors. In <em>Concepts of programming languages</em> (pp. 53–55). NY, NY: Pearson.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e536efbf060b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>