<?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 Mitrajeet Golsangi on Medium]]></title>
        <description><![CDATA[Stories by Mitrajeet Golsangi on Medium]]></description>
        <link>https://medium.com/@mitrajeetgolsangi?source=rss-454ffd9c1d03------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sg_oPALaLrK-t5RT9iUrSw.jpeg</url>
            <title>Stories by Mitrajeet Golsangi on Medium</title>
            <link>https://medium.com/@mitrajeetgolsangi?source=rss-454ffd9c1d03------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:30:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mitrajeetgolsangi/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[Dev-containers! I’m in love, here’s why (Non-Technical Overview)]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/dev-containers-im-in-love-here-s-why-non-technical-overview-e5a36d2ab0da?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5a36d2ab0da</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devcontainer]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 10:33:07 GMT</pubDate>
            <atom:updated>2024-06-27T10:33:07.605Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I have been trying to use development containers (devcontainers) to develop some of my projects, and oh my God they are good! I started just testing how they would affect my workflow and test out all their features, and I was pleasantly surprised by how much functionality they had to offer. So much so that I had to write this article to push everyone towards using them.</p><p>Now before directly jumping into devcontainers, there are a couple of basic prerequisites which you probably should know; you know the overall concept of virtualization using containers and you have a basic overview of Docker. If you do, then you are good to go and you can skip the paragraph below.</p><p>If you don’t know what the above things are, you probably will be fine due to the high level of abstraction present in the devcontainers cli, but I recommend watching this playlist first before proceeding further just because it is always a good idea to know your stuff before committing to the thing at hand.</p><blockquote>It is fine if you don’t want to watch this right now, as this is not a technical post (Which will come soon in the Future)</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPL4cUxeGkcC9hxjeEtdHFNYMtCpjNBm3h7&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fplaylist%3Flist%3DPL4cUxeGkcC9hxjeEtdHFNYMtCpjNBm3h7&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F31ieHmcTUOk%2Fhqdefault.jpg%3Fsqp%3D-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ%3D%3D%26rs%3DAOn4CLCTNHuvQDE2EPs1mM_8GzBOmnIr7A%26days_since_epoch%3D19668&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="853" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/42ee9e1a74bf5216f96fa6575eba12e3/href">https://medium.com/media/42ee9e1a74bf5216f96fa6575eba12e3/href</a></iframe><h3>Devcontainers Idea</h3><blockquote>The main concept of Docker containers, in general, is to remove the “It works on my machine”<em> </em>problem.</blockquote><p>Devcontainers take that concept and uplevel it a notch. The idea is that you develop inside a container that can be configured using a single JSON file and pushed to any version control solution. This method ensures 2 main things.</p><ol><li>All the dependencies, additional tools, and the entire operating system will be consistent.</li><li>There is no hassle for the same configuration to be used by all of the developers working on the project.</li></ol><p>As you must have understood up till now, Devcontainers shine when there is either a complex application or there is a relatively big team where the app needs to be distributed and developed.</p><p>Even though this is true, I don’t want to discuss that side of devcontainers, because that is the actual <em>“use case”</em> the technology was developed for and there is plenty of documentation out there for this same thing. Instead, I want to focus on how they can be used to manage projects on an individual computer and why they are better than plain old virtual environments or package.json files.</p><h3>Using Devcontainers for Isolating Projects</h3><p>As a person who likes to tinker with various new technologies and get their hands dirty, I often face problems and limitations on dependency factors and OS restrictions. I once was trying to install a CPython dependency which had an internal conflict with another Python package installed in my user environment, I had to drop the project for 3 months till I figured out the problem with the help of the lovely Python community and the developer of the extension.</p><p>This is the only part of programming which makes me want to curl up into a ball and just lie in front of my PC for the rest of eternity, BUT… Devcontainers! They are the best solution to isolate your projects completely from one another even at the OS level so even if you are working on some low-level projects including C++ or Rust, you can be sure that the dependencies won’t conflict.</p><blockquote>Now there is a catch here, some of the low level functionality which interacts directly with the hardware may not work as expected (but if you are working on something like that, you probably are a pro and don’t need to read this)</blockquote><h3>Using Devcontainers for Peace of Mind</h3><p>Some of the projects that I start are started with a bigger vision in mind (and that late-night motivation to get rich on a mindblowing product). Now, I am a massive overthinker and I always think of the most impossible future scenarios where I may want to scale the project to an international level and maintain a huge team to maintain and develop new things. Then I start working and a lot of times I have nightmares about the deployment complexities, the code refactoring nightmares and a lot of real problems which I realistically will probably never face.</p><p>So, I start designing the application in a Devcontainer from the beginning for easy code distribution, and design a deployment container which is optimized with only the required compiled code. A docker-compose file with additional dependencies like data stores, databases, monitoring services etc. makes me rest easy when I think of all the unrealistic problem scenarios.</p><h3>Conclusion</h3><p>Anyway, these were just some of the things that I use Devcontainers for and I’m sure there is an entire world of possibilities out there. So if you have any use cases that you would like to share here, please be my guest and let me know in the comments. I am just dipping my toes into this vast ocean and I’m loving it so far.</p><h3>References</h3><p>[1] <a href="https://containers.dev/">Devcontainers</a> Docs<br>[2] <a href="https://docs.docker.com/get-started/overview/">Docker</a> Docs<br>[3] Valstar, S., Griswold, W.G. and Porter, L., 2020, June. Using devcontainers to standardize student development environments: An experience report. In <em>Proceedings of the 2020 ACM Conference on Innovation and Technology in Computer Science Education</em> (pp. 377–383).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5a36d2ab0da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Different Types of Parallel Computing Methodologies and their Applications]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/different-types-of-parallel-computing-methodologies-and-their-applications-728f9e0ec5f3?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/728f9e0ec5f3</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[parallel-computing]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Wed, 17 Apr 2024 14:42:51 GMT</pubDate>
            <atom:updated>2024-04-17T14:42:51.435Z</atom:updated>
            <content:encoded><![CDATA[<p>Trying to explain the backbone of nearly uncountable industries we see today!</p><figure><img alt="A beautiful view of strings made up of individual lights" src="https://cdn-images-1.medium.com/max/1024/0*-H2FEv1ZAasNVqN-" /><figcaption>Photo by <a href="https://unsplash.com/@sortino?utm_source=medium&amp;utm_medium=referral">Joshua Sortino</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So, if you clicked on this article, I assume you are a programmer, tech enthusiast, curious soul or all of the above (like me). It would benefit you to have a basic understanding of programming concepts and how computer architecture works.</p><p>If you are not from this field, I highly recommend watching this video before you read further, just to get a very high-level overview of the working of a regular CPU.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcNN_tTXABUA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcNN_tTXABUA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcNN_tTXABUA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4507c528e04569ff49c1fc0fe46fcd7d/href">https://medium.com/media/4507c528e04569ff49c1fc0fe46fcd7d/href</a></iframe><h3>The Basics</h3><p>The goal for any type of computing is to extract the highest amount of data processing in the lowest amount of time. The way regular computers function (serial execution) each instruction uses up the entire Central Processing Unit (CPU) time before letting the other instructions execute. This causes problems when you have a lot of unrelated small operations to be performed in a large amount of quantity. Thus, parallel processing came into the picture.</p><blockquote><strong>Parallel processing</strong>: is the processing of multiple tasks on multiple processors [2]</blockquote><h4>History</h4><p>Initially in the late 1960s — early 1970s a shared memory multiprocessor system with advancements in supercomputers can be called the first parallel processing computer. Then the Caltech Concurrent Computation project created a supercomputer in the mid-1980s using 64 of the 8086/8087 processors and opened up the market for Massively Parallel Processors (MPPs). In the late 1980’s clusters started to compete with MPPs. Later the mainstream parallel processing with multi-core CPUs and highly performant GPUs we use today opened up the world to infinite opportunities[3]. If you are interested in having a deep dive into the history of parallel computing I recommend reading the article [2].</p><h4>Flynn’s Taxonomy</h4><ol><li>Single Instruction Single Data — SISD</li><li>Single Instruction Multiple Data — SIMD</li><li>Multiple Instruction Single Data — MISD</li><li>Multiple Instruction Multiple Data — MIMD</li></ol><p>For further reading on this topic, the article by <a href="https://medium.com/u/285b1e5de4fa">harsh verma</a> titled <a href="https://harsh9verma.medium.com/sisd-simd-misd-mimd-fdf6f8e4b6e1">SISD, SIMD, MISD, MIMD</a> is insightful.</p><h3>Parallel Computing Methodologies</h3><p>Now that we have the basics covered, let’s get into the topic of discussion. As of writing this article, there are a few types of parallel computers that have been invented over the years, the different types of parallel computers or parallel computing methodologies are useful in their respective domains.</p><p>Complementing the use case of parallelism, each of these methodologies is being used to date in different domains unlike the traditional <em>scrap the old</em> method we are used to in the tech industry.</p><h4>Symmetric Multiprocessing (SMP)</h4><p>A common misconception regarding parallelism is that whenever we hear the word <em>parallel</em> our minds instantly jump to GPUs, but that is hardly the case in any of the systems we use today. Nearly all the CPUs we use today have more than one processor, this means that even in a single CPU, the instructions can be executed in parallel on different cores. The diagram below displays a multi-core/multiprocessor CPU architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9A5GGoHzvkgQ--cQUM4QA.png" /><figcaption><strong><em>cc-NUMA System by Ferruccio Zulian — Milan.Italy</em></strong></figcaption></figure><p>The basic concept is that if a process is busy, performing some time-consuming (blocking) operations like I/O, another process is branched in instead of the ongoing process till the execution of the blocking operations is complete, this ensures the maximum utilization of the CPU. This kind of architecture is classified in both the SIMD and MISD cases in Flynn’s Taxonomy.</p><p>In this architecture none of the individual processors have any special identity, but the state of the processors between instructions. This sequence of bits storing the processor state is called a <em>state word. </em>The state word is stored in a section of the main memory which is specifically designed to store the state words of all the processors. This is called the <em>control memory. </em>Practically, to store the state words in the state register for context switching, some time is required, this time can be highly reduced if the number of buses from the processors to the control memory is equal to the number of processors, these busses are called <em>flow paths.</em></p><p>Now, assume <em>k</em> as the number of processors in the system (where <br>k ≥ 2) and <em>n</em> as the number of state words. The system can perform parallel operations with a speed given in the following equations.</p><pre>speed ∝ k            where 1 ≤ k ≤ n<br>speed = constant     where n ≤ k</pre><p>This holds true because if the number of state words exceeds the number of flow paths the speed will be affected by the transfer time from the state words [5].</p><p>Apart from the actual parallel program execution the multiprocessor architecture also needs to handle storage to a shared memory which poses its own challenges, like memory protection, finding the location for data allocation for newly loaded programs and the memory service rate itself. A lot of these problems are solved using unique process and program identifiers and a fixed package size for the memory storage. Also, the number of programs that can perform I/O operations on the memory is limited and queued.</p><p>The type of memory access in the multiprocessor system can be classified into 4 different categories</p><ol><li><strong>Uniform Memory Access (UMA)</strong></li><li><strong>Non-Uniform Memory Access (NUMA)</strong></li><li><strong>Cache-Only Memory Architecture (COMA)</strong></li></ol><p>The above example just discusses a single system with multiprocessing support and an extremely simplified case. With the cc-NUMA architecture such a system of multiprocessors is encased within a single node, and there are several such nodes. These nodes are then interconnected to each other using a remote interconnection link to perform complex operations in parallel [7][8].</p><h4>Symmetric Multiprocessing — Applications</h4><p><strong>Vector processing:</strong> Multiprocessors with SIMD are often used for vector processing since loop-level parallelism can be used to optimize the calculations.</p><p><strong>Hyper-threading or pipelined processors:</strong> These are described by several sequences of instructions in a single view, such as MISD.</p><p><strong>Multithreading:</strong> Threads are divided up among the processors and executed simultaneously increasing the performance of repetitive simple operations significantly.</p><p><strong>Everyday Tasks: </strong>Today, all of the systems have a multiprocessor architecture and many programs depend on it. Thus, every task you are performing on any computer like reading this post, and you are using a multiprocessor system.</p><h4>Multicomputer</h4><p>A multicomputer architecture is similar to a multiprocessor architecture. The difference is that instead of the shared memory structure, each of the processors has its own dedicated memory. The processors communicate with each other using an <em>interconnection network</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/0*2Zs41fVz_yVp0iIp.png" /><figcaption>Image of a NORMA system [9]</figcaption></figure><p>A multicomputer system can be imagined as a set of interconnected computers inside a network [8]. This means that each computer will have a different processor capacity and different system requirements. Thus, it is important to maintain data heterogeneity. Thus, the multicomputer architecture follows a No-Remote Memory Access (NORMA) structure. Here, since the memory is not shared between the computers, they can have any internal architecture even a multiprocessor one!</p><p>Since the computers are relatively separated, the system design for these is significantly easier compared to multiprocessor architecture. But, the program execution poses a significantly higher challenge for the user. The user must have a complete understanding of the computers and must be careful when to assign which program to which computer, since a simple task to a powerful computer and a complex task to a simple computer will cause the system to lose valuable time. Also, since the data is stored in a heterogeneous fashion, the interprocessor communication may lead to data loss or an unstable state.</p><p>Even with the above caveats the system poses significant advantages for existing systems. Since the existing infrastructure can easily be converted into such a system. The system is easy to scale and provided the right task is assigned to the right computer, the speeds obtained should be phenomenal.</p><h4>Multicomputer — Applications</h4><p><strong>Distributed Computing: </strong>Since the computers are different and provide different computational performances, these systems are ideal for performing distributed computing tasks.</p><p><strong>Render Farms: </strong>Photorealistic rendering, VFX rendering, Animated frame generation, simulation rendering, etc. are some of the applications that use a render farm to perform a computationally expensive task</p><p><strong>Cloud Computing: </strong>These systems are ideal as cloud computing infrastructure due to their cost effectiveness and easy scalability.</p><h4>Distributed shared memory (DSM)</h4><p>These systems are designed to leverage the power of personal computers and workstations inside a computer network and build a highly parallel system on top of it. The main difference from the multicomputer architecture is that a virtual global memory for all the computers is shared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/0*WwYGh2sWnIxLP7yM.png" /><figcaption>A Distributed Shared Memory system [10]</figcaption></figure><p>The main problem in a DSM system is the maintenance of the distributed memory, to address this problem a variety of algorithms are put in place. The main aim of this algorithm is to act like a mutex for the memory, provide access to the memory read-write operations to the requested computers, and lose the minimum amount of time possible in the waiting period [11].</p><p><strong>Lazy Release in ThreadMarks:</strong> This variation uses a set of synchronization variables which are divided into acquire and release. The system uses a page-based memory allocation and a lazy diff creation algorithm to reduce the amount of data exchange [8].</p><p><strong>Memory Channel Interconnection in Shasta: </strong>This ensures the memory exchange between processes is done without any additional overhead by storing the data on a mapped page in the shared memory. The state of the memory units is managed inside the individual computers i.e. the number of memory units in local memory and ones in shared memory. The memory consistency is managed using the application codes [8].</p><p>Since this system architecture solely focuses on memory organization in parallel systems, any currently existing systems can also be converted to DSM systems for better performance.</p><h4>Distributed shared memory (DSM) — Applications</h4><p><strong>Datastores: </strong>The DSM systems can handle a large amount of data very easily and thus are an excellent way of storing data in a fast and parallel manner.</p><p><strong>ML Model Training: </strong>Since an ML model with a huge dataset, say a Large Language Model (LLM) or a Weather forecast model required to perform a huge amount of operations on a huge amount of data, DSM systems are an ideal fit.</p><h3>Conclusion</h3><p>Parallel processing has become an integral part of our technological lives and it has never been more in demand now that the AI revolution has picked up. With increasing number of load on cloud computing and generative AI the need for processing a large amount of data in a small amount of time can only be seen to increase in the future.</p><p>As of now, the trend for parallel programming is seen to be picking up according to Google trends.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2FjVTqJ%2F1%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2FjVTqJ%2F1%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2FjVTqJ%2Fplain-s.png%3Fv%3D1&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="397" frameborder="0" scrolling="no"><a href="https://medium.com/media/003a4856397d3105ce6a7b899aa6e7b4/href">https://medium.com/media/003a4856397d3105ce6a7b899aa6e7b4/href</a></iframe><h3>Authors</h3><p>Mitrajeet Golsangi<br>Pravin Harne<br>Sahil Jain<br>Ansh Jaiswal</p><p>Find my stories interesting? You can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><h3>References</h3><p><a href="https://ieeexplore.ieee.org/abstract/document/9681810"><em>[1] Zeng, M. and Fodor, V., 2022. Parallel processing at the edge in dense wireless networks. IEEE Open Journal of the Communications Society, 3, 1–14.</em></a></p><p><a href="https://www.gc11.ac.in/uploads/elearning/parallel-comp3-702716459.pdf"><em>[2] GC11. “Parallel Computing.” Post Graduate Govt. College Sector 11</em></a></p><p><a href="https://www.intel.com/pressroom/kits/upcrc/ParallelComputing_backgrounder.pdf"><em>[3] Intel Corporation. “Parallel Computing: Background.” Intel Pressroom</em></a></p><p><a href="https://www.researchgate.net/publication/236666656_Accelerating_Fibre_Orientation_Estimation_from_Diffusion_Weighted_Magnetic_Resonance_Imaging_Using_GPUs"><em>[4] Hernandez Fernandez, Moises &amp; Guerrero, Ginés &amp; Cecilia, José &amp; García, José &amp; Inuggi, Alberto &amp; Jbabdi, Saad &amp; Behrens, Timothy &amp; Sotiropoulos, Stamatios. (2015). Erratum: Accelerating fibre orientation estimation from diffusion weighted magnetic resonance imaging using GPUs (PLoS ONE (2015) 10:6 (e0130915) 10.1371/journal.pone.0130915). PLoS ONE. 10. 10.1371/journal.pone.0130915.</em></a></p><p><a href="https://dl.acm.org/doi/pdf/10.1145/1463822.1463838"><em>[5] Conway, M.E., 1963, November. A multiprocessor system design. In Proceedings of the November 12–14, 1963, fall joint computer conference (pp. 139–146).</em></a></p><p><a href="https://mavam.com/lance/publications/cmp_Computer97.pdf"><em>[6] Nayfeh, B.A. and Olukotun, K., 1997. A single-chip multiprocessor. Computer, 30(9), pp.79–85.</em></a></p><p><a href="https://ece.northeastern.edu/groups/nucar/publications/ibmjrd.pdf"><em>[7] Lovett, T. and Clapp, R., 1996, May. STiNG: A CC-NUMA computer system for the commercial marketplace. In Proceedings of the 23rd annual international symposium on Computer architecture (pp. 308–317).</em></a></p><p><a href="https://d1wqtxts1xzle7.cloudfront.net/87159508/978-3-662-04303-5_520220607-1-8xba4g-libre.pdf?1654630988=&amp;response-content-disposition=inline%3B+filename%3DHandbook_on_Parallel_and_Distributed_Pro.pdf&amp;Expires=1713362849&amp;Signature=BBNOH9UhqscWRXPyV-6k9mQd107RHWRoCajfcWW5PxtB4edWybt0qeo07cOONLadkdwd-ckOU0TCNJdE9Bxo7JgR5L6tQ-IaLyj6Ttgap0cT3Fshxirj-flJkYCwxpG~rYqFw0O9OHI3SnZwT4ekV5r~DMqioB6lx6xkHkbACMoZNQkBJ31BEZMNRqjXDBovkhZe4woGwByGiRx8VXHKGmrRfF3O-dW0ELxaad5-oGp-aa~vPrTPRUxMYW8LSW-Z69vaHhh6Y1r80k2jMzwfvHLx7NUjFt7gd6Lo3DX7L9rl4njBmaIYk5yMpcwsdv--zKWxftseyq3FmpsnkCy2gg__&amp;Key-Pair-Id=APKAJLOHF5GGSLRBV4ZA"><em>[8] Garcia, J., Ferreira, P. and Guedes, P., 2000. Parallel operating systems. Handbook on parallel and distributed processing, pp.228–262.</em></a></p><p><a href="https://www.taylorfrancis.com/books/mono/10.1201/9780429288456/computer-organisation-architecture-pranabananda-chakraborty">[9] Chakraborty, P., 2020. <em>Computer Organisation and Architecture: Evolutionary Concepts, Principles, and Designs</em>. Chapman and Hall/CRC., (pp. 425–588)</a></p><p><a href="https://www.geeksforgeeks.org/what-is-distributed-shared-memory-and-its-advantages/">[10] pulamolusaimohan, 2021, What is Distributed shared memory and its advantages, GeeksForGeeks, September 10.</a></p><p><a href="https://citeseerx.ist.psu.edu/document?repid=rep1&amp;type=pdf&amp;doi=c7e694a641b51b44d566174c4246c4d47f575165">[11] Protic, J., Tomasevic, M. and Milutinovic, V., 1996. Distributed shared memory: Concepts and systems. <em>IEEE Parallel &amp; Distributed Technology: Systems &amp; Applications</em>, <em>4</em>(2), pp.63–71.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=728f9e0ec5f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A different outlook toward Chess and Artificial Intelligence]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/a-different-outlook-toward-chess-and-artificial-intelligence-66ddae87812c?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/66ddae87812c</guid>
            <category><![CDATA[chess]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Fri, 28 Apr 2023 08:24:22 GMT</pubDate>
            <atom:updated>2023-05-01T06:05:52.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rm-qBU9NOE0hbHGXJbPChw.png" /><figcaption>Image generated using DALL.E by OpenAI</figcaption></figure><p>As a person who is in the tech or IT field, most of my time is spent in front of a screen, and after the pandemic, my free time scrolling through reels. Once while scrolling mindlessly, I came across Levy Rozman, or to be specific his channel <a href="https://www.youtube.com/@GothamChess">Gotham Chess</a>. Here, I found that he was reacting to a chess game played by Magnus Carlsen, but the fact that interested me was the platform on which the game was being played. The board was a bit odd and instead of the typical chess colors, the dark squares were actually green. I didn’t think much of it, but like any algorithm of a good social media app, his reels became a more common occurrence in my feed. Soon I started to see other chess games, and nearly all of them had the same green and white chessboard. This made me wonder, and I started searching online for a platform on which I could play chess, and there it was <a href="http://chess.com/">chess.com</a>, a site on which there were a lot of interesting things you could do. Amongst other things, there was a section that said “Single Player Mode”. As any person, I went on ahead and clicked on the section thinking it would give me a simple program with a custom difficulty level, and I would play the game. I couldn’t be more wrong, there was a complete plethora of bots, having different difficulties, names, and even different personalities!</p><p>Fortunately enough for me, I was studying A.I. in my college curriculum and was just starting to understand the many aspects of the field and building my interest in it. So I started to dig deeper into the aspects of this field and didn’t even realize when I went down the rabbit hole.</p><p>Before you follow me on this fascinating journey, just in case you have not built up your enthusiasm yet here’s a small chess puzzle provided by chess.com to fire you up.</p><p><a href="https://www.chess.com/daily_puzzle">Daily Puzzle - Chess.com</a></p><h3>Introduction to the Type of Players</h3><p>When I was learning about the subject in my curriculum, our professor Dr Ganesh Bhutkar told us about a sub-part of A.I. (which happened to be his speciality) called Human Computer Interactions (H.C.I.). Here while explaining he told us that usually, we assume that all players are only playing to win the game while designing any system for it, which is not the case in most human-to-human games. There are a lot of types of players who play any given game and the first step to building an intelligent system of any game is to identify the types of players. In general, he told us, there might be many types of players, some of which I have mentioned below.</p><ol><li><strong><em>Casual Player</em></strong><em>: </em>A player playing just for the fun of playing the game</li><li><strong><em>Socializer: </em></strong>A player playing in order to get to know other people</li><li><strong><em>Winner: </em></strong>A player playing to win the game</li><li><strong><em>Ruiner:</em></strong> A player who if he/she cannot win won’t let the other person win</li></ol><p>Now, why is it that I am stressing so much about this is because chess.com follows this principle and has a lot of bots that have different personalities and even have bots who may play like real chess players and chess celebrities.</p><p>Keeping the generalization aside, the paper written by Khaldoon Dhou[1] defines chess personalities as</p><blockquote><strong>Chess personality</strong>: is defined as the attitude of the virtual chess player during the chess game such as attack or defense</blockquote><p>In chess players are categorized into 4 categories which are listed in the ascending order of the skill and descending order of their errors.</p><ol><li>Grandmaster</li><li>Class-A player</li><li>Class-B player</li><li>Class-C player</li></ol><p>The organizations such as World Chess Federation (W.C.F.) provide rankings to all the players. The ranking system is explained in [2] in great detail but is beyond the scope of this article.</p><h3>Comparison of Chess Engines</h3><p>Now that the personalities and types of players are known to us, we can think of designing an intelligent system for playing against the player. This is where the fun part starts. There are numerous algorithms by which an intelligent system can play chess, but in order to give each of the developed bots a unique personality some imperfections are added to the chess engine, it can be as simple as changes in the datasets to more complex variations such as changes in heuristics.</p><p>In this article, we will be discussing the Komodo chess engine and how the changes are made since the bots in chess.com use the same, but there are a lot of chess engines out there, if you are interested in knowing the most powerful ones till now here is a video for you.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FwljgxS7tZVE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DwljgxS7tZVE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FwljgxS7tZVE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7cadf5a1806529c3d42ccdba5231026/href">https://medium.com/media/f7cadf5a1806529c3d42ccdba5231026/href</a></iframe><p>Most chess engines nowadays have included the Nural networks technology in their core engine, this is also the case for the Komodo engine and the Stockfish chess engine which is currently the most powerful one in the market. According to the thesis by Mr. Østensen [3] Komodo is a slow thinker as opposed to the Stockfish, it spends most of its time checking its opponent&#39;s moves rather than the Stockfish approach which specializes in pruning the game tree and goes as deep as possible. Komodo is more stable and ensures the minimization of blunders while Stockfish has more of them.</p><p>These traits of the engines rely heavily on the developer&#39;s mindset since Stockfish is open-source there are a lot of contributors for the same and thus any given update may introduce blunders.</p><blockquote><strong>💡Fun Fact:</strong> Stockfish has won the World Chess Engine Championship 13 times, and chess.com computer chess championship 19 times!</blockquote><p>Chess.com has used a very interesting approach to give the best possible experience to the players. They have developed various personalities of real-life chess players and even fictional geniuses like Sheldon Cooper from the famous sitcom “<em>The Big Bang Theory” </em>using the Komodo as their base engine. But for the analysis of the game they have used Stockfish which gives a detailed analysis of the entire game. This approach combines the best of both worlds and I felt was a really ingenious way of incorporating the world-leading chess technologies together.</p><h3>The Komodo Chess Engine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ajJYn5RyhDvg_pbkPPc87w.png" /><figcaption>Image generated using DALL.E by OpenAI</figcaption></figure><p>The Komodo engine uses the Komodo Mlipir Algorithm (KMA)[4]. This algorithm is responsible for the safe and steady approach that has made Komodo a low-blunder chess engine.</p><blockquote><strong>💡Fun Fact:</strong> The word <strong><em>mlipir </em></strong>is a Javanese language word that means moving alongside the road carefully without grabbing anyone attention and successfully reaching the destination. This movement method is used by smaller Komodo Dragons to hunt for prey, hence the name <strong>“Komodo”</strong>.</blockquote><h4>KMA Details</h4><p>Very simply speaking the KMA algorithm is just an optimal solution finder, the figure below illustrates just that, where there are several Komodo dragons with various sizes and all are trying to reach the global optimum. Replacing the dragons with chess pieces the problem suddenly starts to make much more sense for the specific use case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*QT_W-nNiVUx3zS9Ix106cg.jpeg" /><figcaption>Image from [4]</figcaption></figure><p>Now, the candidates (dragons) can be said to be the problem space, where each dragon represents a vector of positions excluding the velocity. Now the algorithm unfolds something like this.</p><ol><li>First, the big males perform a high-exploitation low-<br>exploration (HILE)</li><li>Next the females either mate with the best big male or perform asexual reproduction using a normally distributed probability distribution of 0.5. The females then perform medium-exploitation medium-exploration (MIME)</li><li>Finally, the smaller dragons perform mlipir movement to perform a low-exploitation high-exploration (LIHE)</li><li>In the above process, the dragons fight with each other to win over the females, and the process is repeated till there is a winning dragon left.</li></ol><p>If you are really interested, in the details I highly suggest you read the paper no. [4] which has the entire explanation of the algorithm.</p><h3>Stockfish Chess Engine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MG-wXYHd3qNsq1yjboClDA.png" /><figcaption>Image from Official Stockfish website</figcaption></figure><p>Stockfish, the current world champion in chess engines is an open-source project created by Google. It started off as an open-source project extension of the <a href="https://www.chessprogramming.org/Glaurung">Glaurung engine</a>, authored by Tord Romstad. Stockfish has attained this legendary status by using the minimax algorithm, …yes the minimax algorithm along with deep learning models in order to prune the game tree and optimize its performance.</p><p>As explained by <a href="https://medium.com/u/759f8e274475">Antoine Champion</a>, in his blog series <em>“Dissecting Stockfish” </em>the Stockfish algorithm works in 4major steps:</p><ol><li>Finding Candidates for chess moves for all playable pieces</li><li>Detecting Patterns of other pieces</li><li>Sliding pieces into the correct position</li><li>Evaluating the positions of pieces</li></ol><p>The exact internal workings of the stockfish engine will make this post long and monotonous, instead, if you are interested in the technical workings and execution of the Stockfish engine do read both of his blogs as he has explained the same in great detail.</p><h3>How was it to play against an AI Players</h3><p>Now after all that research, I had to try on Komodo for myself, so I did. I played against most of the AI bots on Chess.com and found that some of them like the initial training ones were pretty dumb. I found that the code was generated in such a way that at random intervals a certain percentage of blunders were introduced in order to give the opponent a winning chance. This was particularly helpful in boosting my confidence. Overwhelmed by 2 victories in a row I went ahead and moved it up a level analyzing not the opponent&#39;s moves but the opponent itself, I found that the more difficult the player got, the more time it took, this made me realize that even though some heuristics like king safety and pawn structure were applied most of the grunt work was done by a neural network somewhere in the background performing near impossible amount of calculations.</p><blockquote><strong>💡Fun Fact: </strong>Every chess engine has a move timer of 120 mins for first 40 moves and reducing time limit after each move after that.</blockquote><p>After a lot of chess playing, and recording my games the fastest bot to beat me was “<strong>Ding Liren” </strong>a real-life chess grandmaster and 2023 FIDE World Championship challenger, who beat me in just 5 moves 😶</p><h3>Conclusion</h3><p>In conclusion, specifically in a game like chess, where you simply cannot compute the domain of possible moves, you have to rely on many concepts that are simply encompassed in the term AI. A lot of engines use neural networks, heuristic functions, game planning, future predictions, Human analysis, some concepts of HCI, and much more concepts to give humans a feeling of playing against a real player. It also gave me a lot of perspective about the amazing things a Human Being can do without even breaking a sweat.</p><p>So go on now, relax, and play a game of chess just for the fun of it.</p><h3>References</h3><h4>Research Papers</h4><p>[1] Dhou, K., 2018. Towards a better understanding of chess players’ personalities: A study using virtual chess players. In <em>Human-Computer Interaction. Interaction Technologies: 20th International Conference, HCI International 2018, Las Vegas, NV, USA, July 15–20, 2018, Proceedings, Part III 20</em> (pp. 435–446). Springer International Publishing.<br>[2] Fenner, T., Levene, M. and Loizou, G., 2012. A discrete evolutionary model for chess players’ ratings. <em>IEEE Transactions on Computational Intelligence and AI in Games</em>, <em>4</em>(2), pp.84–93.<br>[3] Østensen, E.F., 2016. <em>A complete chess engine parallelized using lazy smp</em> (Master’s thesis).<br>[4] Suyanto Suyanto, Alifya Aisyah Ariyanto, Alifya Fatimah Ariyanto, Komodo Mlipir Algorithm, Applied Soft Computing, Volume 114, 2022, 108043, ISSN 1568–4946, <a href="https://doi.org/10.1016/j.asoc.2021.108043">https://doi.org/10.1016/j.asoc.2021.108043</a>. (<a href="https://www.sciencedirect.com/science/article/pii/S1568494621009637">https://www.sciencedirect.com/science/article/pii/S1568494621009637</a>)<br>[5] Sadler, M. and Regan, N., 2019. Game changer. <em>AlphaZero’s Groundbreaking Chess Strategies and the Promise of AI. Alkmaar. The Netherlands. New in Chess</em>.</p><h4>Blog Articles</h4><ol><li><a href="https://www.chess.com/terms/chess-engine#:~:text=Chess.com%20uses%20Komodo%20on,improvements%20in%20hardware%20and%20software.">Chess Engines</a></li><li><a href="https://stockfishchess.org/about/">StockFish About</a></li><li><a href="https://towardsdatascience.com/dissecting-stockfish-part-2-in-depth-look-at-a-chess-engine-2643cdc35c9a">Dissecting Stockfish Part 1: In-Depth Look at a Chess Engine</a></li><li><a href="https://towardsdatascience.com/dissecting-stockfish-part-2-in-depth-look-at-a-chess-engine-2643cdc35c9a">Dissecting Stockfish Part 2: In-Depth Look at a Chess Engine</a></li></ol><h3>Authors</h3><ol><li><a href="https://medium.com/u/454ffd9c1d03">Mitrajeet Golsangi</a></li><li><a href="https://medium.com/u/192cf4d61969">Pravin Harne</a></li><li><a href="https://medium.com/u/366fbf0f024">Vinay Hasani</a></li><li><a href="https://medium.com/u/93f7b385326">Abhishek Ikhar</a></li></ol><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66ddae87812c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UML Diagrams — Part III]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-iii-cf1f7896af80?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf1f7896af80</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[design-process]]></category>
            <category><![CDATA[uml-diagrams]]></category>
            <category><![CDATA[uml]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Thu, 26 May 2022 08:26:52 GMT</pubDate>
            <atom:updated>2023-04-30T10:18:10.498Z</atom:updated>
            <content:encoded><![CDATA[<h3>UML Diagrams — Part III</h3><blockquote>PS: This is a continuation of the blog <a href="https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-ii-f4b3a7497954">UML — Part II</a>. If you have not read it I highly recommend you do.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uXxSg-IrYatW2AGi" /><figcaption>Photo by <a href="https://unsplash.com/@medbadrc?utm_source=medium&amp;utm_medium=referral">Med Badr Chemmaoui</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Just to brush you up, in the first blog, we introduced ourselves with the UML diagram. We also decided on a problem statement for an activity-based diet application. Next, we created the structural diagrams for our problem statement which consisted of Class, Component and Deployment diagrams. In this post, we are going to construct the behavioural diagrams for the problem statement to test how the application would behave in different scenarios.</p><h3>Use Case Diagram</h3><p>The use case diagram is an important factor in keeping the client or stakeholder of your project in the loop with the development. One might call it a blueprint of the complete application[1]. The use case diagram simulates how the application might be used by different users, and what all can the users do inside the application.</p><p>In order to simulate the users, the diagram has a bunch of “actors” who can roleplay any type of user of the system. These actors are denoted with a stick figure. The system or application is enclosed inside a boundary and various activities are displayed inside it. The actors can interact with these activities and thus give us the flow of how the application may be used.</p><p>As always, there are some specific relations between different entities which are shown in the figure below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*AQvBhPqH13lJlRT1bWWnLw.png" /></figure><p>Now let’s move on and see how actually the use case diagram may be used on our problem statement</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*wX-yJ-uEAOZsH8CEcJdMxA.png" /></figure><p>As mentioned earlier in our problem statements the actors are roleplaying the customer and admin roles. The system is depicted by the boundary and the activities have certain communication links between each other and the actors.</p><blockquote>Do you notice something familiar about the activities present in the system? Yes, exactly they are closely correlated with the classes in the class diagram.</blockquote><p>Now, by seeing this use case diagram it is easily understandable why it is so favoured by the clients and stakeholders. Previously all the diagrams which we drew were very technical and it would take a lot of thinking to understand them for a non-technical person, but the use case diagram is in a sense easy to understand. Thus, the clients or stakeholders can give the development team input regarding the process and flow of the system.</p><h3>Activity Diagram</h3><p>This is another very important diagram for both the development team as well as the clients and stakeholders. As the name suggests the diagram displays all the activities that are going to take place inside the system.[2] This can be a very hard task to do, if not done right. So the UML gives us a bunch of rules for drawing these diagrams.</p><p>We will explore these rules in a methodological manner and in a little bit of depth as most of these rules are reused in the sequence diagram</p><h4>Objects and lifetime</h4><p>Objects in an activity diagram are the entities from which various activities are derived. For example, if the cash counter is an object, then cash collection, cash deposit, cash withdrawal, etc. may be the activities under the cash counter. An object is displayed using a rectangle as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/142/1*-bUgKT5CHXk8cR5UZJdM3w.png" /></figure><p>Notice the dotted line below the object, that is called the lifetime of the object. A lifetime is a total time for which the object exists inside the application. This means that if the bank opens at 10 am and closes at 6 pm the cash counter won’t be open till 10 pm. Thus, the lifetime of the object is from 10 am to 6 pm</p><h4>Notations</h4><p>Like all the other diagrams, the activity diagram also depicts the relationship between the other activities, thus the notations of the same are listed below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*CJnFMufSaWqSdogAHXVAKg.png" /></figure><p>So, after all, that, let’s actually move on to our problem statement and draw an activity diagram for the same</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*kCreIhsbVgvekq8KiRsDrg.png" /></figure><p>Now, you can see how easy it is for a non-technical person to see how to system may be used and suggest some changes if the system is not behaving in an expected manner. The development team can also backtrack this to the class diagram easily due to the objects and class relation and make some changes before actually starting the development of the project.</p><h3>Sequence Diagram</h3><p>This diagram is really similar to the activity diagram in many cases, but the key difference here is that it displays the sequence in which the activities are going to be performed. This is especially helpful when you have complex systems including authentication as it drastically reduces the possibility of showing a user something he is not supposed to see and other cases similar to it.</p><p>We will also see some concepts which are different from the activity diagram and the notations used here</p><h4>Object activation</h4><p>Now unlike the activity diagram, we have an object activation phase in the sequence diagram. Continuing with our cash-counter example, a cash counter has a lifetime from when the bank opens to when it closes, but this does not mean that there are continuous cash transactions going on. Thus, whenever there is a cash transaction going on we “activate” the cash counter and after the transaction is complete we “deactivate” it. This activation process is shown as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*zw-dl2wmKdjz15T4QklIqA.png" /></figure><h4>Notation</h4><p>These are the notations in the sequence diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*9eUqDj7CFVZFK0hyyN7c7g.png" /></figure><p>So the sequence diagram for our problem statement can be like follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*uFlw2PrjGNgZLeXVw8nGNA.png" /></figure><h3>Conclusion</h3><p>Finally! We have everything we need to start the development process, satisfy the client, deploy the project and profit from it. Phew 💦, that was a lot of work! Now if you are someone like me, who has not yet worked on a huge team project containing hundreds of employees, you might think this is a bit overkill. Well, in a way you are right 😅, you do not need all these steps for a small scale project as most of these things can be discussed, but imagine working on the development of a huge application, like say Google. If you do not have such solid documentation of everything, it might be impossible to keep the project on track and achieve the goal. Thus, UML diagrams are a huge part of all the software engineering process.</p><p>Anyway, if you felt some interest in this topic, this blog trilogy is not even the tip of the iceberg. There is a ton of material available online and also in the references for each of the blog posts.</p><p>Hope you enjoyed the series, stay tuned until we explore something new again 👋</p><h3>References</h3><p>[1] Gemino, A. and Parker, D., 2009. Use case diagrams in support of use case modelling: Deriving understanding from the picture. <em>Journal of Database Management (JDM)</em>, <em>20</em>(1), pp.1–24.</p><p>[2] OMG Unified Modeling Language Superstructure Specification, version 2.1.1. Document formal/2007–02–05, Object Management Group, February 2007.</p><p>[3] Files, A.N.M.C., 2013. Omg unified modelling language (omg UML). <em>Object Management Group</em>, pp.1–752.</p><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf1f7896af80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UML Diagrams — Part II]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-ii-f4b3a7497954?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b3a7497954</guid>
            <category><![CDATA[uml-diagrams]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[design-process]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[uml]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Thu, 26 May 2022 08:26:50 GMT</pubDate>
            <atom:updated>2023-04-30T10:18:36.481Z</atom:updated>
            <content:encoded><![CDATA[<h3>UML Diagrams — Part II</h3><blockquote>PS: This is a continuation of the blog <a href="https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-i-2c1e92df5f75">UML — Part I</a>. If you have not read it I highly recommend you do.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uxJ-tTX13OXNaeME" /><figcaption>Photo by <a href="https://unsplash.com/@firmbee?utm_source=medium&amp;utm_medium=referral">Firmbee.com</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Just to brush you up, in the last blog, we introduced ourselves with the UML diagram. We also decided on a problem statement for an activity-based diet application. In this post, we are going to construct all the Structural Diagrams for the same</p><h3>Class Diagram</h3><p>This diagram is an important diagram in the overall design and development process. It defines the classes required by the system. For those folks who don’t know what classes and objects are</p><blockquote>Objects are collections of operations that share a state and classes serve as templates from which objects can be created[1]</blockquote><p>I recommend you read <a href="https://towardsdatascience.com/quick-and-easy-introduction-to-object-oriented-programming-with-python-8d6167c4c8eb">this</a> blog by <a href="https://medium.com/u/3d4826ca4d12">Lucas Soares</a> before moving on forward as it might be helpful for you to understand the basics of OOPs before moving forward.</p><p>Moving on to creating our class diagram, this diagram consists of all the classes required in the application. In order to make it more organized, each class is represented as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/0*ClGZzQ24g5tH-JBr.png" /><figcaption>Image by <a href="https://www.javatpoint.com/uml-class-diagram">Javatpoint</a></figcaption></figure><p>Here the attributes and methods as we know can be of 3 types represented as <br>+ : public<br>- : private<br># : protected</p><p>Thus, for our example say we need the classes as Food, Nutrition, HealthTips, User, DailyInfo, etc. Thus the class diagram will contain all the members and methods placed inside those classes. This will also contain the relationships between the different classes. Now if you have done a bit of object-oriented programming you may know the standard inter-class relations like association, inheritance, etc. The below figure illustrates how these relations are displayed in the class diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*K6_XRkKnkTUBIB24.png" /><figcaption>Image by <a href="https://en.m.wikipedia.org/wiki/File:Uml_classes_en.svg">Wikipedia</a></figcaption></figure><p>One of the most commonly used relations is the association where two classes are correlated to each other and inheritance where one or more (child) classes inherit some properties from one or more (parent) classes</p><p>So now the class diagram for our problem statement may look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFuNoQuMzh5IcC8zwmGAEQ.png" /></figure><p>Note the different styles of arrows, here the solid filled arrow indicates that the (child) AuthInfo and (child) HealthInfo inherit from the (parent) User class. Also since Workout is a part of the overall HealthInfo we indicate it with a hollow rhombus.</p><p>This is just my impression of the system and by no means is a full and final solution to the problem. If you have any other suggestions I would love to hear them in the comments.</p><h3>Object Diagram</h3><p>Object Diagram as suggested by the name is a diagram that represents all the instances of the classes created in the class diagram.[2] The usage of this diagram is fairly limited, and it is majorly used to show examples of data structure used in the application. The latest convention of UML is UML 2.5 does not explicitly contain an object diagram but specifies just a notation for instances of the created classes.</p><p>As we are using the latest UML syntax we won’t be drawing it for our problem statement.</p><h3>Component Diagram</h3><p>The Component Diagram is an aggregation of the entire class diagram. This means that each component is a group of multiple classes or other components. This diagram is extremely useful when the given problem statement has a huge amount of classes present and it may become too crowded to draw a class diagram for the same.</p><p>A component is represented as shown in the figure below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*_tA4cVyvTduZq59H.png" /><figcaption>Image by <a href="https://www.visual-paradigm.com/guide/uml-unified-modeling-language/what-is-component-diagram/">Visual Pardigm</a></figcaption></figure><p>The squares on the side are called ports and it is the entry or exit point for data to and from the component. Similar to class diagrams these diagrams also have a certain set of relations displayed in the image below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*Iu9L5MD9Z9Ld54G0836lNw.png" /></figure><p>Thus, the component diagram for our problem statement may look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*1SfdHu_4sHTJop7BKIhNSw.png" /></figure><p>As shown in the above figure the component diagram is just the abstraction of the class diagram. This means it is more generic and has a lot fewer components than the class diagram. Take our problem statement itself, if you see the class vs component diagrams the component diagram is much more clutter-free than the class diagram. Apart from this the component diagram also helps to organize the development of the application in a more structured manner where the components can run independently of each other. This is really important, let’s understand this concept with an example</p><p>You are going on a trip in your vehicle, and suddenly you get a flat tire. 😑</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*WkJqxraiuemvRBQbFDdGrw.jpeg" /><figcaption>Image by <a href="https://www.istockphoto.com/portfolio/GulnaraUssenova?mediatype=illustration">Gulnara Ussenova</a> on <a href="http://www.istockphoto.com/">istockphoto</a></figcaption></figure><p>Now what? Do you throw away your car? No, right you might repair the puncture or in the worst case replace the tire, not the entire car. This is because the tire is a component in the entire car ecosystem and the rest of the car can function without it. Note, functioning does not necessarily mean it can achieve its goal, in our example, the car cannot travel from one location to another which is the goal of any vehicle, but the engine still functions.</p><p>Great! Let’s move on to the deployment diagram</p><h3>Deployment Diagram</h3><p>The deployment diagram is a diagram which actually shows how the system will be implemented on the hardware[4]. It consists of all the necessary components required in actually deploying the application. It is one of the most important diagrams for the deployment team, as it lists out all the required components the deployment team needs to work on.</p><p>Let’s move on to explain it further using our problem statement as an example. The deployment diagram for the same is given below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*2iTbgrNkJBREl5kQGlEFyw.png" /></figure><p>As you can see there are some familiar relations in the diagram so we won’t go much into the details about it. The new thing is the cuboid structure, this is called a node. A node is an entity that executes various systems, subsystems and processes that are related to the various components in the application.</p><p>The above diagram is relatively a basic level and good for understanding purposes, but in reality, each node has a ton of activities, processes and methods written inside which help a great deal while actually deploying the project.</p><h3>Conclusion</h3><p>Wow! If you made it this far, you really have a great learning capacity 🙇. It’s been a long post, packed with new concepts, so I will recommend you to take a problem statement of your own and practise drawing all the structural diagrams on that, so you can get a better understanding of how to create one, before moving to <a href="https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-iii-cf1f7896af80">Part 3</a>.</p><p>Anyway, now that we have the structure and deployment plan of our application ready let’s move on to the activity diagrams of the same so that we can make it as foolproof as possible.</p><p>Don’t worry take a break have a cup of tea or coffee ☕️, refresh yourself and then move on to <a href="https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-iii-cf1f7896af80">UML — Part III</a> 😄</p><h3>References</h3><p>[1] Rentsch, T., 1982. Object-oriented programming. <em>ACM Sigplan Notices</em>, <em>17</em>(9), pp.51–57.</p><p>[2] Pokkunuri, B.P., 1989. Object-oriented programming. <em>ACM Sigplan Notices</em>, <em>24</em>(11), pp.96–101.</p><p>[3] Files, A.N.M.C., 2013. Omg unified modelling language (omg UML). <em>Object Management Group</em>, pp.1–752.</p><p>[4] Bell, D., 2003. UML basics: An introduction to the Unified Modeling Language. <em>The Rational Edge</em>.</p><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b3a7497954" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UML Diagrams — Part I]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-i-2c1e92df5f75?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c1e92df5f75</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[uml]]></category>
            <category><![CDATA[uml-diagrams]]></category>
            <category><![CDATA[design-process]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Thu, 26 May 2022 08:26:48 GMT</pubDate>
            <atom:updated>2023-04-30T10:19:06.881Z</atom:updated>
            <content:encoded><![CDATA[<h3>UML Diagrams — Part I</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rhcsnV1EMHjglPsO" /><figcaption>Photo by <a href="https://unsplash.com/@halacious?utm_source=medium&amp;utm_medium=referral">Hal Gatewood</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>In this series, we will discuss in-depth all the UML diagrams, their needs and how to use them with a real-time example. In this blog, we will first learn what UML is and why to use it. We will also introduce the problem statement on which we will construct all the UML diagrams. So let’s get started !!</p><blockquote>PS: If you know the basics you can directly skip to problem statement part</blockquote><h4>What is UML?</h4><p>UML is an abbreviation for Unified Model Language. The Unified Modeling Language is a general-purpose modelling language in software engineering created to visualise the design of a system. It was developed by Rational Software in 1994–95 and is currently maintained by Object Management Group (OMG)[1]. Later, in 2005 it was accepted by the International Organization of Standardization (ISO)[2]. Currently, that is as of 2022 the latest version of UML accepted by ISO is UML 2.5.</p><h4>Why use UML?</h4><p>As the Unified Modeling Language is a general-purpose language, it is closely based on the object-oriented programming structure (OOPs). Thus, if the software is designed using UML methods, it becomes really easy to develop the software using any object-oriented programming language.[3]</p><h3>UML Diagrams</h3><h4>Types of UML Diagrams</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*gpoFNbJh6owSrYwS.png" /><figcaption>Diagram by <a href="https://expertba.wordpress.com/2017/03/03/uml-diagram-types/">Aniket Koel</a> on <a href="http://wordpress.com/">WordPress</a></figcaption></figure><p>As shown in the above figure the UML diagrams are grossly categorized into 2 major parts<br>1. Structural Diagrams<br>2. Behavioral Diagrams</p><h4>Structural Diagrams</h4><p>This category of diagrams represents the structure, implementation, and design of the entire application. These help a great deal in the development process of the same. The structural ULM diagrams act as a road map in the execution of the project.</p><p>The structural ULM diagrams contain : <br>1. Class Diagram<br>2. Object Diagram<br>3. Component Diagram<br>4. Deployment Diagram</p><h4>Behavioural Diagrams</h4><p>This category of the diagram explains the behaviour of the system and how it interacts with other entities in the environment. This acts like a walkthrough for the client as well as the development team showing them how the system will be actually used.</p><p>The behavioural UML diagrams contain :<br>1. Use Case Diagram<br>2. Activity Diagram<br>3. Sequence Diagram</p><h3>Problem Statement</h3><p>Now that we know the basics of what the topic is, let’s move on to the actual creation of the UML diagram. We will do this by taking a case study, so explaining each UML diagram will be easy to understand. Before moving on to the construction of the actual UML diagram we will first see the problem statement we want to solve.</p><blockquote>In an everyday hectic schedule, it becomes a daunting task to maintain a healthy diet without it being heavy on the pocket or it is neglected completely. Thus, the proposed system gives the users complete diet guidance according to their workout plans morphing into their daily schedule.</blockquote><p>This is the given problem statement, but to understand it a bit more, we can rephrase it as <em>“An application to give the user a complete diet plan taking into consideration the activity of the individual per week”.</em></p><p>Now in <a href="https://medium.com/@mitrajeetgolsangi/uml-diagrams-part-ii-f4b3a7497954">UML - Part II</a>, we will construct all the structural diagrams for this problem statement, and learn in detail about each one of them.</p><h3>References</h3><p>[1] Fettke, P., 2005. Unified modelling language. In <em>Encyclopedia of Information Science and Technology, First Edition</em> (pp. 2921–2928). IGI Global.</p><p>[2] ISO/IEC 19501: 2005, 2004. Information Technology — Open Distributed Processing — Unified Modeling Language (UML) Version 1.4. 2.</p><p>[3] Dennis, A., Wixom, B. and Tegarden, D., 2015. <em>Systems analysis and design: An object-oriented approach with UML</em>. John Wiley &amp; sons.</p><p>[4] Files, A.N.M.C., 2013. Omg unified modelling language (omg UML). <em>Object Management Group</em>, pp.1–752.</p><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c1e92df5f75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a live video streaming application in Flutter]]></title>
            <link>https://medium.com/dscvitpune/creating-a-live-video-streaming-application-in-flutter-43e261e3a5cc?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/43e261e3a5cc</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[video-streaming-service]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Fri, 22 Apr 2022 04:33:43 GMT</pubDate>
            <atom:updated>2023-05-03T05:46:29.647Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uKoBNJDtVOMKdwYH" /><figcaption>Photo by <a href="https://unsplash.com/@sammcghee?utm_source=medium&amp;utm_medium=referral">Sam McGhee</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So have you ever been on the streets when your country has won the World Cup? Well if not you can imagine the situation of driving through all that traffic. That is what happens when you try to create an HTTP server for streaming videos. So today I’ll be walking you through the entire process of creating a live video server to display the live video feed in a Flutter application.</p><h3>Table of Contents</h3><ul><li>Workings of video streaming</li><li>What is WebSocket</li><li>Creating a WebSocket</li><li>Image construction in Flutter</li><li>Using WebSockets in Flutter</li><li>Results and Conclusion</li><li>Project Repository</li></ul><h3>Workings of video streaming</h3><p>Video is a series of images shown fast, these images are better known as frames. Videos have a unit called Frames Per Second (FPS) to determine how many frames pass through each second. Usually, the higher the fps the smoother the video feels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*5mfc06rOIHSoYPlfpnsmuw.jpeg" /></figure><p>Thus, to transmit a camera feed from one place to another we need to read the frames and send each frame from the server to the client. Now if we do this in an unoptimized manner the server will have a lot of traffic and the final video frames will have a lot of lag. So usually the frame is read as a byte array and then encoded in some kind of format like base64 encoding before sending it to the client.</p><p>Great! Now that you know the basics of how video streaming works, we can jump to the concepts of WebSockets and why we need them.</p><h3>What is a WebSocket?</h3><h4>Basics of HTTP Protocol</h4><p>Before jumping to WebSockets we must first understand the basics of the HTTP protocol. Not going into formal definitions, the HTTP protocol is request-response-based. Meaning that unless the client <strong>requests </strong>some data the server will not <strong>respond</strong>, or in other words, the server <strong>responds </strong>to <strong>requests</strong> sent by the client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMhE9T_tuC0pUoZyWKWSnQ.png" /><figcaption>Knoldus Blogs</figcaption></figure><h4>Introduction to WebSockets</h4><p>Now WebSockets are built over this conventional HTTP protocol, thus they provide some additional benefits. Formally WebSockets are defined as</p><blockquote>A computer communications protocol, that provides full-duplex communication channels over a single TCP connection</blockquote><p>WebSockets work in a really interesting way, for initializing a connection between the client and the server both ends need to perform a handshake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*_VT1ztOTFd7RHofa8cQ6PA.gif" /></figure><p>A handshake, in this case, is exactly what it sounds like, both the client and server check and change their respective settings to match each other and once all the configurations are done a handshake denotes the final connection has been established.</p><p>Now, after a handshake is done since the connection is a full-duplex connection the server can send data to the client without it specifically requesting it and vice versa.</p><p>Now, you can imagine how easy it is to overcome our world cup problem, because now instead of you going through all that traffic the groceries are directly delivered to you with you just calling the store. Thus, WebSockets are really useful for several applications where there is live data transfer involved.</p><p>A great example of WebSockets is any form of chatting application, like WhatsApp, you receive a message from your friend directly, there is no need for you to specifically open the chat and do something to get messages.</p><p>If you know any other examples do put them in the comments for everyone.<br>OK !! Enough with the theoretical parts, let us get into the implementation of all these concepts and do some real coding. So in this tutorial, I am going to use Python to create WebSockets, but there are a lot of tools available out there for your specific needs.</p><h3>Creating a WebSocket</h3><p>Now before the creation of the WebSocket, I am assuming that you know the basics of Python, if not I highly recommend you watch this video series before moving forward</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQXeEoD0pB3E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQXeEoD0pB3E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQXeEoD0pB3E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/45f87691b69b9a06dea5ce8790974161/href">https://medium.com/media/45f87691b69b9a06dea5ce8790974161/href</a></iframe><p>Nice, now that you know the basics let’s set up the Python environment to start the WebSockets programming</p><h4>Installing Dependencies</h4><p>First, we will install the required Dependencies, we will be doing it in a virtual environment, if you don’t know what it is you can read all about it <a href="https://docs.python.org/3/tutorial/venv.html">here</a>. We are going to need 3 packages for this project</p><ol><li>websockets</li><li>asyncio</li><li>cv2 (OpenCV)</li></ol><pre>#!bin/bash<br># Run this bash sript to create and install required dependencies<br><br># Install pipenv for virtual environment<br>python -m pip install pipenv<br><br># Create virtual environment and install required packages<br>pipenv install websockets asyncio opencv-python<br><br># Activate virtual environment<br>pipenv shell</pre><p>Now as we have all the packages needed, you may have noticed a package called Asyncio, this package is used for asynchronous programming in Python, otherwise, everything in Python is synchronous by default.</p><p>If you don’t have any idea of what synchronous and asynchronous mean you should watch this video before moving forward</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdX_nZTiZRPE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdX_nZTiZRPE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdX_nZTiZRPE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e55c382b87b7f4f34bfc910aa4110a4c/href">https://medium.com/media/e55c382b87b7f4f34bfc910aa4110a4c/href</a></iframe><h4>Creating the WebSocket Server</h4><p>Now as explained in the video above we are going to use some synchronous and some asynchronous features in this application. We will start by reading the camera input using OpenCV (cv2 package) this is done using the following code. Here note that we are using the yield keyword and not the return which will give the output but not break the while loop</p><pre>import cv2<br><br>cap = cv2.VideoCapture(0)<br><br>while cap.isOpened():<br>  _, frame = cap.read()<br><br>  ## This is code useful while testing<br>  ## Show the captured video feed <br>  # cv2.imshow(&quot;Video&quot;, frame)<br><br>  # if cv2.waitKey(1) &amp; 0xFF == ord(&#39;q&#39;):<br>  #   break<br><br>  yeild frame<br><br># cv2.destroyAllWindows()<br>cap.release()</pre><p>Once the input part is set, you can check out the type of the frame variable, it comes out to be a byte array. So now we will encode that byte array into a base64 encoded string that can be done using the imencode method in OpenCV</p><pre>import cv2<br>import base64<br><br>encoded = cv2.imencode(frame)[1]<br>data = str(base64.b64encode(encoded))<br>data = data[2:len(data)-1]</pre><p>So, what’s going on here is that first the Numpy array is converted to a byte array, which is then encoded into a base64 string. Note that we explicitly converted it to a string that’s because the Python interpreter will convert it to a bytes object by default. Then we sliced that string to remove the two starting and last characters in the string. This has to be done because the Python interpreter adds “ b‘ ” at the start of a byte string and the ending quote at the end to identify it. Thus, we remove the excess material and keep only the useful material.</p><p>Now coming to the WebSocket part, now as we have our data ready we need to send that data over to the flutter application using WebSockets this is achieved using the following code</p><pre>import websockets<br>import asyncio<br><br>import cv2, base64<br><br>port = 5000<br>print(&quot;Started server on port : &quot;, port)<br><br>async def transmit(websocket, path):<br>    print(&quot;Client Connected !&quot;)<br>    try :<br>        cap = cv2.VideoCapture(0)<br><br>        while cap.isOpened():<br>            _, frame = cap.read()<br>            <br>            encoded = cv2.imencode(&#39;.jpg&#39;, frame)[1]<br><br>            data = str(base64.b64encode(encoded))<br>            data = data[2:len(data)-1]<br>            <br>            await websocket.send(data)<br>            <br>            # cv2.imshow(&quot;Transimission&quot;, frame)<br>            <br>            # if cv2.waitKey(1) &amp; 0xFF == ord(&#39;q&#39;):<br>            #     break<br>        cap.release()<br>    except websockets.connection.ConnectionClosed as e:<br>        print(&quot;Client Disconnected !&quot;)<br>        cap.release()<br>    except:<br>        print(&quot;Someting went Wrong !&quot;)<br><br>start_server = websockets.serve(transmit, port=port)<br><br>asyncio.get_event_loop().run_until_complete(start_server)<br>asyncio.get_event_loop().run_forever()<br><br>cap.release()</pre><p>Ok, so a lot is going on here, let’s break it down.</p><p>First, we have declared the variable port, this is the port on which the WebSocket will be hosted. The next is the function notice we are using the async keyword to declare the function as asynchronous. Then we started the live video capture and encoded the data into a base64 string. Now we are sending that data over to the WebSocket and we are using the await keyword, which means we are telling the function to wait until all the data is sent.</p><p>Now coming to the asyncio part, we started the server on the port declared and called the transmit function as a callback function. Then we are asyncio to run this server forever i.e. until the program has been terminated manually. Note if you plan on hosting this WebSocket you may need to do some things differently, refer to the <a href="https://websockets.readthedocs.io/en/stable/">documentation</a> for the same</p><p>Now we finally have a server that can transmit frame data to a WebSocket, now we need to create a client to render that into a real video.</p><h3>Image construction in Flutter</h3><p>Before moving to the usage of WebSockets in Flutter we need to understand how images are processed in Flutter. Flutter has a ton of inbuilt widgets which help a lot in the development of the application easily. One such widget is the Image widget, it has a lot of factory methods that can be used to render images from various sources. One such method is the memory() method which renders the byte array into an image, and with the gapless playback option, we can render multiple images as a video using it.</p><h3>Using WebSockets in Flutter</h3><p>Flutter’s open-source plugin community known as pub dev has a great plugin for integrating WebSockets in the Flutter application. The plugin goes by the name “web_socket_channel”. Thus, to install it just add the following line to your pubspec.yaml file inside your dependencies</p><blockquote>web_socket_channel: ^2.1.0</blockquote><p>That is pretty much everything you need to get the Flutter. Now we create two files called “websocket.dart” and “VideoStreaming.dart” for the handling of respective functions. The code for websockets.dart is given below</p><pre>import &#39;dart:async&#39;;<br><br>import &#39;package:web_socket_channel/web_socket_channel.dart&#39;;<br>import &#39;package:web_socket_channel/status.dart&#39; as status;<br><br>class WebSocket {<br>  // ------------------------- Members ------------------------- //<br>  late String url;<br>  WebSocketChannel? _channel;<br>  StreamController&lt;bool&gt; streamController = StreamController&lt;bool&gt;.broadcast();<br><br>  // ---------------------- Getter Setters --------------------- //<br>  String get getUrl {<br>    return url;<br>  }<br><br>  set setUrl(String url) {<br>    this.url = url;<br>  }<br><br>  Stream&lt;dynamic&gt; get stream {<br>    if (_channel != null) {<br>      return _channel!.stream;<br>    } else {<br>      throw WebSocketChannelException(&quot;The connection was not established !&quot;);<br>    }<br>  }<br><br>  // --------------------- Constructor ---------------------- //<br>  WebSocket(this.url);<br><br>  // ---------------------- Functions ----------------------- //<br><br>  /// Connects the current application to a websocket<br>  void connect() async {<br>    _channel = WebSocketChannel.connect(Uri.parse(url));<br>  }<br><br>  /// Disconnects the current application from a websocket<br>  void disconnect() {<br>    if (_channel != null) {<br>      _channel!.sink.close(status.goingAway);<br>    }<br>  }<br>}</pre><p>So basically we have created a class that contains all the methods required for handling the WebSocket functions, this class is also known as a repository. Here I have used the websocketchannel extension to connect to a WebSocket from a given URL string</p><p>This is the code for the VideoStreaming.dart file</p><pre>import &#39;dart:convert&#39;;<br>import &#39;dart:typed_data&#39;;<br><br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:videostreaming_tut/src/VideoStream/websocket.dart&#39;;<br>import &#39;package:videostreaming_tut/src/styles/styles.dart&#39;;<br><br>class VideoStream extends StatefulWidget {<br>  const VideoStream({Key? key}) : super(key: key);<br><br>  @override<br>  State&lt;VideoStream&gt; createState() =&gt; _VideoStreamState();<br>}<br><br>class _VideoStreamState extends State&lt;VideoStream&gt; {<br>  final WebSocket _socket = WebSocket(&quot;ws://&lt;your_network_ip&gt;:&lt;port&gt;&quot;);<br>  bool _isConnected = false;<br>  void connect(BuildContext context) async {<br>    _socket.connect();<br>    setState(() {<br>      _isConnected = true;<br>    });<br>  }<br><br>  void disconnect() {<br>    _socket.disconnect();<br>    setState(() {<br>      _isConnected = false;<br>    });<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: const Text(&quot;Live Video&quot;),<br>      ),<br>      body: Padding(<br>        padding: const EdgeInsets.all(20.0),<br>        child: Center(<br>          child: Column(<br>            children: [<br>              Row(<br>                mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                children: [<br>                  ElevatedButton(<br>                    onPressed: () =&gt; connect(context),<br>                    style: buttonStyle,<br>                    child: const Text(&quot;Connect&quot;),<br>                  ),<br>                  ElevatedButton(<br>                    onPressed: disconnect,<br>                    style: buttonStyle,<br>                    child: const Text(&quot;Disconnect&quot;),<br>                  ),<br>                ],<br>              ),<br>              const SizedBox(<br>                height: 50.0,<br>              ),<br>              _isConnected<br>                  ? StreamBuilder(<br>                      stream: _socket.stream,<br>                      builder: (context, snapshot) {<br>                        if (!snapshot.hasData) {<br>                          return const CircularProgressIndicator();<br>                        }<br><br>                        if (snapshot.connectionState == ConnectionState.done) {<br>                          return const Center(<br>                            child: Text(&quot;Connection Closed !&quot;),<br>                          );<br>                        }<br>                        //? Working for single frames<br>                        return Image.memory(<br>                          Uint8List.fromList(<br>                            base64Decode(<br>                              (snapshot.data.toString()),<br>                            ),<br>                          ),<br>                          gaplessPlayback: true,<br>                          excludeFromSemantics: true,<br>                        );<br>                      },<br>                    )<br>                  : const Text(&quot;Initiate Connection&quot;)<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>In the above code, the major part starts from line no 64 which makes a StreamBuilder widget. This is used to render an output when the input is a stream, meaning it will take a stream input and re-render itself when the data inside the stream changes which is the exact implementation we need. Then we make the StreamBuilder listen to the stream emitted by the WebSocket and create a builder callback accordingly. In this builder function, we have the 2 mandatory parameters, which are the BuilderContext and the AsyncSnapshot. Here snapshot is the thing which gets the data from the stream and context is used to render it to the UI. In this, we check if the snapshot has data and if the condition is satisfied we decode the base64 string into a byte array and pass that value to the Image.memory method to get a frame. This process continues until we disconnect from the WebSocket</p><h3>Results &amp; Conclusion</h3><p>So all this was fine but what we all want to see is the results right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Nc527aPcKo0uQQ38" /></figure><p>So .. drumroll please, this is the final result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_JwoFO8-w0EHsYen9A572A.gif" /></figure><p>For this blog post, I’ve read the teaser trailer for Doctor Strange but you can follow this tutorial to do pretty much any live video display you like.</p><p>So to conclude we can say that if you want to display any live video feeds on Flutter from a Python backend this is one way to do it.</p><h3>Repository</h3><p>All the above code can be found in my repository</p><p><a href="https://github.com/Mitrajeet-Golsangi/Video-Streaming-Using-WebSockets">GitHub - Mitrajeet-Golsangi/Video-Streaming-Using-WebSockets: A Live Video Streaming Application using WebSockets and Flutter SDK</a></p><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43e261e3a5cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dscvitpune/creating-a-live-video-streaming-application-in-flutter-43e261e3a5cc">Creating a live video streaming application in Flutter</a> was originally published in <a href="https://medium.com/dscvitpune">Google Developer Students Club Vishwakarma Institute of Technology, Pune</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pipelining Hazards in 8086]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/pipelining-hazards-in-8086-a876770676ea?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/a876770676ea</guid>
            <category><![CDATA[8086]]></category>
            <category><![CDATA[computer-architecture]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Tue, 04 Jan 2022 18:59:49 GMT</pubDate>
            <atom:updated>2023-04-30T10:19:46.244Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZAVuvjeBNcP9PkeG" /><figcaption>Photo by <a href="https://unsplash.com/@fr0k3?utm_source=medium&amp;utm_medium=referral">Antonin Duallia</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is Pipelining ?</h3><p>Unlike the picture above which shows an ducting pipeline today we are going to discuss about the instruction pipeline in 8086 microcontroller. The formal definition of instruction pipeline goes something like this</p><blockquote>Pipelining is the process of arrangement of hardware elements of CPU such that the overall performance is increased.</blockquote><h4>Basics</h4><p>Pipelining is a process of gathering instructions from the processor through a pipeline. This method has several advantages like storing and executing instructions in a systematic manner. You might come across other content out there which talks about pipeline processing, that’s another name for pipelining. Now pipelining is a technique which allows the microcontroller to run multiple instructions at the same time.</p><p>This does sound too good to be true, doesn’t it? Well it kind of is, because when there are so many features there tend to be some hazards that creep their way along. Fortunately for us, there are plenty of ways of dealing with these hazards, which we are going to discuss further on this blog.</p><p>Now before moving to the actual hazards in pipelining if you are new to the complete pipelining process we highly recommend to watch this video before moving any further.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fth2wcy0zJ-o%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dth2wcy0zJ-o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fth2wcy0zJ-o%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bab955d99deec36bee6f9477709098bf/href">https://medium.com/media/bab955d99deec36bee6f9477709098bf/href</a></iframe><h3>Hazards in Pipelining</h3><p>Now assuming you know the basics of pipelining lets talk about the hazards in pipelining, their causes, types and how to solve them.</p><h4>Why are hazards caused ?</h4><p>There is a lot going on in a pipeline. One instruction is in the fetch state one in decode and another in operand state. There is bound to be something which has to go wrong if the instructions are not managed well. Many different combinations of instructions could result in unanticipated hazards. It becomes quite a cumbersome task to resolve these hazards as the complexity and depth of the pipeline increase.</p><p>Lets take an example for better understanding. Lets say you and you friend are standing on two extremes of a building. Both of you create the pipeline. Now the pattern is you call the name of your friend, after he listens his name he shouts out your name, and the process continues. Now a person living on the middle floor shouts at the same time your friend shouts (this can be another instruction further down the pipeline) so you just hear “SHUT UP!” but not your name, now both you and your friend are trying to listen to your respective names but nothing is happening and the guy on the middle floor is happy, this is a hazard in the pipelining</p><p>So the formal definition of a pipelining hazards can be given as</p><blockquote>A situation where the instruction cannot proceed through the pipeline as it should is known as a hazard in the pipeline.</blockquote><h4>Types of Hazards</h4><p>There are mainly 3 types of hazards bugging the computer engineers for years now</p><ol><li>Data Hazards</li><li>Branch Hazards</li><li>Structural Hazards</li></ol><h4>Data Hazards</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XcUQAEDr70WpUddY" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The above example illustrates a data hazard. The hazards that arise most commonly in pipeline processors are data hazards. Forwarding and stalling are viable options for resolving these issues. However, as the number of instructions grows, the difficulty of detecting risks grows dramatically. Many different combinations of instructions could result in unanticipated hazards in this situation. To ensure that all danger combinations are considered, completeness detection of data hazards is required. A data hazard can develop in one of three circumstances:</p><ol><li><strong>Read After Write (RAW) — True Dependency</strong><br>A RAW data hazard occurs when an instruction refers to a computed or retrieved result that has not yet been calculated or retrieved. This can happen because the previous instruction has only been processed partially through the pipeline.</li><li><strong>Write After Read (WAR) — Anti-Dependency<br></strong>A data hazard caused by write after read (WAR) indicates a difficulty with concurrent execution.</li><li><strong>Write After Write (WAW) — Output Dependency<br></strong>In a concurrent execution environment, a write after write (WAW) data hazard might occur.</li></ol><h4>Branch Hazards</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ka_tW5TO3NJxR1Kb" /><figcaption>Photo by <a href="https://unsplash.com/@herrherrmann?utm_source=medium&amp;utm_medium=referral">Sebastian Herrmann</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Branch Hazards are also known as control hazards. Control hazard occurs when the pipeline makes inaccurate branch prediction decisions, resulting in instructions that must be discarded entering the pipeline.</p><h4>Structural Hazards</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PCxMEgitnpp6zgrs" /><figcaption>Photo by <a href="https://unsplash.com/@rgaleria?utm_source=medium&amp;utm_medium=referral">Ricardo Gomez Angel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When two (or more) instructions in the pipeline require the same resource, a structural hazard occurs. As a result, for a portion of the pipeline, instructions must be performed in series rather than parallel. Occasionally, structural dangers are referred to as resource hazards.</p><h3>Handling Hazards</h3><p>Now as these problems have been around forever we have developed solutions to these some of these hazards, which we will be discussing below</p><h4>Handling Data Hazards</h4><ol><li><strong>Forwarding : </strong>It modifies the pipeline with specific circuitry. This method works because the required values take less time to go via a wire than a pipeline segment does to compute its result.</li><li><strong>Code Reordering : </strong>To reorganize code, we’ll need specialized software. This type of software is known as a hardware-dependent compiler.</li><li><strong>Stall Insertion : </strong><em>A stall is a cycle in the pipeline without new input.</em> It adds one or more install (no-op instructions) to the pipeline, delaying execution of the present instruction until the required operand is written to the register file; however, this strategy reduces pipeline efficiency and throughput.</li></ol><h4>Handling Branch Hazards</h4><ol><li><strong>Freeze / Flush :</strong> The simplest way to deal with branches is to freeze or flush the pipeline, holding or removing all instructions that follow the branch until the destination is determined</li><li><strong>Not Taken Method : </strong>Treating every branch as not taken, and simply allowing the hardware to proceed as if the branch had not been executed, is a higher-performance and just slightly more complex technique. The intricacy of this method stems from the need to understand when an instruction might affect the state and how to “back out” such a change.</li><li><strong>Already Taken Method : </strong>Another option is to consider each branch as if it were already taken. We assume the branch is taken and begin fetching and executing at the target address as soon as the branch is decoded and the target address is computed.</li><li><strong>Branch Prediction : </strong>We can use branch prediction to make reasonable predictions about which instructions to insert, and a pipeline bubble will only be required if the forecast is erroneous.</li></ol><h4>Handling Structural Hazards</h4><ol><li><strong>Stall Insertion : </strong>As mentioned earlier the most effective way to get rid of structural hazards is to insert a stall cycle or pipelining bubble</li><li><strong>Pipelining of resources : </strong>Usage of separate cache memory, dividing reading from and writing to register into the clock cycle, etc.</li></ol><h3>Conclusion</h3><p>The usage of instruction pipelining completely revolutionized the microcontroller world, but it came with its dangers or hazards. After applying various logics for theses problems some solid solutions have been developed to remove theses hazards from the pipeline and as a computer scientist you must know their meaning, causes and solutions which were discussed in this blog.</p><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a876770676ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing a Research Paper as a Student]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/writing-a-research-paper-as-a-student-5e7cee61bee9?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e7cee61bee9</guid>
            <category><![CDATA[ieee]]></category>
            <category><![CDATA[research-paper-writing]]></category>
            <category><![CDATA[latex]]></category>
            <category><![CDATA[students]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Sun, 02 Jan 2022 17:19:09 GMT</pubDate>
            <atom:updated>2023-04-30T10:20:03.017Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eRTfusm06BFBcl43" /><figcaption>Photo by <a href="https://unsplash.com/@impatrickt?utm_source=medium&amp;utm_medium=referral">Patrick Tomasso</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>I know that there are various blogs on how to write research papers out there, but this one is focused on students trying to write the research papers and includes some of my own experiences regarding the same.</p><p>As a B. Tech. student me and my group members are writing a research papers for the projects we are working on. Its been a new experience and certainly a much more difficult one than just referring to an article or watching a video. So I felt I should share all the problems faced by us, so its a little easier on you to create a research paper for your projects.</p><h3>Initial Steps</h3><h4>Research</h4><p>The first and foremost thing you need to do is to decide the topic of your project and find related research papers. The citations are a huge part of creating your own research paper as your project concept is most likely implemented by someone, this has two major benefits</p><ol><li>You can get new ideas by viewing the limitations or future scope of the other research papers</li><li>Any content duplication issue is sorted after citation of the paper</li></ol><p>You can find a great deal of research papers on <a href="https://scholar.google.com/">Google Scholar</a>. I personally found it was best as it does not restrict the search to any specific journal and has many open access papers. Even the filters in Google Scholar are good for quick searches</p><blockquote>PS : Citation is just like giving credit to the author(s) of the other research papers for their research on the basis of which you are implementing your project and is taken as a vital step in creation of a research paper as it shows your research in the field.</blockquote><h4>How to find correct citations ?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J9nTReCjts93eMBn" /><figcaption>Photo by <a href="https://www.pexels.com/@enginakyurt?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Engin Akyurt</a> from <a href="https://www.pexels.com/photo/selective-focus-photography-of-brown-wooden-book-shelf-2952871/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>Now that you know what citations are the question arises which citations to use? The answer is quite simple actually, all those papers which you feel are related to your project are citations. Even if you are using a reference from a reference paper that needs to come in your paper.</p><p>As a thumb rule it is taken that 10 citations are a good number to start and more the merrier.</p><h4>Implementation of Project</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UPRPFZUlT_A1NvTe" /><figcaption>Photo by <a href="https://www.pexels.com/@alexander-dummer-37646?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Alexander Dummer</a> from <a href="https://www.pexels.com/photo/person-using-appliance-132700/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>After or as you are studying about your topic you can finalize the features of your project and take an approval of the same from your teachers. Here you must consider all the factors like your exams, submissions, timeline, etc. before deciding the final features in the topic. After seeing many papers you may be encouraged to bite more than you can chew. So keep a keen eye on these factors. After you have finalized your topics you can start the actual implementation of the project.</p><h3>Creation of Paper</h3><p>In ideal conditions you should create a document which keeps a detailed log of the progress of the project and then create your paper based on that. But if you are working individually or in a fairly small group (3–6 members) you can directly create the paper as the progress tracking is easy, but if you have a group bigger than that or have a big project to implement I highly suggest to create a log.</p><p>Now there are different formats for different journals but I will talk about the IEEE format for the purpose of this post. This is because the format is well known and accepted by most of the journals. Even most of the colleges promote the IEEE format papers.</p><h4>Sections</h4><p>A well structured research paper must consist of the following sections</p><ol><li>Abstract</li><li>Introduction</li><li>Literature Survey</li><li>Methodology</li><li>Working (optional)</li><li>Conclusion</li><li>References</li></ol><p>I am not going to go in too much detail about the content of these sections, but if you are interested this video series explains them really well.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPLfHF1gQx_tdBAYtOTbd_cYt6BxX0MM4jv&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fplaylist%3Flist%3DPLfHF1gQx_tdBAYtOTbd_cYt6BxX0MM4jv&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fe5mrTpK2k1U%2Fhqdefault.jpg%3Fsqp%3D-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ%3D%3D%26rs%3DAOn4CLBCSvPfvA9ZbbAtZmrbQh0eBDgbPA%26days_since_epoch%3D18994&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="853" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0c950eaf76c374b374bd72675737305/href">https://medium.com/media/b0c950eaf76c374b374bd72675737305/href</a></iframe><h4>Appearance</h4><p>With that in mind the next step is your paper formatting. Usually the journals or conferences have really strict rules about the paper format and can be really problematic to replicate sometimes, which I learned the hard way. But luckily almost all the journals have a template for their papers. This is the link for getting the IEEE template</p><p><a href="https://www.ieee.org/conferences/publishing/templates.html">Manuscript Templates for Conference Proceedings</a></p><p>The templates are of two types</p><ol><li>Microsoft Word</li><li>LaTeX</li></ol><h4>What is LaTeX ?</h4><blockquote>LaTeX is a high-quality typesetting system</blockquote><p>LaTeX is one of the most popular languages to create all types of PDF documents as it is easy to use and has a large amount of typesetting benefits. I prefer using LaTeX over MS Word as I being a Computer Science Student prefer coding, but at the end of the day it is your choice and comfort that matters.</p><p>I will write another post for the basics of LaTeX and the advantages and disadvantages specifically for research or conference papers.</p><h4>Checking Plagiarism</h4><p>Plagiarism is one of the most hardest thing about a research paper. Basically plagiarism is using someone&#39;s work without giving him/her credit, or in research paper terms, without citing him/her. This can be checked using multiple online tools and is also check when your paper is sent for publication.</p><blockquote>PS : <strong><em>Do Not</em></strong><em> </em>skip this step. If you plan on publishing a research paper you must ensure it’s plagiarism percentage is less than 10%. If this is not the case your paper will be rejected from the publication and even you might get blacklisted from the publication for a year if this happens 2 — 3 times. As this is someone else’s work it might even have legal consequences which could be bad.</blockquote><h3>Publishing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XznwSkNDNTm00tLF" /><figcaption>Photo by <a href="https://www.pexels.com/@viktortalashuk?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Viktor Talashuk</a> from <a href="https://www.pexels.com/photo/books-with-folded-pages-2377295/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>After all the above hard work once your paper is complete the last step is to finally publish your paper in the journal of your choice. The procedure is fairly straightforward for IEEE journal and even simpler for some other journals. But before jumping to the procedure let’s know which journals to choose for your paper.</p><h4>Choosing the Journal</h4><p>There are numerous journals out there which are waiting for someone to approach them and publish their paper, but as a student if you want to make some impact of this paper on your resume you must find a journal which is either</p><ol><li>UGC (University Grant Commission) Certified</li><li>Scopus Indexed</li></ol><p>Any journal that is UGC certified is recognized by the Government of India and Scopus indexed journals are internationally recognized. Now the choice is yours, as a general trend the UGC certified journals tend to price less for paper publication as compared to the international journals, but the difference in pricing is minimum and cannot be determined as a deciding factor.</p><h4>Steps for Publishing</h4><p>Now for the steps for publishing your paper in IEEE journal are</p><ol><li><strong>Search for conferences on IEEEXplore.<br></strong>There are several conferences which are taking place each year which are conducted by IEEE or are sponsored by IEEE and each of them have their own topics. So check for the conference which has the most suitable topic for your project paper. You can check this <a href="https://www.ieee.org/conferences/index.html">here</a>.<br>After finding the required conference you can check their official website and deadline for paper submission. If the deadline is not over you can then submit your paper online to the respective conference.</li><li><strong>Sit Back<br></strong>After you submit your paper there isn’t much you can do. You have to be patient, you will receive an acceptance email, if your paper is accepted, in the given timeframe which can range from 2 days to several months, this is specified in the conference at the time of selection.</li><li><strong>See it in IEEEXplore<br></strong>After your paper gets published you will be able to see it in IEEEXplore minimum after a month or even more.</li></ol><p>That’s it. If you do all this and get selected you will have successfully published your research paper as a student and it will remain on your name forever, or 30 years at the very least</p><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e7cee61bee9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Abstract Classes and Interfaces in Java]]></title>
            <link>https://medium.com/@mitrajeetgolsangi/abstract-classes-and-interfaces-in-java-858ae0d2299c?source=rss-454ffd9c1d03------2</link>
            <guid isPermaLink="false">https://medium.com/p/858ae0d2299c</guid>
            <category><![CDATA[abstract-class]]></category>
            <category><![CDATA[abstract-class-in-java]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[abstraction]]></category>
            <dc:creator><![CDATA[Mitrajeet Golsangi]]></dc:creator>
            <pubDate>Thu, 16 Dec 2021 17:27:35 GMT</pubDate>
            <atom:updated>2023-04-30T10:20:23.594Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y3221npSD9WXwoZDVfH1Jw.jpeg" /></figure><h3>Contents</h3><ol><li>What is Object Oriented Programming ?</li><li>What is Abstraction ?</li><li>Abstract Classes in Java</li><li>Interfaces in Java</li></ol><h3>What is Object Oriented Programming ?</h3><p>Before jumping to abstraction, we must understand that Java is an Object Oriented Programming Language. This means that all the physical entities (objects) in Java have a common set of properties derived from their respective parents (class). If you don’t know what OOPs is we recommend watching this video for better understanding</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7GwptabrYyk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7GwptabrYyk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7GwptabrYyk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f4b870654f323eb2e09578c903d69aa/href">https://medium.com/media/8f4b870654f323eb2e09578c903d69aa/href</a></iframe><h3>What is Abstraction ?</h3><h4>Abstraction in Java</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*yFyv8vMJZ5aA9ip9J-4qIQ.png" /></figure><p>The property of data abstraction is that just the most important details are displayed to the user. The user is not presented with non-essential units. This basically means that the user does not exactly know the internal processes of the system are hidden from the user. The formal Definition of abstraction is given as follows:</p><blockquote>The practice of identifying only the required attributes of an object while discarding the irrelevant information is known as data abstraction.</blockquote><h3>Abstract Classes in Java</h3><p>In Java, an abstract class is a superclass that can’t be instantiated and is used to declare or specify general properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EIc3kGFTbjZIN14B" /></figure><p>The sole distinction between abstract and regular Java classes is that abstract classes use the abstract keyword, whereas regular Java classes do not. To declare a class abstract, we use the `abstract` keyword before its name. In a class declaration, use the abstract keyword to indicate that a class is only intended to be a base class for other classes. A quick declaration of an abstract class in java looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/066416c3c581bf7bdd95f279aa93296c/href">https://medium.com/media/066416c3c581bf7bdd95f279aa93296c/href</a></iframe><p>It’s important to understand that we can’t create the object of an abstract class. Because:</p><ol><li>By default, an abstract class has a protected function Object that can be used to initialize it by derived types.</li><li>We cannot create an instance of an abstract class because it does not have a complete implementation.</li></ol><p>There are both abstract and concrete methods in an abstract class. We must inherit from the base class if we wish to use an abstract class.</p><h4>Key Features of Abstract Classes</h4><ul><li>The abstract keyword must be used when declaring an abstract class.</li><li>There are both abstract and non-abstract methods that can be used.</li><li>It isn’t possible to instantiate it.</li><li>It may also include constructors and static methods.</li><li>It can have final methods, which prevent the subclass from changing the method’s body.</li></ul><h4>Abstract Methods</h4><p>Abstract classes contain abstract methods. Abstract methods are ones that don’t need to be implemented in order to be declared. These methods lack a body, implying that they are not implemented.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fc29a6cfb37c082d837cb1c6ff66a2a/href">https://medium.com/media/5fc29a6cfb37c082d837cb1c6ff66a2a/href</a></iframe><p>Some key features of the abstract Methods:</p><ul><li>Abstract methods do not have a body (implementation), only a method signature</li><li>If a class has an abstract method, the class should be designated abstract; however, the opposite is not true.</li><li>An abstract method will contain a semicolon (;) at the end instead of curly braces.</li></ul><h4>Examples</h4><p>Let’s understand the above concepts with some examples</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e9b3cc515d11a2701d157f7ab28a70a/href">https://medium.com/media/9e9b3cc515d11a2701d157f7ab28a70a/href</a></iframe><p>In the above example, the abstract class ‘<em>Demo</em>’ has one abstract method and one regular method. After that, the child class ‘<em>AbstractClass</em>’ is extended from the parent class <em>Demo</em>. The child class implements ‘<em>myMethod’, </em>meaning gives it a body. After that in the main method we created the object of type <em>AbstractClass, a</em>nd call both methods.</p><h3>Advantages of Abstract Classes</h3><h4>Code Readability</h4><p>It simplifies the process of reading the code as the developer has a handbook of all the methods used in the child classes.</p><h4>Code Reusability</h4><p>Reduces duplication of code and improves reusability. Which means of used properly the code length can be significantly reduced in large applications.</p><h4>Increases Security</h4><p>Only important details are shown to the user, which helps to increase the security of an application or software, as said in definition.</p><h3>Disadvantages of Abstract Classes</h3><h4>Loss of Speed</h4><p>In order to build an abstraction, the implementing code must deal with circumstances, and conditions that aren’t always required in many scenarios. This makes code that uses abstractions often slower than code that implements the operation directly without using the abstraction.</p><h4>Size of application</h4><p>This is no longer a serious issue on bigger systems, but it can be a significant issue in small devices or confined locations. The additional code required to fully implement an abstraction increases the code length and, as a result, the application size. If the code isn’t written correctly, it can wind up occupying a huge amount extra space, resulting in overly large runtime executables and, as a result, increasing the device’s cost.</p><h3>Interfaces in Java</h3><h4>What are Interfaces ?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*Cl2BKnIxut2tPIZq" /></figure><p>The term Interfaces means <em>a point where two entities or systems meet and interact</em>. This same concept is extended in the computers where an interface allows the user or another program to interact with the computer.</p><h3>Interfaces in Java</h3><p>Now that you know what an interface means, let’s begin to understand the concept of Interfaces in Java.</p><p>We all know that objects of one parent class all share the same properties, but what to do if some classes want to have some common members ? Inheritance, right ? Well, yes in some cases but also no. Let’s take an example, we all know that coal and graphite are black in color, but it would not make sense to have a parent class Black for them both, instead it would make much more sense to have their parent class as Carbon and make them both implement an interface Black.</p><p>Now that we understand the concept the actual definition of an Interface in Java is as follows.</p><blockquote>Interfaces are the blueprints for creation of classes</blockquote><p>Interfaces in Java pose the role of defining all the required methods and constants in the same place.</p><p>This helps to achieve the abstraction mechanism in the program, which is just a fancy way of saying that the end user is not shown the inner workings of the code.</p><p>Knowing both interfaces and abstract classes’ definition now, we can safely say that interfaces can be used instead of abstract classes for an increased security as interfaces hide certain details and only important details can be visible.</p><h4>Interface Members</h4><p>As an Interface is just a blueprint of a class it can only contain a specific set of members in it which are:</p><ol><li><em>final static</em> variables</li><li><em>public final static </em>methods</li><li><em>public abstract</em> methods</li></ol><h4>Rules when Defining an Interface</h4><p>There are some predefined rules in interfaces and a programmer must know these before working with interfaces</p><ol><li>Interfaces cannot be instantiated, but can have a reference.</li><li>Interfaces cannot have any form of method definitions and all methods in an interface are <em>public </em>and <em>abstract </em>by default</li><li>Interfaces can only have <em>final static</em> variables as interfaces cannot be instantiated.</li><li>Interfaces may have <em>final static</em> methods with a method body.</li><li>Interfaces cannot contain instances or static blocks. Thus, any static variables in an interface must be assigned a value immediately after declaration</li></ol><h3>Usage</h3><p>Now, enough on the theory. Let’s get our hands dirty and see how to use an Interface in Java.</p><h4>Defining and Interface</h4><p>Interfaces in Java are defined using the <em>interface </em>keyword</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/492d5434b596f500f2bd627ec8ab4270/href">https://medium.com/media/492d5434b596f500f2bd627ec8ab4270/href</a></iframe><h4>Implementing and Interface</h4><p>Now that the interface has been defined some class has to use the interface and implement the methods written in it. This is done using the <em>implements </em>keyword.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09f106be386c8e4eada44fa88db93626/href">https://medium.com/media/09f106be386c8e4eada44fa88db93626/href</a></iframe><h4><strong>Interfaces with Anonymous classes</strong></h4><p>Remember in the Rules section the 1st rule is that the interfaces cannot be instantiated? Well sometimes it becomes too tedious to write a class just to implement an interface just once. Thus, a work around can be abstract classes.</p><p>Before moving any further if you don’t know the concept of abstract classes in Java we highly recommend to watch this video and then continue forward.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTIPnQe2-iPE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTIPnQe2-iPE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTIPnQe2-iPE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8dce76278b754d91a7e6d6daf043bc1/href">https://medium.com/media/f8dce76278b754d91a7e6d6daf043bc1/href</a></iframe><p>Moving on, an abstract class or a nameless class can be used to in a way instantiate the interface without actually needing to create a complete class for it. An example would be nice, wouldn’t it ? Well here you go</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e834d58013385ee419df7d2f515efdd3/href">https://medium.com/media/e834d58013385ee419df7d2f515efdd3/href</a></iframe><p>In the above example we have the interface <em>I </em>which is implemented by the class <em>C. </em>Now we have two options, one is to make an entire class just to implement a method which will be called only once and make the codebase huge or two to create an anonymous class. In the above example we have instantiated the ‘<em>absObj ’</em>with an anonymous class and it looks really good 😍</p><h3><strong>Advantages of using an Interface</strong></h3><p>Now that majority of the interface concepts are covered you might be asking yourself the question why use these instead of abstract classes or simple parent classes. Well here’s why</p><h4><strong>Supports Multiple Inheritance</strong></h4><p>Java by default does not support the concept of multiple inheritance. But this can be achieved by the usage of interfaces. An Example would be</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3178d598286facac0347de186bf8b4c2/href">https://medium.com/media/3178d598286facac0347de186bf8b4c2/href</a></iframe><p>Take a note that here class C is implementing both the interfaces I1 and I2 meaning it can implement methods defined in both of them.</p><h4><strong>Memory Efficient</strong></h4><p>As interfaces do not support object creation and so do not contain the method definitions they are considerably less bulky than any super class which the child classes extend.</p><h4><strong>Loosely coupled application</strong></h4><p>This means that the application classes are independent of each other. This in a manner of speaking is another form of abstraction, because the other classes can only see what the interface allows them to.</p><h3>References</h3><p>Theses were some of the really great blogs which helped us create this post. If you were intrigued by the above content we highly recommend you to read them</p><ol><li><a href="https://www.javatpoint.com/interface-in-java">Javatpoint</a></li><li><a href="https://www.geeksforgeeks.org/interfaces-in-java/">GeeksForGeeks</a></li></ol><p>Find my writings interesting you can find my other articles <a href="https://www.mitrajeetgolsangi.com/blogs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=858ae0d2299c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>