<?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 Tony Kim on Medium]]></title>
        <description><![CDATA[Stories by Tony Kim on Medium]]></description>
        <link>https://medium.com/@hjkmines?source=rss-6f8713fd2626------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*POWbUQv_L7iMnuND.jpg</url>
            <title>Stories by Tony Kim on Medium</title>
            <link>https://medium.com/@hjkmines?source=rss-6f8713fd2626------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 12:50:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hjkmines/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[JavaScript Design and Architectural Patterns]]></title>
            <link>https://medium.com/@hjkmines/javascript-design-and-architectural-patterns-cfa900c6fe41?source=rss-6f8713fd2626------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfa900c6fe41</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[architectural-design]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Tony Kim]]></dc:creator>
            <pubDate>Sat, 05 Sep 2020 05:08:29 GMT</pubDate>
            <atom:updated>2020-09-05T05:08:29.707Z</atom:updated>
            <content:encoded><![CDATA[<p>September 4th, 2020</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zwx8DmnVHZcESoQx2pF14w.png" /></figure><p>One of the most important skills in software engineering is writing clean and efficient code. This can be achieved in many ways such as through functional components, utilizing existing modules, and avoiding redundant code. Digging deeper, great software engineers follow these conventions through proven design and architecture patterns.</p><p>So what are design and architecture patterns?</p><p><strong><em>Design patterns</em></strong> are like “recipes” to guide you on how you should structure your code base. Following a design pattern allows you to organize your code, reduce bugs, and allow other engineers to easily follow your work.</p><p><strong><em>Architectural patterns</em></strong> are relatively similar to design patterns except it focuses on the broader scope of finding reusable solutions to commonly occurring problems in software design.</p><p>In this article, I will go over some common design and architecture patterns every software engineer should be familiar with.</p><h3><strong>Design Patterns</strong></h3><p>Before diving into the different examples of commonly used design patterns, I would like to go over the three categories of design patterns that exists:</p><ol><li><strong>Creational: </strong>This category focuses on object creation mechanisms which optimize object creation and control object creation. <br><strong>Examples: </strong>Factory, Builder, Singleton, Abstract, and Prototype</li><li><strong>Structural: </strong>This category focuses on object relationships. They ensure that if one part of a system changes, the entire system doesn’t need to change along with it. <br><strong>Examples: </strong>Adapter, Decorator, Composite, and Bridge</li><li><strong>Behavioral: </strong>This category recognize, implement, and improve communication between disparate objects in a system. They ensure disparate parts of a system have synchronized information. <br><strong>Examples: </strong>Command, Momento, and Observer</li></ol><h3><strong>Creational Design Patterns:</strong></h3><ol><li><strong>Factory Pattern: </strong>One of the most commonly used creational patterns that is easy to use and learn. Does not explicitly require us to use a constructor. This pattern provides a generic layout for creating objects, where we can specify the type of factory object we wish to be created.</li></ol><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*vTxc3HmXH4Th8-Tuna4xmA.png" /><figcaption>Factory Pattern</figcaption></figure><p>2. <strong>Singleton Pattern: </strong>This is a pattern that allows a class to hold a method which creates a new instance of the class if one doesn’t exist. If the instance does exist, it returns a reference to that object.</p><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*a-lKbpI50QJ_piLOFrr4jQ.png" /><figcaption>Singleton Pattern</figcaption></figure><p>3. <strong>Prototype Pattern: </strong>This pattern creates objects based on a template of an existing object through cloning.</p><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*yQUhRaL1jv-7DL7KT5Ms6Q.png" /><figcaption>Prototype Pattern</figcaption></figure><p>4<strong>. Constructor Pattern:</strong> Initialize an object with some set of default and/or sent-in values.</p><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*5u4MbUQPBXf1LPFCsqYpVg.png" /><figcaption>Constructor Pattern</figcaption></figure><h3><strong>Structural Design Patterns</strong></h3><ol><li><strong>Adapter Pattern: </strong>This pattern allows objects/classes to function together which normally couldn’t due to their incompatibility. The adapter translates calls to its interface into calls to the original interface and the code required.</li></ol><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*etRvLX0JHHD3dyelvO8BVg.png" /><figcaption>Part 1 of Adapter Pattern</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*gHyzwJEdmq1CDiD-it5_TQ.png" /><figcaption>Part 2 of Adapter Pattern</figcaption></figure><p>2. <strong>Decorator Pattern: </strong>This pattern has the ability to add behavior to existing classes in a system dynamically. Using this pattern allows code reusability.</p><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*IYz7rKxd8BQ1rcHjhYvM0Q.png" /><figcaption>Part 1 of Decorator Pattern</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*_kDLLl1-zH_VeAmiW6aDQA.png" /><figcaption>Part 2 of Decorator Pattern</figcaption></figure><h3>Behavioral Design Patterns</h3><ol><li><strong>Command Pattern: </strong>This pattern encapsulates method invocation, requests, or operations into a single object and gives us the ability to both parameterize and pass method calls around that can be executed at our discretion. Another feature of this pattern is that it allows us to decouple objects invoking the action from the objects which integrate them.</li></ol><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*kr5cyWWB5EQIcK3CFEh0NA.png" /><figcaption>Command Pattern</figcaption></figure><p>2. <strong>Observer Pattern: </strong>This pattern allows an object (also known as the “subject”) to maintain a list of other objects depending on it (also known as the “observers”), automatically notifying them of any changes to the state.</p><p>Code Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*rnEk9OZlnQWkcYHTkaLz5g.png" /><figcaption>Observer Pattern</figcaption></figure><h3><strong>Architecture Patterns</strong></h3><p>In this section, I will be discussing the most commonly used architecture patterns:</p><ul><li><strong><em>Model-View-Controller (MVC)</em></strong></li><li><strong><em>Model-View-Presenter (MVP)</em></strong></li><li><strong><em>Monolithic</em></strong></li><li><strong><em>Micro-service</em></strong></li></ul><ol><li><strong>Model-View-Controller (MVC): </strong>This is a very commonly used pattern used by many frameworks such as Rails and Node.js/Express.js. It is a pattern that separates the concerns of applications into three logical components.</li></ol><ul><li><strong>Model: </strong>This component is responsible for all data-related logic that the users work with. The model structures how the data should be organized, as well as sets the rules and methods for storing and accessing it.</li><li><strong>Views: </strong>This component is responsible for managing the presentation of the data. Another way of thinking about this is that it presents the UI logic of the application.</li><li><strong>Controller: </strong>This component is responsible for communicating between the Model and View components.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*MT94l0A_PLUXKpCC7DIxnA.png" /><figcaption>MVC Pattern</figcaption></figure><p><strong>2. Model-View-Presenter (MVP): </strong>Derived from the MVC model, it is primarily used to build user interfaces by separating the presentation layer from the logic. In MVP, the Presenter component is the “middle-man”.</p><ul><li><strong>Model: </strong>This component is responsible for all data-related logic that the users work with. The model structures how the data should be organized, as well as sets the rules and methods for storing and accessing it.</li><li><strong>View: </strong>Compared to the View in the MVC model, in MVP, the view is more loosely coupled to the model. In detail, the presenter is in charge for binding the model to the view.</li><li><strong>Presenter: </strong>This component contains all the UI business logic for the view. Any invocations that happen from the View are directly handled by the Presenter. The Presenter is decoupled from the View and communicates to it through a interface.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*cl4Grp5d3GTgvMx4eEU6FQ.png" /><figcaption>MVP Pattern</figcaption></figure><p><strong>3. Monolithic Architecture: </strong>This architecture means that your app or project code base is written in a “central” location or one cohesive unit of code. All the components are designed to work together in which they all share memory space and resources.</p><p><strong><em>Advantages:</em></strong></p><ul><li>Allows Cross-Cutting Concerns: logging, rate limiting, and security features (audit trails and DOS protection).</li><li>Easy to hook up components.</li><li>Has performance advantages since shared memory access is faster.</li></ul><p><strong><em>Disadvantages:</em></strong></p><ul><li>Tend to get tightly coupled and entangled when application size expands. This makes it difficult to isolate services when scaling.</li><li>Difficult to understand since there a lot of dependencies and side-effects.</li></ul><p><strong>4. Microservice Architecture: </strong>This architecture means that your app or project code base is written in separate components. The code base is made up of smaller, independent applications that are able to have their own memory space and can scale independently.</p><p><strong><em>Advantages:</em></strong></p><ul><li>Highly organized since each microservice has a specific purpose. Each component is not concerned of other duties outside its environment.</li><li>Decoupled services are easier to recompose and reconfigure. This allows flexibility to serve many different applications such as serving web clients and API.</li></ul><p><strong><em>Disadvantages:</em></strong></p><ul><li>Going to run into cross-cutting concerns during development.</li><li>Need to incur the overhead of the independent modules for each cross-cutting concern. Another option to resolve this issue is by encapsulating cross-cutting concerns in another service environment.</li></ul><p>If you are interested in learning more software design and architectural patterns, please check out my GitHub repository: <a href="https://github.com/hjkmines/algorithms-datastructure-challenges">https://github.com/hjkmines/algorithms-datastructure-challenges</a></p><p>If you would like to learn more about my experience and projects I have completed, please view my LinkedIn, portfolio website, and/or GitHub profile:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/hyung-kim/">https://www.linkedin.com/in/hyung-kim/</a></p><p>Portfolio Website: <a href="https://hjkmines.github.io/my-portfolio-website/">https://hjkmines.github.io/my-portfolio-website/</a></p><p>GitHub: <a href="https://github.com/hjkmines">https://github.com/hjkmines</a></p><p>Please feel free to reach out to me for any questions or inquires through my email: hjkmines@gmail.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfa900c6fe41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Fundamentals to know before jumping into a front-end framework]]></title>
            <link>https://medium.com/@hjkmines/javascript-fundamentals-to-know-before-jumping-into-a-front-end-framework-b7cc67280c8c?source=rss-6f8713fd2626------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7cc67280c8c</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Tony Kim]]></dc:creator>
            <pubDate>Mon, 24 Aug 2020 07:09:08 GMT</pubDate>
            <atom:updated>2020-08-24T07:17:37.587Z</atom:updated>
            <content:encoded><![CDATA[<p>August 24, 2020</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*h1QCLrDXqSKoI8jf" /><figcaption>The most popular JavaScript Front-end Frameworks</figcaption></figure><p>It is exciting to utilize a JavaScript front-end framework to develop personal and professional projects, but it is also important to know the JavaScript fundamentals to take full potential of these technologies.</p><p>In this blog, I will list out and explain important concepts and fundamentals (from personal experience) that will make learning and utilizing these frameworks much easier.</p><ol><li><strong>Destructuring Assignment:</strong></li></ol><p>The destructuring syntax is a JavaScript expression that allows you to “unpack” values from both objects and arrays. This is used quite heavily when you are requiring certain values or properties from a certain React module or something that you created yourself.</p><p>Example:</p><pre>const names = [&quot;Tony&quot;, &quot;Bob&quot;, &quot;Tom&quot;]; </pre><pre>[name1, name2, name3] = [&quot;Tony&quot;, &quot;Bob&quot;, &quot;Tom&quot;];</pre><pre>console.log(name1) <br>//outputs: &quot;Tony&quot; </pre><p><strong>2. Spread Syntax:</strong></p><p>The spread syntax allows you assign a name to a group elements in a array.</p><pre>//Spread operator<br>[name1, ...names] = [&quot;Tony&quot;, &quot;Bob&quot;, &quot;Tom&quot;];</pre><pre>console.log(...names) <br>//outputs: [&quot;Bob&quot;, &quot;Tom&quot;]</pre><p><strong>3. Map, Reduce, Select, and Find:</strong></p><p>These four methods will become your best friend in React (and other frameworks) as you apply them to reusable React components.</p><p><strong>Map: </strong>transform a collection into a different collection of same size (returns a array).</p><pre>const arraySample = [1, 2]; </pre><pre>const double = arraySample.map( x =&gt; x * 2); </pre><pre>console.log(double); //outputs [2, 4]</pre><p><strong>Reduce: </strong>Accumulate a collection in a single value.</p><pre>const sum = arraySample.reduce((accum, currentValue) =&gt; accum + currentValue); </pre><pre>console.log(sum); //outputs 3</pre><p><strong>Select/Filter: </strong>Return only the items from a collection that match a condition.</p><pre>const belowTwo = arraySample.select( x =&gt; x &lt; 2 ); </pre><pre>console.log(belowTwo); //outputs 1</pre><p><strong>Find: </strong>Returns the first item from a collection that match a condition.</p><pre>const belowTwo = arraySample.select( x =&gt; x &lt; 1.5);</pre><pre>console.log(belowTwo); //outputs 1</pre><p><strong>4. Ternary Operators:</strong></p><p>A JavaScript operator that takes in a condition, and two expressions to execute (depending on if the condition evaluates to true or false).</p><pre>function over25(age) { <br>   return ( age &gt;= 25 ? &#39;yes&#39; : &#39;no&#39;)<br>}; </pre><pre>console.log(over25(35)); //outputs &#39;yes&#39; </pre><p><strong>5. Importing and Exporting:</strong></p><p>If you have experience with using Node.js, you are likely familiar with importing and exporting modules such as below:</p><pre>//importing<br>const express = require(&#39;express&#39;); </pre><pre>//exporting<br>const someArray = [&#39;hello&#39;, &#39;bye&#39;]; </pre><pre>module.exports = someArray; </pre><p>React.js has similar conventions as above, but instead of saying ‘require’, the normal standard practice is to use the following conventions:</p><pre>//importing <br>import React from &#39;react&#39;;</pre><pre>//exporting <br>function App() {<br>&lt;div&gt;Hello&lt;/div&gt;<br>}</pre><pre>export default App;</pre><p><strong>6. Async/Await</strong></p><p>Async/Await convention became very popular when dealing with promises as it is simple to use and cleaner than chaining multiple “.then”.</p><p>Async functions are declared with the “async” word in front of the function. The async and await convention allows for asynchronous, promised based behavior. This is a important convention to learn as you will be dealing with a lot of promises and handling them accordingly.</p><p>Example:</p><pre>function wait() {<br>  return new Promise( resolve =&gt; {<br>   setTimeout(() =&gt; {<br>     resolve(&#39;hi!&#39;)<br>   }, 3000); <br>  }); <br>}</pre><pre>async function sayHello() {<br>   console.log(&#39;Hello&#39;)<br>   const feedback = await wait(); <br>   console.log(feedback); //outputs &#39;hi!&#39;<br>}</pre><pre>sayHello(); //outputs: &#39;hello&#39;</pre><p><strong>7. Higher-Order Functions</strong></p><p>Functions that can accept other functions as arguments and that can also return them.</p><pre>//Create new functions with a function <br>function lessThan(n) {<br>  return m =&gt; m &lt; n <br>}; </pre><pre>const lessThan5 = lessThan(5); </pre><pre>console.log(lessThan5(6)); //outputs: false; </pre><p><strong>8. Shorthand Object Assignment</strong></p><p>This method is to allow objects to be initialized by using <strong>new Object(), Object.create(), </strong>or a literal notation.</p><pre>const fullName = &#39;Tony Kim&#39;</pre><pre>const profile = {<br>user: fullname<br>};</pre><p>If you would like to learn more about my experience and projects I have completed, please view my LinkedIn, portfolio website, and/or GitHub profile:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/hyung-kim/">https://www.linkedin.com/in/hyung-kim/</a></p><p>Portfolio Website: <a href="https://hjkmines.github.io/my-portfolio-website/">https://hjkmines.github.io/my-portfolio-website/</a></p><p>GitHub: <a href="https://github.com/hjkmines">https://github.com/hjkmines</a></p><p>Please feel free to reach out to me for any questions or inquires through my email: hjkmines@gmail.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7cc67280c8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a RESTful API with Node.js and Express.js]]></title>
            <link>https://medium.com/@hjkmines/build-a-restful-api-with-node-js-and-express-js-2e04d26c3009?source=rss-6f8713fd2626------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e04d26c3009</guid>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Tony Kim]]></dc:creator>
            <pubDate>Mon, 24 Aug 2020 06:07:28 GMT</pubDate>
            <atom:updated>2020-08-24T07:21:55.077Z</atom:updated>
            <content:encoded><![CDATA[<p>August 23, 2020</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*Jr3NFSKTfQWRUyjblBSKeg.png" /></figure><p>This short blog will be a walk-through of building your own RESTful API utilizing Node.js and Express.js.</p><p>Before I go into the technical details, I would like to first share my story of where I started with back-end development. When developing my first API , I first started out with Ruby on Rails, and I still appreciate its simplicity. usability, and readability.</p><p>I wanted to challenge myself by diverging into a new technology stack that encompassed a full JavaScript environment in which brought me to learn Node.js and Express.js.</p><p>In this blog, I will go through setting up a full CRUD structure for a profile model that utilizes MongoDB database and RESTful API architecture.</p><p><strong>Step 1:</strong> Create a empty folder and initiate a npm package in the root directory of the folder:</p><pre>$ npm init -y </pre><p>Shown above is the shortcut method, but if you would like to customize your project, I suggest doing the same command as above without the “-y” flag.</p><p><strong>Step 2: </strong>Install the necessary dependencies or modules for your project. Typically, the most commonly used ones are the following:</p><ul><li>Config: Allows you to safely access config files from any script file.</li><li>Express.js: Most popular framework for Node.js</li><li>Mongoose: Object Data Modeling (ODM) for MongoDB.</li><li>Nodemon (installed as a dev dependency): Allows to automatically restart server when any script changes happen. This is installed as a dev dependency, meaning that only developers need to utilize this tool for testing.</li></ul><p>To install the first three, go into your terminal and type the following:</p><pre>$ npm i config express mongoose </pre><p>For nodemon, install on a separate command line:</p><pre>npm i -D nodemon </pre><p><strong>NOTE: If you plan to push this project up to GitHub, I recommend adding the “node_modules” into the “.gitignore” file. This package file will become very large as you keeping adding more modules. Therefore, whenever clients clone down your repo, they just need to type “npm install” in the command line to download the necessary modules.</strong></p><pre>$ echo &quot;node_modules&quot; &gt;&gt; .gitignore</pre><p>Once the modules have been installed, set up a tree file/folder structure as follows:</p><ol><li>server.js (located in the root directory of the main folder)</li><li>Create a folder for models called “models”. In the models folder, create a new file called “Profile.js”.</li><li>Navigating back to the root of the project folder, create two new folders called “routes” and “config”. In the routes folder, create a new file called “profile.js”. Now, navigate to the config folder, and create two files “db.js” and “default.json”.</li><li>Congrats! This is all we will need to create a basic RESTful API with Node.js!</li></ol><p><strong>Step 3: (default.json file) </strong>Navigate to your default.json file located in your config folder. Start with pasting the MongoURI link from your MongoDB account (to learn about how you can grab your own link, please visit MongoDB’s website for more information):</p><pre>{&quot;mongoURI&quot;: &quot;mongodb+srv://username:password@cluster0.2urup.mongodb.net/&lt;dbname&gt;?retryWrites=true&amp;w=majority&quot;}</pre><p><strong>Step 4: (db.js file)</strong>Start with connecting the MongoDB database to your project:</p><ol><li>Navigate to the db.js folder and add the following required modules to have the database connected:</li></ol><pre>const mongoose = require(&#39;mongoose&#39;);</pre><pre>const config = require(&#39;config&#39;)</pre><pre>const db = config.get(&#39;mongoURI&#39;)</pre><p>2. Next, set up a constant for the database connection utilizing mongoose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*TZPvFDoGWMmGOEVBkJIldg.png" /></figure><p>As shown above, I made a constant called “connectDB” to equal to a async/await function because mongoose always will return a promise. In addition, I wanted to wrap my function around a try/catch block that allows my function to handle any errors.</p><p>Please note that the first argument the mongoose.connect takes in is the database connection link from your MongoDB account. The second argument is a object with a list of features to avoid deprecation warnings.</p><p><strong>Step 5: (server.js file) </strong>Navigate to your server.js folder and add the following required modules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*u0SYM52kgHOm9NQhIUMM8w.png" /></figure><p>Express.js is brought to the server.js file, and in order to utilize it, we will need to invoke this function and assign it to a variable. Express.js allows developers to easily create controllers and more.</p><p>After this is done, connect to the database by invoking the connectDB function:</p><pre>connectDB(); </pre><p>After this, set up your port:</p><pre>const PORT = process.env.PORT || 5000</pre><pre>app.listen(PORT, console.log(`Server is running on port ${PORT}`)); </pre><p>For the PORT constant, I recommend allowing the script file to have the option of selecting a default port of 5000 (or any port number) or the port number that is associated with a platform that it provides. Once this is created, use app.listen (a express.js method) to listen on the appropriate port.</p><p>Lastly, we need to define the route to the profile.js file using “<strong>app.use”</strong> Express method as shown below:</p><pre>app.use(&#39;/profile&#39;, require (&#39;./routes/profile&#39;)); </pre><p>Your finished code should look something like this for server.js:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*skbejK44PiFweLT-slk7pQ.png" /></figure><p><strong>Step 6: (Model &gt; Profile.js) </strong>Moving to the Profile.js model, this is where we will build out our Profile Schema. In this schema, we will add the following attributes to our Profile model:</p><ul><li>Name</li><li>Skills</li><li>Phone</li></ul><p>In order to create a schema with MongoDB, we will utilize mongoose. Add mongoose as a required module into this file:</p><pre>const mongoose = require(&#39;mongoose&#39;); </pre><p>To create a new schema, instantiate a new mongoose schema, assign it to a variable as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*qbIv3RKCjMT155bzL0fsWg.png" /></figure><p>If you would like to add <strong>Strong Parameters and Model Validations</strong>, customize it by doing the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*v9fnbHg_4r122cCOsVOImg.png" /></figure><p>Once the model has been structured, export the model by writing the following below the schema:</p><pre>module.exports = Profile = mongoose.model(&#39;profile&#39;, ProfileSchema);</pre><p><strong>Step 7: (routes &gt; profile.js) </strong>Navigating to our last portion, the project.js route file will allow us to create CRUD actions.</p><p>Let’s start out by bringing in the required modules and files:</p><pre>const express = require(&#39;express&#39;);</pre><pre>const router = express.Router();</pre><pre>const Profile = require(&#39;../models/Profile&#39;);</pre><p><strong>Starting with the “GET” ALL method:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*xtWF27st3mq7w-MxyTcJmQ.png" /></figure><p><strong>“GET” single profile method:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*ukumAtKVH0gVVMWzWZzCJQ.png" /></figure><p><strong>“POST” method:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*KT5L_M8Ad8FUApmysOofAw.png" /></figure><p><strong>“PUT” method:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*9HRP5EPQGYepbQcuCzkgpA.png" /></figure><p><strong>“DELETE” method:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*tzUcSerSQuypx5QwOyuO2Q.png" /></figure><p>Once the routes have been made, export the router at the bottom of the script:</p><pre>module.exports = router; </pre><p>To test out the routes utilizing a Postman client, enter the following in the command line:</p><pre>$ node server.js </pre><p>If you would like to see my API project in more detail, please click the link below to my GitHub repository:</p><p>GitHub: <a href="https://github.com/hjkmines/node-express-API-project">https://github.com/hjkmines/node-express-API-project</a></p><p>If you would like to learn more about my experience and projects I have completed, please view my LinkedIn, portfolio website, and/or GitHub profile:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/hyung-kim/">https://www.linkedin.com/in/hyung-kim/</a></p><p>Portfolio Website: <a href="https://hjkmines.github.io/my-portfolio-website/">https://hjkmines.github.io/my-portfolio-website/</a></p><p>GitHub: <a href="https://github.com/hjkmines">https://github.com/hjkmines</a></p><p>Please feel free to reach out to me for any questions or inquires through my email: hjkmines@gmail.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e04d26c3009" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting the dots: Full-Stack Application]]></title>
            <link>https://medium.com/@hjkmines/connecting-the-dots-full-stack-application-5187b671e9e0?source=rss-6f8713fd2626------2</link>
            <guid isPermaLink="false">https://medium.com/p/5187b671e9e0</guid>
            <category><![CDATA[youtube-app]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[full-stack-development]]></category>
            <category><![CDATA[social-media-app]]></category>
            <dc:creator><![CDATA[Tony Kim]]></dc:creator>
            <pubDate>Wed, 05 Aug 2020 01:05:56 GMT</pubDate>
            <atom:updated>2020-08-05T01:05:56.604Z</atom:updated>
            <content:encoded><![CDATA[<p>August 4, 2020</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1DxyDgFzqIFQFXwdtt8u5Q.jpeg" /></figure><p>It has finally been 6 weeks into the Flatiron School program, and in that time frame, I have been flourished with knowledge and information about how the front and back end finally work together!</p><p>The first 3 weeks of the module was spent learning how to work with the backend with the Ruby language. Through this first module, I was able to build a pure backend project utilizing the terminal to interact with the Ruby application.</p><p>The last 3 weeks has been a combination of both front and back end technologies. In this module, we were finally introduced to the popular Ruby on Rails framework! After playing with the Rails framework for a couple days, I came to appreciate the simplicity and easy-to-use interface that Rails offers to developers alike.</p><p>Once we were comfortable with Rails, we jumped right into the front-end technologies: JavaScript, HTML, and CSS!</p><p>The most exciting part of all this was being able to communicate the front-end to the back-end. In this module specifically, we focused on the following principles to communicate between the two:</p><ul><li>Utilizing the Model-View-Controller (MVC) design pattern</li><li>Building APIs following the RESTful architecture</li></ul><p>You may ask, so what purpose does the front and back-end serve in this case?</p><p>The front-end deals with how the application looks/interacts to the user/client. Such examples include UI/UX (CSS styling, Bootstrap framework, JavaScript actions), and transfer/manipulation of data (through JavaScript).</p><p>For the back-end, it deals primary with data-management, receiving/responding to client request, and setting security protocols (authentication, strong parameters, and model validations).</p><p>Cultivating both sides together, you have yourself a full-stack application!</p><p><strong>MODULE 2 PROJECT</strong></p><p>For my module 2 project, I developed a full-stack web application called RedDoor Media. Shown below is a live demo of my completed project.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsSWGjKcLbBQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsSWGjKcLbBQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FsSWGjKcLbBQ%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/6706eaabc3d477252a0242ade8a39d8e/href">https://medium.com/media/6706eaabc3d477252a0242ade8a39d8e/href</a></iframe><p>The technologies used for this web application includes the following:</p><ul><li>JavaScript</li><li>HTML5/CSS3</li><li>Bootstrap</li><li>Rails</li><li>SQLite3</li></ul><p>The inspiration of this web application came through to me as I am an avid news reader. Alongside new articles, I also enjoy watching YouTube videos. I wanted to develop an application that would deliver all my favorite media content under one roof!</p><p><strong>Front-End Development:</strong> rendering live media content came from three third party API sources. Utilizing JavaScript “fetch” method (shown below), I was able to generate interactive node elements that would render live content.</p><pre>fetch(newsUrl)<br>  .then(response =&gt; response.json())<br>  .then(article =&gt; {</pre><pre><em>    for</em> (i = 0; i &lt; 10; i++) {<br>     const $div = document.createElement(&quot;div&quot;)<br>     $div.classList.add(&quot;carousel-item&quot;)  </pre><pre>     $div.innerHTML = `&lt;a href=&quot;${article[i].url}&quot;&gt;<br>     ${article[i].title}&lt;/a&gt;`<br>     $carousel.append($div)<br>}                                                                                                                            </pre><p><strong>Back-End Development: </strong>I built a rails API backend that allows users to store information about their profile and saved content through the website.</p><p>Utilizing the Model-View-Controller architecture, I developed four different rails resources that encompasses the following:</p><ul><li>User (has_many: articles, videos, images)</li><li>Website (join_table)</li><li>Articles (has_many: users, through: website)</li><li>Videos (has_many: users, through: website)</li><li>Images (has_many: users, through: website)</li></ul><p>In addition to setting these models, controller actions were defined to incorporate the RESTful pattern (index, show, create, update, destroy).</p><p>Upon completing the MVC and RESTful pattern, incorporating strong parameters and model validations were the next objectives:</p><p>Model Validations:</p><pre><em>class</em> User &lt; ApplicationRecord</pre><pre>  validates_precense_of :first_name, :last_name, :email, :password</pre><pre>  validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }</pre><pre>  validates :password, uniqueness: true, length: {in: 7..25}</pre><pre><em>end</em></pre><p>Strong parameters:</p><pre><em>def</em> create<br>  @user = User.create(user_params)<br>  <em>if</em> @user.valid?<br>     @user.save<br>     redirect_to user_path(@user)<br>  <em>else<br>     </em>render :new<br>     @user.errors<br>  <em>end <br>     </em>redirect_to &quot;http://localhost:3001/index.html&quot;<br>  <em>end</em></pre><pre>private</pre><pre><em>def</em> user_params<br>  params.require(:user).permit(:name, :email, :password)<br><em>end</em></pre><p>Some of the additional technologies used in this application includes:</p><ul><li>Rails JWT authentication</li><li>FAST_JSON_API (serializer)</li></ul><p>One of the biggest challenges to this application was streamlining how data was being transferred through the request/response cycles. Most of the issues were resolved through debugging from the network tab in the developer tools and utilizing console.log when responses were sent back from the server.</p><p>Biggest takeaway from this project was being able learn from my own trial-and-errors. For my module 3 project (stay tuned), I will be developing a project that incorporates the MERN technology stack:</p><ul><li>MongoDB</li><li>Express.js</li><li>React.js</li><li>Node.js</li></ul><p>If you would like to see my project in more detail, please click the link below to my GitHub repository:</p><p>GitHub: <a href="https://github.com/hjkmines/RedDoor-Media">https://github.com/hjkmines/RedDoor-Media</a></p><p>If you would like to learn more about my experience and projects I have completed, please view my LinkedIn, portfolio website, and/or GitHub profile:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/hyung-kim/">https://www.linkedin.com/in/hyung-kim/</a></p><p>Portfolio Website: <a href="https://hjkmines.github.io/my-portfolio-website/">https://hjkmines.github.io/my-portfolio-website/</a></p><p>GitHub: <a href="https://github.com/hjkmines">https://github.com/hjkmines</a></p><p>Please feel free to reach out to me for any questions or inquires through my email: hjkmines@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5187b671e9e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying my first CLI application through Ruby]]></title>
            <link>https://medium.com/@hjkmines/deploying-my-first-cli-application-through-ruby-3671086876e4?source=rss-6f8713fd2626------2</link>
            <guid isPermaLink="false">https://medium.com/p/3671086876e4</guid>
            <category><![CDATA[object-oriented-design]]></category>
            <category><![CDATA[sqlite]]></category>
            <category><![CDATA[news-articles]]></category>
            <category><![CDATA[command-line-interface]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Tony Kim]]></dc:creator>
            <pubDate>Fri, 10 Jul 2020 18:13:57 GMT</pubDate>
            <atom:updated>2020-07-11T05:18:05.592Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying my first CLI application with Ruby</h3><p>July 10, 2020</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*VS-YvVLbrd-VtamF2O_CkQ.jpeg" /></figure><p>Just about a month ago, I started my journey to transition into a career path in the technology industry. Previously working as a field engineer in the oil and gas industry, I always had a passion and interest in learning the impacts that technology had in our lives. In June 2020, I decided to take this passion into reality by attending Flatiron School located in Denver, CO to pursue a career in software engineering.</p><p>Today marks the completion of my first module at Flatiron School and deployment of my first programming project. I truly was amazed by what I have achieved in the last 3 weeks, and being able to apply my programming knowledge to build a functional command line interface application.</p><p>The command line interface application was built using Ruby as the main programming language utilizing SQL database to organize my data. The project was focused on the following concepts:</p><ul><li>First component of Model View Control (MVC)</li><li>Developing a Minimum Viable Product (MVP)</li><li>Object Oriented Programming (OOP)</li><li>Object-Relational Mapper (ORM)</li><li>Version control through Git/GitHub</li><li>Exposure to working in a team environment</li></ul><p>In addition, this project came with some challenges as I wanted to incorporate real data through API integration.</p><p>For my project, I wanted to focus on something that I use on a day-to-day basis. The perfect idea came through to me when I thought about my phone. Majority of the time, I spend reading and browsing major news headlines that is happening around the world . As a result, I knew that my interest in news headlines was the perfect candidate to become a viable project for this module.</p><p>The first component of this project was to build up a boiler plate that I can start from. This included several elements:</p><ul><li>Models: Users, Articles, and Account (building a M:N relationship model)</li><li>Installing gem files</li><li>Fetching data through API</li><li>Building a database map for the models through SQLite3 &amp; ActiveRecord</li><li>API token encryption</li></ul><p>Once the base model of this project has been established, the next process was developing the code structure for the models and CLI. For the CLI, I wanted to make it the best UI experience through trial and error. After many edits and testing, I was able to develop a very clean looking interface as shown below:</p><pre><strong><em>class</em> Cli</strong></pre><pre><strong><em>  def</em> welcome<br></strong>    font = TTY::Font.new(:doom)<br>    puts font.write(&quot;What&#39;s  Happening?&quot;)<br>    puts &quot;Hello! What is your name?&quot;.colorize(:yellow)<br>    $user_name = gets.strip <br>    $user = User.create(name: $user_name)<br>    Cli.choose_category<br> <strong> <em>end</em></strong></pre><pre><strong><em>  def</em> self.choose_category<br></strong>    puts &quot;Welcome #{$user_name}, what would you like to read about?               <br>    puts categories  <br>    user_choice = gets.strip.to_i<br>     <em>if</em> user_choice == 1<br>      user_choice = &quot;business&quot;<br>      Article.categories(user_choice)<br>      Cli.home_or_exit<br>   <strong>  end <br>  end <br>end </strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*3z0KJ7lPOEHErwlO09OFuQ.png" /><figcaption>User home page.</figcaption></figure><p>Next, the most challenging part of this project was integrating real data from a news API, and pulling in the correct information based on the user’s selection. The learning curve was steep in the beginning, but after working with multiple APIs, I was able to successfully integrate real news feed to the user as shown in the sample code and CLI image below:</p><pre><strong><em>class</em> Article &lt; ActiveRecord::Base</strong><br>  has_many :feeds<br>  has_many :users, through: :feeds</pre><pre><em>  </em><strong><em>def</em> self.categories(category)</strong><br>    <br>    key = ENV[&quot;API_KEY&quot;]<br>    response = RestClient.get (&quot;https://newsapi.org/v2/top-  headlines?country=us&amp;category=&quot; + &quot;#{category}&quot; + &quot;&amp;apiKey=#{key}&quot;)</pre><pre>    parsed_response = JSON.parse(response)<br>    Article.top_five(parsed_response, category)<br>  <strong><em>end</em></strong></pre><pre><strong><em>  def</em> self.top_five(stories, category)</strong></pre><pre>    puts &quot;Here are today&#39;s top 5 #{category} stories:&quot;   <br>    <br>    counter = 1<br>    result = stories[&quot;articles&quot;].take(5).each <em>do</em> |key, value|<br>      puts &quot;#{counter}. &quot; + &quot;#{key[&quot;title&quot;]}&quot;<br>      counter += 1<br>   <strong> <em>end<br>  </em>end<br>end  </strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*UA_9w7QVdPDlPmwH-T8XVQ.png" /><figcaption>Lists top 5 stories in the “Health” category, along with the option to view summary and link to full article.</figcaption></figure><p>Last component to finish this project was to enable this application to be a full CRUD CLI product. With the help of SQLite3 and ActiveRecord, the user has the option to save and delete articles from their portfolio. To showcase this, a snippet of code and images of the CLI is shown below:</p><pre><strong><em>#Creates new instances of the article, and saves it to the user</em><br></strong>puts &quot;Want to save this story? Enter (yes or no)&quot;.colorize(:yellow)</pre><pre>user_response = gets.strip</pre><pre><em>if</em> user_response == &quot;Y&quot; || user_response == &quot;y&quot; || user_response == &quot;Yes&quot; || user_response == &quot;yes&quot;</pre><pre>article = Article.create(title: random[&quot;title&quot;], summary: random[&quot;description&quot;], category: nil, time_stamp: Time.now)</pre><pre>Feed.create(user_id: $user.id, article_id: article.id)</pre><pre><strong><em>#Deletes record of the article from the user</em><br></strong>response = (gets.strip.to_i - 1)</pre><pre>$user.articles.each <em>do</em> |article|</pre><pre><em>if</em> $user.articles.index(article) == response</pre><pre>  Feed.find_by(article_id: article.id).destroy<br>  article.destroy<br>  $user.reload<br>end </pre><pre>puts &quot;Your article has been removed from your profile!&quot;.colorize(:yellow)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*MnxHv15ku1XKh9y-7gAg8A.png" /><figcaption>Articles saved to user.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*FOCi1MKXKHUfud0Mxvv68Q.png" /><figcaption>2nd article removed from user’s profile.</figcaption></figure><p>One of the biggest takeaways from building this application was that creativity is endless in terms of how the project could had been formed. This in itself, has made me look forward to developing more projects that I am passionate about and life-long learning.</p><p>If you would like to see my project in more detail, please click the link below to my GitHub repository to see a demonstration of the final project:</p><p>GitHub: <a href="https://github.com/hjkmines/What-s_Happening_CLI_Application">https://github.com/hjkmines/What-s_Happening_CLI_Application</a></p><p>If you would like to learn more about my experience and projects I have completed, please view my LinkedIn, portfolio website, and/or GitHub profile:</p><p>LinkedIn: <a href="https://www.linkedin.com/in/hyung-kim/">https://www.linkedin.com/in/hyung-kim/</a></p><p>Portfolio Website: <a href="https://hjkmines.github.io/my-portfolio-website/">https://hjkmines.github.io/my-portfolio-website/</a></p><p>GitHub: <a href="https://github.com/hjkmines">https://github.com/hjkmines</a></p><p>Please feel free to reach out to me for any questions or inquires through my email: hjkmines@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3671086876e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>