<?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 Nwosu Ifeoma on Medium]]></title>
        <description><![CDATA[Stories by Nwosu Ifeoma on Medium]]></description>
        <link>https://medium.com/@nwosuifeomalucia?source=rss-46eb3234411c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xp49QyE9DbFGLujHJi7Wqg.jpeg</url>
            <title>Stories by Nwosu Ifeoma on Medium</title>
            <link>https://medium.com/@nwosuifeomalucia?source=rss-46eb3234411c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:58:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nwosuifeomalucia/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[API Journey]]></title>
            <link>https://medium.com/@nwosuifeomalucia/api-journey-4851f0643b76?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4851f0643b76</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Thu, 21 Jun 2018 07:19:24 GMT</pubDate>
            <atom:updated>2018-06-21T07:19:24.584Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*ndvO7__igAZcCrSWlDcBDg.png" /></figure><p>When I first heard this term API, I kept wondering what it meant since my instructor kept presenting it as being the apex of mastering node.js.</p><p>Imagine my surprise when I was introduced to the express.js framework(which is a framework of node.js) and I discovered that API’s just meant <strong>A</strong>pplication <strong>P</strong>rogramming <strong>I</strong>nterfaces(all this big “grammer” what does it mean?😒).</p><p>From my understanding, API’s are the basic framework of any application that is to be built.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*kJns0paRmBwqkwYUMyC5Pw.png" /><figcaption>Image of a typical restaurant by <a href="https://www.google.com.ng/url?sa=i&amp;rct=j&amp;q=&amp;esrc=s&amp;source=images&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwiwhuW9i-DbAhWF1RQKHbnQAncQjB16BAgBEAQ&amp;url=https%3A%2F%2Fwall.alphacoders.com%2Fbig.php%3Fi%3D862730&amp;psig=AOvVaw2aduMcwaEvR1B-nLep9R9g&amp;ust=1529510151385131">Alpha Coders</a></figcaption></figure><p>For example, if you want to build a restaurant application, you have to create methods such as the ordering method, payment methods (cash, POS etc), method of bookings etc. The coding process for creating all these methods for the restaurant forms the Restaurant API.</p><p>Recently, I got around to designing a Library API which allows the librarian to add, delete, update, fetch or borrow a book from a library. First, I had to import the necessary files need to make my API to function properly. Such files included the <em>express(),</em> <em>body parser </em>and <em>file system(fs) </em>functions. I also had to create the local server at port 3000(You can change this value).</p><pre><em>var</em> express = require(&#39;express&#39;);</pre><pre><em>var</em> app = express();</pre><pre><em>var</em> fs = require(&#39;fs&#39;);</pre><pre><em>var</em> parser = require(&#39;body-parser&#39;);</pre><pre>app.use(parser.json());</pre><pre>app.listen(3000, <em>function</em>(){</pre><pre><em>console</em>.log(&quot;Server is listening on 3000&quot;);</pre><pre>});</pre><p>Next, I created the Book and Library classes which contained the required parameters such as the title of the book, name of the library etc.</p><pre>function Book(title, author, year, id){</pre><pre>this.title = title;</pre><pre>this.author = author;</pre><pre>this.year = year;</pre><pre>this.id = id;</pre><pre>}<br>function Library(name){</pre><pre>this.name = name;</pre><pre>this.books = [];</pre><pre>}</pre><p>Since we need to store the books in an array, we should create a <strong><em>books.json</em></strong> file which would provide a larger storage space for our library. It seems necessary now, to create a method which is able to read from and write to our JSON file. <em>Note that I’ll be using the prototype design pattern in JavaScript</em>.</p><pre><em>Library</em>.prototype.getLibrary = <em>function</em>(){</pre><pre>return JSON.parse(fs.readFileSync(&#39;./data.json&#39;, &#39;utf-8&#39;));</pre><pre>};</pre><pre><em>Library</em>.prototype.updateLibrary = <em>function</em>(){</pre><pre>return fs.writeFileSync(&#39;./data.json&#39;, JSON.stringify(this.books));</pre><pre>};</pre><p>Using this design pattern, I created methods for adding, getting, deleting and updating books in the library, see below</p><pre><em>Library</em>.prototype.addBook = <em>function</em>(<em>book</em>){</pre><pre>this.books = this.getBooks();</pre><pre>this.books.push(book);</pre><pre>this.updateLibrary();</pre><pre>};<br></pre><pre><em>Library</em>.prototype.getBooks = <em>function</em>(){</pre><pre>this.books = this.getLibrary();</pre><pre>return this.books;</pre><pre>};</pre><pre><em>Library</em>.prototype.deleteBook = <em>function</em>(<em>id</em>){</pre><pre><em>let</em> bookIndex = this.getBookIndex(id);</pre><pre><em>var</em> output = &quot;You have deleted the book: &#39;&quot;+</pre><pre>this.books[bookIndex].title +</pre><pre>&quot;&#39; written by &quot; + this.books[bookIndex].author + &quot;.&quot;;</pre><pre>this.books.splice(bookIndex, 1);</pre><pre>this.updateLibrary(this.books);</pre><pre>return output;</pre><pre>};</pre><pre><em>Library</em>.prototype.updateBook = <em>function</em>(<em>id</em>, <em>updatedBook</em>){</pre><pre><em>let</em> bookIndex = this.getBookIndex(id);</pre><pre>this.books[bookIndex] = updatedBook;</pre><pre><em>console</em>.log(this.books);</pre><pre>this.updateLibrary(this.books);</pre><pre>};<br></pre><p>Though we have all these methods of the library class, we need to be able to implement it on our web page using the <strong><em>localhost:3000</em></strong> url. To be able to implement this, we need to use some http request methods which are part of the express() function already imported.</p><h3><strong>Using Http request methods</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5BTqvy6rziFNMmmN.png" /><figcaption>Image by <a href="https://www.testingexcellence.com/difference-put-patch-requests/">Testing Excellence</a></figcaption></figure><p>There are up to six(6) http request methods. They include</p><ul><li>GET method — This is used to retrieve data</li><li>PUT method — Is used request that the enclosed entity be stored under the supplied url.</li><li>POST method — This requests that the server accept the entity enclosed in the request as a new replacement of the web resource identified by the url.</li><li>DELETE method(It still has the usual meaning).</li></ul><p>But first we need to create an object of the Library class, shown below</p><pre><em>var</em> library = new Library(&quot;Global&quot;);</pre><p>Next, we start creating the requests for the addition, getting, deleting and updating of books in our Library as shown below,</p><pre>app.get(&#39;/&#39;, <em>function</em>(<em>request</em>, <em>response</em>){</pre><pre>response.send(library.getBooks());</pre><pre>};<br></pre><pre>app.post(&#39;/api/addBook&#39;, <em>function</em>(<em>request</em>, <em>response</em>){</pre><pre><em>let</em> params = request.body;</pre><pre><em>let</em> book = new Book(params.title, params.author, params.year, Math.random());</pre><pre>library.addBook(book);</pre><pre>response.send(library.getBooks());</pre><pre>});</pre><pre>app.put(&#39;/api/updateBook&#39;, <em>function</em>(<em>request</em>, <em>response</em>){</pre><pre><em>let</em> id = request.query.id;</pre><pre><em>let</em> body = request.body;</pre><pre>library.updateBook(id, new Book(body.title, body.author, body.year, id));</pre><pre>response.send(library.getBooks());</pre><pre>});<br></pre><pre>app.delete(&#39;/api/deleteBook&#39;, <em>function</em>(<em>request</em>, <em>response</em>){</pre><pre><em>let</em> id = request.query.id;</pre><pre>response.send(library.deleteBook(id));</pre><pre>});</pre><p>As can be seen, the <em>app.post</em> method for the addBook contains the <strong><em>Math.Random() </em>function<em>,</em></strong> this is used to create a unique id for any book added to the library. Also, in the app.put method for the updateBook, there is a request.query.id. It enables the user to pass the id of the book to be updated in the form of a request query. For example, the request now becomes <strong><em>localhost:3000/api/updateBook?id=0.323244556787.</em></strong></p><p>This code can be tested using a web application called Advanced Rest Client(ARC), it is a chrome extension file. If you have Chrome browser installed on your PC, search for this application and you can easily download it from there.</p><p>Now challenge yourself to create a method which fetches any book in the library by its id and to also create a borrow books method. It seems thrilling, right??Don’t forget to clap👏👏</p><p><strong><em>The full documentation for the code can be seen </em></strong><a href="https://github.com/IfeomaLucia/Basic-Library-API"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4851f0643b76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Identity]]></title>
            <link>https://medium.com/@nwosuifeomalucia/identity-fa266e3ea1d7?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa266e3ea1d7</guid>
            <category><![CDATA[genesys]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[identity]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Thu, 14 Jun 2018 08:35:38 GMT</pubDate>
            <atom:updated>2018-06-14T08:35:38.696Z</atom:updated>
            <content:encoded><![CDATA[<h4>Finding my inner self</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/0*_RHJLZFPVMiuzdZF" /></figure><p>My journey in life has always been about me trying to fit in with the crowd because I never behaved quite like them. But in the last few years I’ve gotten myself to stop listening to them because I’ve gotten to realise that every human being is their own unique person.</p><p>From this realization, I developed a new sense of identity and this has led to a great improvement in my interaction with people. I won’t say that I’m an extrovert yet but I’m somewhere in between being an introvert and an extrovert.</p><p>Also, my internship here at Genesys Tech Hub is helping me quite immensely. It has opened me up so much that I even got rid of my fears and started to dance unlike before(don’t be so surprised, I’m weird like that 😉😉).</p><p>The internship program was engineered to bring together a group of interested and like-minded individuals in the tech industry. On the day of our induction, I never knew what the future held for me in this company. But here now, 7 weeks into the program I realised that I’ve learnt a whole lot apart from the programming skills I’ve acquired here.</p><p>Each morning, I’m always excited to come to work for the day, although I maybe feeling a bit sleepy, but because there is always a new idea to grab on to, either from the work for the day or from the conversations with my fellow interns.</p><p>In the popular series “Scorpion”, Walter was always telling Paige that her son, Ralph(who was a genius)would never fit in in his school but that when he grew up, he would be able to find people like him and then he would fit in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*kheBsriPvncn-XRs.jpg" /><figcaption><a href="https://en.wikipedia.org/wiki/Scorpion_(TV_series)">Scorpion</a></figcaption></figure><p>Not so long ago, I also watched a video from which I understood that the conventional means of education no longer yields the required results. It(the video) went on to state that the best form of education can be gotten within one’s tribe(i.e a group of people with similar interests). At Genesys, I’ve been able to achieve this and I will always be grateful to them for this opportunity.</p><p><a href="https://medium.com/intern-city">#weAreGenesys</a>…..where everything is learnable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa266e3ea1d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reading a book…(Why we need to read)]]></title>
            <link>https://medium.com/@nwosuifeomalucia/reading-a-book-why-we-need-to-read-bfe415c02cec?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfe415c02cec</guid>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[reading-books]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[writing]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 10:22:12 GMT</pubDate>
            <atom:updated>2018-06-06T11:03:56.068Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*WoCMvCzB-zzo_4XN.jpg" /><figcaption>Always try to read at least one page in a day</figcaption></figure><p>We all think that reading is all about opening a book, reading the words and closing the book. But it’s not as simple as that, it involves something quite deeper.</p><p>From my point of view, Reading is a form of intellectual exercise for the brain. Basically, it is a form of escape from the real world.</p><p>In his<a href="https://medium.com/swlh/this-is-your-brain-on-reading-why-your-brain-needs-you-to-read-every-day-a472b04da2e0"> article</a> on “Why your brain needs to read everyday”, Thomas said that as you read a book, your brain is decoding a series of abstract symbols and synthesizing the results into complex ideas. Reading enhances one’s reasoning and gives one a broader perspective of life.</p><p>As a child I’ve always had an interest in reading books(novels, to be specific). Novels has always had that touch of fiction and reality. Books like <a href="https://zodml.org/eachbook.php?id=2142">The Joys of Motherhood</a> by Buchi Emecheta, <a href="https://zodml.org/eachbook.php?id=94">Things fall Apart </a>by Chinua Achebe, <a href="https://zodml.org/eachbook.php?id=100">The Passport of Mallam Ilia </a>by Cyprian Ekwensi, <a href="https://zodml.org/eachbook.php?id=801">Arrows of Rain</a> by Okey Ndibe, Treasure Island by R.L Stevenson and so on were quite informative for me during my formative years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*PFWcLXPMzq0JZLPj" /></figure><p>But for some people, reading is a tough chore and I’m here to tell you guys that <strong>reading is fun!!! </strong>The trick is just to find that particular genre of books(or author) which will grab your attention.</p><blockquote>“Some books are to be tasted, others to be swallowed, and some few to be chewed and digested.” –Francis Bacon</blockquote><p>Reading is an important task because</p><ul><li>It expands your horizons</li><li>It enables you to take a leap into the past</li><li>It makes one to appreciate the beliefs and cultures of others</li><li>We need literature in order to connect with our own humanity.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*DpXrLbA633tiWb8Y.jpg" /></figure><p>Just for suggestions, the interesting genres for me includes sci-fi and fantasy genre(which has authors like <a href="https://www.annebishop.com/">Anne Bishop</a>, <a href="http://rickriordan.com/">Rick Riordan</a>,<a href="http://danbrown.com/"> Dan Brown</a>, <a href="https://brandonsanderson.com/">Brandon Sanderson</a>, <a href="https://www.cassandraclare.com/">Cassandra Clare</a>) and the mystery/crime genre(which has authors like Sidney Sheldon, <a href="http://www.jamespatterson.com/">James Patterson</a>, <a href="http://www.leechild.com/">Lee Child</a>, <a href="https://www.agathachristie.com/">Agatha Christie</a>, <a href="http://www.arthurconandoyle.com/">Arthur Conan Doyle</a>).</p><p>Enjoy your reading !!!And I’m open to suggestions for any good reads.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfe415c02cec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pattern Matching]]></title>
            <link>https://medium.com/@nwosuifeomalucia/pattern-matching-4d84d99441c9?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d84d99441c9</guid>
            <category><![CDATA[pattern-matching]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[regex]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Mon, 21 May 2018 10:10:36 GMT</pubDate>
            <atom:updated>2018-05-21T19:01:34.606Z</atom:updated>
            <content:encoded><![CDATA[<p>When you log on to some sites and you are required to input your email address, then you try to input something funny like <em>findme@gmail</em> and the system recognizes it as being an invalid address. Do you ever ask yourself how the system determines that?</p><p>Not to worry, I’m here to enlighten you. That instance can be achieved through what we programmers call regular expressions (Regex or RegExp). This is a method used in programming for pattern matching. It used mostly for data validation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/0*sEfmf-BVuRnmXXve.png" /></figure><p>Some common Regex characters include</p><ul><li>“\” — Is a backslash that indicates that the next character is not special. For example</li></ul><pre>\e matches “e” in “bear”.</pre><ul><li>“^” — This matches the beginning of a string. For example</li></ul><pre>/^B/ matches “B” in “Biscuit” but not the one in “A Bucket”.</pre><ul><li>“\d” — This matches all digit characters from 0–9. Also written as [0–9].</li><li>“\w” — matches all word characters(both capital and small letters) and the underscore(_) character. It matches</li></ul><pre>“b” in bar and “4” in 4567</pre><ul><li>“+” — Matches the preceding character/element 1 or more times. For example</li></ul><pre>/r+/ matches all the r’s in “arrrrrgh”.</pre><ul><li>“*” — This matches the preceding character/element 0 or more times. For example, it matches /go*/ matches “gooey” in “This thing is gooey” and “go” in “The mission is a go” but matches nothing in “ gnaw”.</li><li>“\s” — matches a single white space character.</li></ul><pre>/\s\w+/ matches “ball” in “Tennis ball”.</pre><ul><li>“.” — Matches any character except the newline character.</li><li>“|” — This separates alternating possibilities. It works like the OR property in programming. For example</li></ul><pre>/blue|grey/ matches “blue” in blue jacket and also “grey” in grey jacket.</pre><ul><li>“[…]” — This represents a character set, it matches any(either) of the characters contained in the brackets.</li></ul><pre>[abc] matches “a” in “rap” and also matches “b” in “bell”.</pre><ul><li>“(…)” — This groups a series of patterns into a single element. For example /(are)(def)/, where (are) can be referenced as $1 and (def) as $2.</li><li>“[^…]” — Matches all characters except the ones in the bracket. For example</li></ul><pre>[^abc] matches “glow” in “Orange glow”.</pre><ul><li>“{m, n}” — denotes a match at m minimum count and n maximum count. If n is omitted it is assumed as infinity. Also m can be 0(zero).</li><li>“a(?=b)” — This is called a lookahead . It matches ‘a’ only if it is followed by ‘b’. For example</li></ul><pre>/Thick(?=fog)/ matches “Thick” in “Thick fog” but not in “Thick book”.</pre><ul><li>“?” — matches the preceding expression 0 or 1 time. For example</li></ul><pre>(te?r?) matches “ter” in “enter” and “t” in “toy”.</pre><h3>Regex Flags</h3><p>These include</p><ul><li>Multi-line flag(m) — Allows for a multi-line search.</li><li>Global flag(g) — Allows for a global flag.</li><li>Case insensitive flag(i) — Considers both capital and small letters together.</li><li>Unicode flag(u) — Considers the pattern as a series of Unicode code points.</li><li>Sticky flag(y) — Matches only from the index indicated by the <em>lastIndex </em>property of this regular expression in the target string (and does not attempt to match from any later indexes).</li></ul><h3>Using Regex</h3><p>Regular expressions can be written in two forms</p><pre>var re = /pattern/flags;<br>//OR<br>var re = new RegExp(&#39;pattern&#39;, &#39;flags&#39;);</pre><p><strong>Tip</strong>: Finding regex patterns can be made easy using <a href="https://regexr.com/">https://regexr.com/</a></p><p>Regular expressions are used with its RegExp methods(<strong>exec </strong>and <strong>test</strong>) and some String methods(<strong>split</strong>, <strong>match</strong>, <strong>replace</strong> and <strong>search</strong>).</p><ul><li><strong>exec </strong>— executes a search for a match in a string and returns an array if it is found.</li><li><strong>test</strong> — executes a search for a match between a regular expression and a string.</li><li><strong>split</strong> — Is a string method that is used to split a string(now specified with the regular expression) into an array of substrings.</li><li><strong>match</strong> — It retrieves the matches when matching a string to a regular expression.</li><li><strong>replace </strong>— It returns a new string with the matches of the pattern(regular expression) being replaced with the replacement substring,</li><li><strong>search </strong>— This tests for a match in a string and returns the index of the search.</li></ul><h3>Greediness and Laziness</h3><p>This sounds strange, right?This is a condition where a quantifier tells the engine to match as many instances of the pattern as possible. The behavior is called <strong><em>greedy.</em></strong> For instance,take the + quantifier. It allows the engine to match one or more of the token it quantifies \w+ is meant to match one or more word characters in “abcdefgh”. That means matching a, ab, abc, abcd and so on. But since the quantifier is greedy it first matches abcdefgh, then abcdefg and so on.</p><p>In contrast to the greedy quantifier which takes as many instances of the quantified token, the <strong><em>lazy</em></strong> quantifier matches as few of the quantified tokens as much as possible. For instance, \w*?E matches zero or more word characters, but as few as needed, until the letter E is found. In string “abcdEE”, it matches <strong>abcdE</strong> because a lazy quantifier finds the shortest match.</p><p>In conclusion, regular expressions is a crucial part of any programming process. It also tends to simplify some programming concepts, an example can be seen <a href="https://github.com/IfeomaLucia/Arrays">here.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*agshAVo4yAX1mBcf.png" /><figcaption>Don’t forget to clap!!!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d84d99441c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Github basics(2) — Collaboration]]></title>
            <link>https://medium.com/@nwosuifeomalucia/github-basics-2-collaboration-8518b7291c4c?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8518b7291c4c</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git-workflow]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Fri, 18 May 2018 19:40:43 GMT</pubDate>
            <atom:updated>2018-05-18T19:40:43.709Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*nX5xmpSEwGmwmHXN.png" /><figcaption>Have you ever encountered this? Use GitHub to avoid such</figcaption></figure><p>From my <a href="https://medium.com/@nwosuifeomalucia/github-basics-b7d09fcd0281">previous article</a>, it can be seen that Github is an easy tool to master(Isn’t it?). But those were not the only functionalities in Github, we can still use it in a lot of ways.</p><p>Have you imagined working on a project(which involves coding of course) with a group of people whereby you were all assigned particular aspects of the code to work on?Do you inquire on how you are all going to merge your individual files to form the final project? With the help of GitHub, collaboration on such projects are made easy.</p><p>Collaboration can be achieved with the help of Git Workflow. Git Workflow is a recipe or recommendation for how to use Git to accomplish work in a consistent and productive manner. Some examples of Git workflow methods includes Centralized Workflow, Feature Branching, Forking Workflow etc.</p><h3>Forking Workflow</h3><p>Before we can proceed with our project, the whole team must have come together and agreed on how the flow of changes will occur(such as the naming conventions to use). First someone needs to create a repository for the work to be done, the process it involves is described in my <a href="https://medium.com/@nwosuifeomalucia/github-basics-b7d09fcd0281">previous article</a>.Once this is set up it is then easier for any other team member to make changes or modify the code. To do this, he/she has to fork the existing repo by clicking on the <strong><em>“Fork”</em></strong> button(which is on the top right hand corner of your screen), doing this creates a forked repository in the user’s GitHub account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*wQ4WqSD8Ab4JxOlN." /></figure><p>Next, we head to our Git terminal(i.e. the Git Bash) and clone the repository. Then you change directory into the folder where the file exists on your PC.</p><pre>git clone <a href="https://github.com/IfeomaLucia/Anagram.git">https://github.com/IfeomaLucia/Anagram.git</a><br>cd Anagram<br></pre><p>Whenever we are done making the changes needed, we then proceed to track the changes made on Git using <strong><em>git add -A. </em>Ensure you </strong>write a commit message which specifies details of any change that was made. Once this is achieved, you are now to go to the repository on GitHub and click on the <em>“pull request</em>” button.</p><p>Pull requests lets you tell the <strong><em>“master”</em></strong> (and other collaborators)about changes you’ve pushed to the repository on GitHub. If your collaborators are all satisfied with the changes made, the <strong><em>“master”</em></strong> can then proceed to merge the pull request on GitHub, else they can also close the pull request. If the pull request has merge conflicts, you can proceed to check out the requests locally (following the instructions provided on GitHub). In summary,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*nR6TqU6WYG99zB-2.png" /></figure><p>Using GitHub maybe simple but one needs to know the basic guidelines surrounding it. These includes</p><ul><li>Keeping your commit messages short and precise(a little sarcasm is allowed).</li><li>Not expecting all your pull requests to lead to being merged</li><li>Always commiting often, since this helps to keep track of anycommitted changes(i.e. you ought to make only one commit message at a time)</li><li>Using branches, since this helps to avoid mix-ups in our codes</li><li>Not committing a work that is half-done</li><li>Always decide on a project’s workflow before diving into coding</li></ul><p>That’s all folks!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*Mr8EqKbdXtwf1R4P.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8518b7291c4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub basics]]></title>
            <link>https://medium.com/@nwosuifeomalucia/github-basics-b7d09fcd0281?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7d09fcd0281</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Mon, 07 May 2018 19:12:01 GMT</pubDate>
            <atom:updated>2018-05-07T19:12:01.915Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m7tjOFSqMaeRSDtr.jpg" /></figure><p>From Google, <em>“</em> <em>GitHub is a web-based hosting service for version control using git. It is mostly used for computer code. It offers all of the distributed version control and source code management functionality of Git as well as adding its own features.” </em>Version control is basically a system used to track changes being made to files so that you can easily reference the older versions.</p><p>This technology is a rather important tool for any programmer to master. It may seem quite confusing at first, I know it was for me, but continuous usage helps one to master it. Below I’ll take you through the steps of pushing a file to Github.</p><p>First of all you must surely have a GitHub account and also have a version of Git downloaded on your PC.</p><p>Next, you have to create a new repository from your GitHub account, you can do this either by clicking on the “New Repository” button (a green button to the left) or by clicking on the + button.</p><p>Now we go to our file, right click and click on “Git Bash here…”. In the command line interface we type in <strong>git clone &lt;url&gt;. </strong>For example,</p><pre>git clone https://github.com/IfeomaLucia/Anagram.git</pre><p>This command clones(downloads) your repo to the working directory so you can do your work on it before pushing it back to GitHub.</p><pre>cd Anagram</pre><p>The above is to enter into the directory of your file. You’ll also have to ensure that the file to be uploaded is inside your directory(i.e the folder) before any futher processes is done on the Git Bash.</p><p>Next, we check the status of our repo by typing in <strong>git status, </strong>thislists out the basic info of our file and shows the<strong> </strong>user that there is an untracked file(if there’s any). This can now be added by using anyone of the syntax shown below</p><pre>git add -A //this adds all untracked files<br>or<br>git add &lt;files&gt; // you use this when you want to specify a particular file</pre><p>Next, we include a commit message which basically tells any user of the changes you’ve made to the file at any point in time. The syntax is as shown below…the flag -m is a shortcut for writing messages.</p><pre>git commit -m &#39;include your commit message here&#39;</pre><p>In case of any changes to your file, you also have to push this new section of the file. This is done by using the <strong>git add</strong> syntax shown above. You also have to include another commit message if you add any new file. To track the changes being made between any two commit messages, you’ll use</p><pre>git diff &lt;firstLogNumber&gt; &lt;SecondLogNumber&gt;</pre><p>The log numbers of commits can be gotten when we type <strong>git log</strong>, this displays all the commit messages and their respective log numbers.</p><p>Finally, when you are done making any reasonable changes to your program(or file), you can now take the final step to push your file to GitHub. This is done by typing,</p><pre>git push origin master</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/0*5Bev15gNCwq3NOBz." /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7d09fcd0281" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Buying and selling made easy???]]></title>
            <link>https://medium.com/@nwosuifeomalucia/buying-and-selling-made-easy-567c47ba8572?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/567c47ba8572</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[e-commerce-website-design]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Thu, 03 May 2018 19:21:19 GMT</pubDate>
            <atom:updated>2018-05-03T19:21:19.064Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you ever get tired of just going to the market, likely every 2 months or so, to buy that your favorite brand of clothes or shoes, and then finding out that it is out of stock or not finding it at all??I’m sure you are, that is why the advent of E-commerce was quite a serious boost to the business world. It is always easy for a customer to just log on to e-commerce sites and click /tap on the items they want to order, but have you ever sat down to wonder how the sites work at their backgrounds to compute your order?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/0*4Kzl8BpqJLpqXnAe." /></figure><p>To a non-developer , this would seem as such an easy task since it is just buying and selling, right?But actually it is not. The process of computation involved in this is actually quite complex since it involves a lot of conditions and loops. I can surely attest to this since i created a mini e-commerce app of my own.</p><p>The process involved in creating an e-commerce app requires one to understand the logic required in its operation. It involves creating an associative arrays of items available in the store and the items ordered by a customer. The program has to contain a function which has to be able to loop through the two arrays and check for the available goods and then outputs the total price of items bought by the customer and the quantity of items remaining in the store and when any item is not found, the program stops.</p><p>To go about this, my colleagues and I had to work together to develop a pseudo code for the program from where we had an idea of the basic operation and how to go about it.</p><p>Below is a copy of my code and I followed the basic logic as I described above. Within the first 10 lines , I declared the array of the items in the store and array of items ordered by the customer.</p><pre><em>var</em> store = [</pre><pre>{name:&quot;shoes&quot;, price:50, quantity:10},</pre><pre>{name:&quot;dress&quot;, price:30, quantity:5},</pre><pre>{name:&quot;trousers&quot;, price:20, quantity:7},</pre><pre>{name:&quot;caps&quot;, price:10, quantity:2}</pre><pre>]</pre><pre><em>var</em> order = [</pre><pre>{name:&quot;dress&quot;, quantity:10},</pre><pre>{name:&quot;shoes&quot;, quantity:5}</pre><pre>]</pre><p>Next, I called a function which accepts two input parameters and returns an output. Under this function, I called three variables which stored the total price and the new quantities of the store, available products and a Boolean value respectively.</p><pre><em>function</em> buyProduct(<em>store</em>, <em>order</em>){</pre><pre>//declares a new array which consists of the total price of items ordered</pre><pre>//and the new array of items remaining in the store.</pre><pre><em>var</em> newStore =[{totalPrice:0}, store];</pre><pre><em>var</em> availableProduct = 0;</pre><pre><em>var</em> quantityIsEnough = true;//quantity of the items is assumed to be enough</pre><p>I then called a for(...of…) loop which I used to loop the items of the order array, comparing both the names and quantities of the array to those of the store array. At this juncture, it then computes the total price of items ordered by the customer and then creates a new store array which now consists of new values for the quantities after purchase has been made.</p><pre>for(<em>var</em> item of order){</pre><pre><em>var</em> availableItem = false;//assumes the items are not available.</pre><pre>store.forEach(<em>product</em> <em>=&gt;</em> {//checks for items from the order in the store</pre><pre>if(item.name == product.name){</pre><pre>availableItem = true;//items are deemed to be available</pre><pre>availableProduct++;</pre><pre>if(item.quantity &lt;= product.quantity){</pre><pre>newStore[0].totalPrice += item.quantity * product.price;//calculates total price of items bought</pre><pre>product.quantity -= item.quantity;//calculates for the remaining quantity</pre><pre>}else{</pre><pre>quantityIsEnough = false;</pre><pre>}</pre><pre>}</pre><pre>})</pre><pre>if (!availableItem){</pre><pre>break;</pre><pre>}</pre><pre>}</pre><p>Finally, I had a nested if…else statement use to loop through the conditions as can be seen below and then displays the output.</p><pre>//checks if  products available are the same length as the order array and</pre><pre>//if the quantity of items are enough</pre><pre>if (availableProduct == order.length &amp;&amp; quantityIsEnough == true ){</pre><pre><em>console</em>.log(newStore);</pre><pre>output =newStore;</pre><pre>}</pre><pre>//checks if the products available is not equal to the length of the order array</pre><pre>else if(availableProduct != order.length){</pre><pre>output = &quot;Item/s are not available&quot;;</pre><pre><em>console</em>.log(output);</pre><pre>}</pre><pre>//this executes when neither of the above conditions hold</pre><pre>else{</pre><pre>output = &quot;Out of stock&quot;;</pre><pre><em>console</em>.log(output);</pre><pre>}</pre><pre>return output;</pre><pre>}</pre><p>The program can be seen to consist of multiple lines of codes which was not easy to decipher, at first, but with the help of my colleagues and instructor it was quite possible. We had to consider all the possible conditions required in the codes especially the one which required the code to stop executing once an item in the order does not exist in the store.</p><p>Thanks to the help of all my colleagues and instructor I’ve been able to advance my knowledge of JavaScript to be able to solve complex problems such as this.</p><p>THE COMPLIED CODE IS SHOWN BELOW:</p><pre>//E-Commerce application by Nwosu Ifeoma Lucia</pre><pre>//Developed at Genesys tech hub, Tenece, Enugu</pre><pre>//It checks for the items ordered by the customer</pre><pre>//against the items available in the store.</pre><pre>//declares the items in the store as an associative array</pre><pre><em>var</em> store = [</pre><pre>{name:&quot;shoes&quot;, price:50, quantity:10},</pre><pre>{name:&quot;dress&quot;, price:30, quantity:5},</pre><pre>{name:&quot;trousers&quot;, price:20, quantity:7},</pre><pre>{name:&quot;caps&quot;, price:10, quantity:2}</pre><pre>]</pre><pre>//declares the items ordered by one customer</pre><pre><em>var</em> order = [</pre><pre>{name:&quot;dress&quot;, quantity:10},</pre><pre>{name:&quot;shoes&quot;, quantity:5}</pre><pre>]</pre><pre>//declares the items ordered by another customer</pre><pre><em>var</em> order2 = [</pre><pre>{name:&quot;caps&quot;, quantity:1},</pre><pre>{name:&quot;trousers&quot;, quantity:4},</pre><pre>{name:&quot;shoes&quot;, quantity:1}</pre><pre>]</pre><pre><em>function</em> buyProduct(<em>store</em>, <em>order</em>){</pre><pre>//declares a new array which consists of the total price of items ordered</pre><pre>//and the new array of items remaining in the store.</pre><pre><em>var</em> newStore =[{totalPrice:0}, store];</pre><pre><em>var</em> availableProduct = 0;</pre><pre><em>var</em> quantityIsEnough = true;//quantity of the items is assumed to be enough</pre><pre>//loops through the arrays and compares the names and quantities</pre><pre>for(<em>var</em> item of order){</pre><pre><em>var</em> availableItem = false;//assumes the items are not available.</pre><pre>store.forEach(<em>product</em> <em>=&gt;</em> {//checks for items from the order in the store</pre><pre>if(item.name == product.name){</pre><pre>availableItem = true;//items are deemed to be available</pre><pre>availableProduct++;</pre><pre>if(item.quantity &lt;= product.quantity){</pre><pre>newStore[0].totalPrice += item.quantity * product.price;//calculates total price of items bought</pre><pre>product.quantity -= item.quantity;//calculates for the remaining quantity</pre><pre>}else{</pre><pre>quantityIsEnough = false;</pre><pre>}</pre><pre>}</pre><pre>})</pre><pre>if (!availableItem){</pre><pre>break;</pre><pre>}</pre><pre>}</pre><pre>//checks if  products available are the same length as the order array and</pre><pre>//if the quantity of items are enough</pre><pre>if (availableProduct == order.length &amp;&amp; quantityIsEnough == true ){</pre><pre><em>console</em>.log(newStore);</pre><pre>output =newStore;</pre><pre>}</pre><pre>//checks if the products available is not equal to the length of the order array</pre><pre>else if(availableProduct != order.length){</pre><pre>output = &quot;Item/s are not available&quot;;</pre><pre><em>console</em>.log(output);</pre><pre>}</pre><pre>//this executes when neither of the above conditions hold</pre><pre>else{</pre><pre>output = &quot;Out of stock&quot;;</pre><pre><em>console</em>.log(output);</pre><pre>}</pre><pre>return output;</pre><pre>}</pre><pre>buyProduct(store, order);</pre><pre>buyProduct(store, order2);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=567c47ba8572" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding skills 101]]></title>
            <link>https://medium.com/@nwosuifeomalucia/coding-skills-101-a18921e4513?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a18921e4513</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Wed, 02 May 2018 19:18:00 GMT</pubDate>
            <atom:updated>2018-05-02T19:38:06.048Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*UaZ7l40YloyXFVyNdD3DFw.png" /></figure><p>I remember my first code in JavaScript which was quite disorganized that my instructor had to advise me to go and read up the naming conventions and the coding indentations required in JavaScript. So I had to go do some research and discovered these.</p><p>There are various ways in which a code is not readable such as short and unrelated variable name declarations, wrong indentations of codes and loop complexities(this is where comments would prove quite useful).</p><p>Due to all this errors in coding (although the code works and gives a result), I had to go back to the basics and study the coding conventions.</p><p>From Google, “<strong>Code</strong> <strong>Readability<em> </em></strong><em>means that the </em><strong><em>code</em></strong><em> is easy to follow, logically. Standards of indentation and formatting are followed, so that the </em><strong><em>code</em></strong><em> and its structure are clearly visible. Variables are named meaningfully, so that they communicate intent.”Coding conventions include generic patterns that ensure that written code adheres to certain formatting conventions</em><strong><em>.</em></strong></p><p>Most programming languages consists of almost the same coding conventions such as when you have a function(or variable) name which consists of two words, it is declared using the format “<em>firstwordSecondword” — example is nameLength.</em></p><p>In JavaScript, the coding convention basically covers the naming and declaration rules for variables and functions and rules for the use of white space, indentation and comments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*wPIhtWwtegBkzN4q.png" /><figcaption>Example of a well indented code(Image via Wikipedia)</figcaption></figure><p>It also includes the placement of the opening and closing braces; the opening brace should be on the same line as the previous statement while the closing brace should be on the same indent as the original function call. One should also note the use of the tabs and the 2-space indentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*Ury7yWkITVOOfpMISukpvw.png" /></figure><p>Practicing all the above mentioned makes it easier for one to easily find bugs in their codes (and if possible fix them on the spot) and it makes it easy for other developers to understand one’s code.</p><p>Essentially, good developers write code fast and with low bug-rate while great developers read existing code, reuse and improve them, generating higher quality code with no duplication and reduced bug-rate for both new and existing code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a18921e4513" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginning of the Journey]]></title>
            <link>https://medium.com/@nwosuifeomalucia/beginning-of-the-journey-2e5c7309e6d3?source=rss-46eb3234411c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e5c7309e6d3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nwosu Ifeoma]]></dc:creator>
            <pubDate>Tue, 01 May 2018 08:01:06 GMT</pubDate>
            <atom:updated>2018-05-01T08:01:06.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*x-yP-cQKNOQfIBPm.jpg" /></figure><p>The night before Monday the 30th was wonderful. I wanted dawn to break so I could rush to Genesys Tech Hub and continue with the fun where I left off.</p><p>Morning came, I was in…early but things were different. Unlike in the past week all we did then was to talk, argue and play, we were introduced to the Node.js which would be our primary programming language. But first of all, we were given a task, courtesy of Osita, to create a word guesser application using JavaScript language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*aqC20lq43uLK5M3g3xeGJg.jpeg" /><figcaption>Example of JavaScript code</figcaption></figure><p>This task might have been perceived to be easy by some of us but it seemed so tough and challenging to me(although I had an idea of the basic functionality but…). This was quite so since I had no prior knowledge of JavaScript.</p><p>However, after a while, with some helpful materials found online — as Osita would say “Google it” — and a helping hand from my friend Jennifer, I was able to tame my wild fears, face the problem and procure a solution.</p><p>Although it was an exhilarating experience, it can’t say thiswas fun for me(at first…) but I’m able to appreciate it now and eager to learn more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e5c7309e6d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>