<?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 Vanessa Jesik on Medium]]></title>
        <description><![CDATA[Stories by Vanessa Jesik on Medium]]></description>
        <link>https://medium.com/@vanessa-jesik?source=rss-887a54967115------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*noaHcAfan4ybFVZEHWZQVw.png</url>
            <title>Stories by Vanessa Jesik on Medium</title>
            <link>https://medium.com/@vanessa-jesik?source=rss-887a54967115------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:56:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vanessa-jesik/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[Date Conversions]]></title>
            <link>https://medium.com/@vanessa-jesik/date-conversions-db8c4dd730a3?source=rss-887a54967115------2</link>
            <guid isPermaLink="false">https://medium.com/p/db8c4dd730a3</guid>
            <dc:creator><![CDATA[Vanessa Jesik]]></dc:creator>
            <pubDate>Sat, 11 Nov 2023 20:14:59 GMT</pubDate>
            <atom:updated>2023-11-11T20:14:59.926Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Open calendar with cup of coffee and muffins on table" src="https://cdn-images-1.medium.com/max/500/1*7cy3CtA8g3b9Q-MErWhFzQ.jpeg" /></figure><p>As a full-stack developer, one of the biggest challenges I have encountered is converting and verifying dates. The problem becomes even more intricate when you explore datetime conversions. For now, let’s stick with dates.</p><p>Let’s say I have a backend built with Flask-SQLAlchemy that is communicating with a SQLite server. I may have a model that creates a simple table that looks something like this:</p><figure><img alt="Flask-SQLAlchemy model named SignUp that creates a table labeled signups. The table has three columns — An id that is a primary key, a date that is a date object and may not be null, and a notes column that is a string. The model has a simple representation method." src="https://cdn-images-1.medium.com/max/1024/1*ZQ4QoBlJHlkQbAIfwhCV3Q.png" /></figure><p>Here, the model named SignUp creates a table labeled signups. The table’s first column is an ID which must be an integer and is a primary key for each instance. The second column is labeled date and must be a date object. There is also a specification on the date column that it may not be null. The third column is labeled notes and the input must be a string. The model has a simple representation method.</p><p>Now let’s take a look at how you might seed this table with data during development, specifically considering the date column. This column is expecting a Python date object. If you try to instantiate a SignUp instance with a date string, as exampled below, you will receive a TypeError stating SQLite Date type only accepts Python date objects as input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WlxRrgqNwdj4-6ASSlR_AA.png" /></figure><p>I considered two options when facing this error. I could instead either pass in a Python date object during instantiation or I could convert the string, within the model, into a Python date object. I initially chose to pass in a Python date object. This solution turned out to be less efficient. I will explain the reasons later, but for now, let me illustrate this option.</p><figure><img alt="A code snippet showing an import of date from datetime. Then there is an instance of SignUp instantiated with a Python date object for the date column and a string for the notes column." src="https://cdn-images-1.medium.com/max/1024/1*NmaUp_uB8BeJWZrmvtc4vA.png" /></figure><p>In order to instantiate with a Python date object, we must first import the date class from the datetime module into our seed.py file. Then we create a date object within our SignUp instantiation by passing the YYYY, MM, DD format to the date class. date(2023, 11, 11) satisfies the column’s requirement to be passed a Python date object. This ultimately gets recorded in our table not as a string, but as a date object. However, when printed in the terminal or viewed with a database viewer, it will be converted to a readable string looking like 2023–11–11.</p><p>I may want to add validations to the date column in my signups table to further assure the correct information is recorded in my database.</p><figure><img alt="Code snippet showing validation of date column. Validation requires that date is truthy, or a ValueError is raised, and that date is an instance of a date object, or a ValueError is raised. The validation function returns date if those requirements are met." src="https://cdn-images-1.medium.com/max/1024/1*XkvLn-521QCqbYM2reV_ig.png" /></figure><p>I would typically write my validation as above so as to be explicit that the variable I am evaluating is date. However, in the if not isinstance(date, date) condition, the computer conflates the date variable with the date object so I need to change my labels.</p><figure><img alt="The same code snipped as above replacing date variable with value so the computer does not conflate the date variable with the date object within the isinstance function." src="https://cdn-images-1.medium.com/max/1024/1*LcjqM2Y8XzcFkEzZsvriBA.png" /></figure><p>Great, we have a validates decorator on our date column. It first evaluates that the value of the date variable is truthy. If not, it raises a ValueError stating a date value is required. It next checks that the date variable is an instance of a date object. If it is not, it raises a ValueError stating it must be a date object. If both conditions are appropriately met, the value is truthy and is a date object, the value of the date variable is returned and accepted into the database.</p><p>So far so good. Now let’s look at our front end where a user action will send date information to our signups table. Let’s say our front end is written using React, a javascript library for building user interfaces. We may design a form that collects information from the user to record a new instance of a SignUp.</p><p>I have found using a DatePicker component to be a helpful, user-friendly tool to assist in controlling the format of the information pulled from the date input field in the form. There are a variety of libraries that provide this type of component — I happened to use a <a href="https://mui.com/material-ui/">Material UI</a> component. Different components may record the input differently — the material UI datepicker records the input as a JavaScript date object. We cannot simply pass that input to our table, as it will again raise a TypeError because it is not a Python date object.</p><p>The fix I found to this problem was to convert the JavaScript date object to a string, pass it to the backend through a fetch, and then convert the string to a Python date object in the model before recording the input into the database. This is where the inefficiency of my first solution arose. It may have made more sense to seed the database with a string and have all the string to Python date object conversion occur in the model.</p><p>Okay, so the DatePicker I was using recorded the input as a JavaScript date object. I converted that object to a string using the .toISOString() method. This method converts the object into a string that includes date and time information. Since I was only interested in the date portion of the string, I needed to further modify the string to extract the pertinent portion. The conversion looked like this:</p><figure><img alt="Code snippet showing a JavaScript date object being converted to a string using the .toISOString method" src="https://cdn-images-1.medium.com/max/1024/1*Gjz_qmdi5ns-paEBcDlLxA.png" /></figure><p>The ISO string containing date and time information is split into two at the T character, which represents the start of the time portion of the string, creating an array with two elements. I used bracket notation to only store the first element, which was the date string. How exactly this is integrated into your code depends on how you have your form set up. Just understand this happens on the input and the resulting string is passed as a value to my POST fetch method.</p><p>As mentioned before, we are now in the same sticky situation we bumped into earlier. We are trying to pass a string to a column that is requiring a Python date object. We can now modify our validation decorator within our model to convert this string to the appropriate data type. Because I happened to also have Python date objects being passed to this decorator, from my seed.py file, my updated validation looked like this:</p><figure><img alt="Updated validate decorator for the date column. The addition is if the value is a string, it converts the string to a Python date object, assuming the string is in the correct format. If the string is not in the correct format, a ValueError is raised. If the conversion occurs successfuly, the new value is passed down and the validate decorator checks that it is a Python date object. If all conditions are met, the value is returned." src="https://cdn-images-1.medium.com/max/1024/1*IFy1Xpo86aDDJMliwN4Lrw.png" /></figure><p>Now this validation is adaptable to receiving a string or a Python date object. If the value is a string, the validator will attempt to convert the string to a Python datetime object and then extract only the date portion resulting in a Python date object. This conversion will only be successful if the incoming string is in the format of “YYYY-MM-DD.” If the string format is different, the conversion will fail and a ValueError will be raised. If the conversion is successful, the value that is passed down through the remainder of the validator is now a Python date object which meets the remaining criteria. If, initially, a Python date object was passed to the validator, it would also meet all criteria and the value would be returned.</p><p>As you can see, correctly recording user input dates in your database can pose a challenge of data conversion and verification. My advice is to try to be aware of what type of data you are dealing with at each step in the chain and in what format you are encountering that data. With those variables known, you should be able to correctly manipulate and verify the values.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db8c4dd730a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TRICKS and TREATS for Writing Your First Full-Stack Application]]></title>
            <link>https://medium.com/@vanessa-jesik/tricks-and-treats-for-writing-your-first-full-stack-application-34551b6fdb24?source=rss-887a54967115------2</link>
            <guid isPermaLink="false">https://medium.com/p/34551b6fdb24</guid>
            <dc:creator><![CDATA[Vanessa Jesik]]></dc:creator>
            <pubDate>Mon, 23 Oct 2023 15:19:32 GMT</pubDate>
            <atom:updated>2023-11-01T16:11:59.266Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Two dogs dressed as ghosts for Halloween standing on a porch, surrounded by pumpkins." src="https://cdn-images-1.medium.com/max/612/1*idn6r7we42YW-NVcfC0LLQ.jpeg" /></figure><p>I have just completed by fourth phase at Flatiron School in the Software Engineering program. Over the past six weeks we learned to write in Python and build applications using Flask-SQLAlchemy. This past week, my teammate and I built our first full-stack application using all these newly acquired skills combined with our previously acquired JavaScript and React knowledge.</p><p>This project was unbelievably rewarding — I liken the sensation of finally seeing a feature function properly after numerous error messages to the thrill an angler feels when they hook a prized trout on the end of their fly line. You shout! You cheer! You feel an electric buzz of excitement in your core! And perhaps even more so than rewarding, the experience was fun. It was a joy to link jigsaw pieces together and see the imagined idea come to life. Without a doubt, the week was also very challenging. In the spirit of the Halloween season, I would like to share with you some tricks and treats I found helpful in my journey of building my first full-stack application.</p><h4><strong>Build in Vertical Slices</strong></h4><p>Our project rubric recommended building our application in vertical slices. You can think of a vertical slice as a single piece of a multi-layered cake — each layer in that piece, and the icing that binds them together, is required to complete the experience of enjoying a slice. Eventually, the entire cake will be prepared, but in this unique form of baking, we will construct the cake piece by piece rather than layer by layer.</p><p>What it meant by all of this was to build out all associated front and backend code related to a given feature. It cautioned against writing all of the Flask code and <em>then</em> trying to add React components to it. I initially rejected this idea in my gut. My instinct was to first do what I had recently been practicing, building applications with Flask, thinking that part would go quickly since it was fresh in my mind. Then I would turn to refreshing myself in React and front end styling.</p><p>However, after discussing with my partner, we agreed to follow the advice and attempt to approach our project in what felt like a foreign and unnatural way of thinking. We did this because we trust our educators and because it seemed this style of coding would lend itself well to a division of labor among teammates. We could each identify which feature we were first working on, write all related code, bug-fix along the way, and finish by styling that portion of our project.</p><p>This proved to be an invaluable way of thinking and working. By slowly and methodically creating each layer of the slice and cohesively linking them with icing, or their relational code, you can be sure that each slice is made to perfection and snuggly fits within its space within the greater whole.</p><p>Additionally, there was an unforeseen benefit to building our application this way. We ultimately did not have time to complete every feature we brainstormed within the week allotted for this project. By building in vertical slices, it was very easy to leave out the uncompleted portions when it came time to present. To continue with our cake metaphor, we did not have layers of cake hanging in space, without a base to support them, threatening to suddenly collapse and crash our application. I would highly recommend building in vertical slices as you write code for <em>any</em> full-stack application.</p><figure><img alt="Two glowing jack-o-lanterns set on autumn leaves." src="https://cdn-images-1.medium.com/max/612/1*ZuLHRnb8arJLoXGEdQ-nNg.jpeg" /></figure><h4><strong>Use an API Development Platform</strong></h4><p>Another helpful trick we utilized was an API development platform to aid in error tracing when connecting front and backend code. The Flatiron curriculum uses <a href="https://www.postman.com/">Postman</a>, which I am now familiar with, but I have transitioned to using <a href="https://insomnia.rest/">Insomnia</a>.</p><p>As you write code that queries your seeded database, write parallel fetches within the API development platform to test the request/response cycle. This <em>does</em> require that thought has been given to validation of data and helpful error messages have been written to help trace any error to the source of the problem. Save these fetches in a collection within the API development platform so they can be used again and again as more features are added to the application.</p><p>With each fetch you test, whether it be a GET, POST, PATCH, DELETE, or other method, the returned HTTP code and returned response data will help decipher if the format of all data are being received, converted, stored, and returned as expected. This is instrumental in honing in to the specific lines of code causing errors.</p><h4><strong>Use the Network Tab in DevTools</strong></h4><p>Again, once detailed validation and error messaging has been written, another useful place to visit when tracing errors is the Network tab within the browser’s developer tools. Now you are in the realm of testing your frontend code — do user actions, such as page loading or form submission, produce the expected result?</p><figure><img alt="Screenshot of network tab in developer tools with the all subtab selected." src="https://cdn-images-1.medium.com/max/536/1*rn7NEcwN-ZxvCuTLY2gBxA.png" /></figure><p>Open the developer tools and select the network tab. Select the <em>all</em> or <em>fetch</em> sub-tab and view the related responses. Here again you can read the received error messages, which you wrote yourself on the backend, to help trace the source of errors or data conversion issues. Of course, using console.log() and debugger are still valid; the network tab supplements what you can do and see in the console in a detailed way.</p><h4>Have a Kind and Patient Mentor… or Two!</h4><p>My last trick for learning to develop full-stack applications is to find a quality mentor. At Flatiron, we are blessed with many of these from our instructor to our team of technical coaches. There is so much that can be learned from online courses, code documentation, forums, and blogs. However, I am still a huge proponent of face-to-face time with a skilled developer. In my humble opinion, nothing can fully replace the benefit of human interaction where questions can be asked or re-asked in a different way, a puzzled expression can be perceived and responded to, and the previous experience/knowledge-base of the questioner can be taken into consideration. So find a mentor or two or three and have a blast creating your first full-stack application — the experience will be a real treat!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34551b6fdb24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Problem Solving with Dictionaries]]></title>
            <link>https://medium.com/@vanessa-jesik/problem-solving-with-dictionaries-7bc3a1f9f07b?source=rss-887a54967115------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bc3a1f9f07b</guid>
            <dc:creator><![CDATA[Vanessa Jesik]]></dc:creator>
            <pubDate>Sat, 30 Sep 2023 18:09:03 GMT</pubDate>
            <atom:updated>2023-10-02T23:07:29.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Stock image with a magnifying glass laying on a dictionary" src="https://cdn-images-1.medium.com/max/612/1*QkCgdChd9xiQ_wQIr4CukQ.jpeg" /></figure><p>I am finishing phase 3 of the software engineering program at Flatiron School. We learned a new language, python, and learned how to orient object classes into one-to-many and many-to-many relationships. We also learned SQL and how to use object-relational mapping to translate between database records and an object-oriented language. Our phase 3 project involved building a command-line interface and object-relational mapping application.</p><p>During the course of the learning experience, I kept getting stumped by a certain type of problem I was asked to solve. We were working within many-to-many object relationships in python. There would be questions asking me to construct a method that would decipher which class instance has the most relationships with this other class instance. Or that could list all instances that have two or more relationships with this other class instance. Or that could determine which class instance has the greatest total of a given attribute associated with this other class instance.</p><p>These types of <strong>aggregate and association methods </strong>were giving me constant trouble until I learned a technique of looping through class instances and cataloging results in a dictionary. Within the dictionary, a certain class attribute can be stored as the key; the value can be a count of relationships or a total associated with a given attribute. This is the thought process I would like to explore in this post.</p><p>Let’s take an example where we have three classes — Authors, Books, and Short Stories. Authors have many Short Stories and Books have many Short Stories. Short Stories belong to both Authors and Books creating a many-to-many relationship between Authors and Books.</p><p>We would like to create a Book instance method that returns a list of Author instances that have written more than two Short Stories for that Book. The method should return None if the Book has no Authors with more than two Short Stories associated with the given instance.</p><p>We will say the Book class has another instance method, or we could create it as a helper function, called short_stories, that returns a list of all Short Stories published within the Book instance on which the method is called. This method works by using list comprehension to loop through a list of all Short Story instances and only returns the Short Stories with an association to the given Book instance. It requires a list that catalogues all Short Story instances as they are instantiated.</p><figure><img alt="Code showing the list of all short story instances being created and added to upon object instantiation." src="https://cdn-images-1.medium.com/max/820/1*KCj6knt0kVktgWjjz1-jAw.png" /></figure><figure><img alt="Code showing the instance method within the book class called short stories what returns a list of all short story instances associated with a given book instance." src="https://cdn-images-1.medium.com/max/1024/1*-SPoRseZ7vyy0pjoV9r_Yw.png" /></figure><p>Let’s begin by defining the instance method as multiple_contributions and passing in a Book instance, designated by self. In order to eventually end up with a unique list of authors, we will need to create an initially empty set called recurring_authors. We can also create an empty dictionary where we will catalogue our findings.</p><figure><img alt="Code showing the initial book instance method called multiple contributions containing an empty set called recurring authors and an empty dictionary called dict." src="https://cdn-images-1.medium.com/max/1024/1*luQrZOyACIaVHYw4QL15Vw.png" /></figure><p>Now let’s begin looping through a list of all the Short Story instances associated with the Book instance the multiple-contributions method has been called on. Again, we will get this list of Short Stories by calling the short_stories method on this specific Book instance. As we do so, we will check, using the .get() method, to see if the Author of each Short Story yet shows up in the dictionary as a key. If it is already in the dictionary, because it was placed there upon initially being discovered in the loop (more on this in a moment), we will add another count to the Author’s value in the dictionary. <em>The value represents how many Short Stories that Author has published in the given Book instance.</em></p><figure><img alt="Code showing that within the multiple contributions method, we loop through all associated short story instances by calling for short story in self.short stories. We check if the author of the short story is in the dictionary using dict.get(short_story.author). If it is, we increase the value of that key by 1." src="https://cdn-images-1.medium.com/max/1024/1*mkHzyBVHc9-GIx2dRm7inQ.png" /></figure><p>If dict.get(short_story.author) returns False, meaning the Author key is not yet in the dictionary, the computer will move on to our else statement. Within the else statement, we will place the Author key in the dictionary and set it’s initial value to 1. We set the initial value to 1 because this is the first time we have encountered this Author in our loop through all the Short Stories published in this given Book instance.</p><figure><img alt="Code that continues from before into the else statement. Here the key is set to the author of the short story and the initial value is set to 1." src="https://cdn-images-1.medium.com/max/1024/1*YrzhEvRZOwdOPy6J-Urm0g.png" /></figure><p>Now, since we are trying to find all Authors who have contributed more than two Short Stories to this Book instance, we will check if the value of the Author for the given Short Story in the loop is greater than 2. If it is, we will append that Author to our recurring_authors set.</p><figure><img alt="Code that builds on the previous code by adding an additional if statement to check if the value for the given author key is greater than two. If it is, the author is appended to the recurring authors set." src="https://cdn-images-1.medium.com/max/1024/1*meIm09j5F9BmdCNjczMXXw.png" /></figure><p>In our return, we will translate our set of recurring_authors into a unique list and return the list. If the list is empty, we will return None.</p><figure><img alt="Code building on the previous code that shows the return statement. The return converts the recurring authors set into a list and returns it. If the list is empty, it returns none by ending with or none." src="https://cdn-images-1.medium.com/max/1024/1*U8Kuf4Z3A4da9Hb-r2V6gw.png" /></figure><p>As you may be able to imagine, this technique is incredibly versatile in solving problems. By setting key value pairs within a dictionary, as we loop through data, we can check for any number of parameters and return the specific data that meet those parameters. If you have thoughts on how this technique can be improved upon or further expanded, please leave a comment below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bc3a1f9f07b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Bootstrap— Customize Colors]]></title>
            <link>https://medium.com/@vanessa-jesik/react-bootstrap-customize-colors-20de0d70e3f2?source=rss-887a54967115------2</link>
            <guid isPermaLink="false">https://medium.com/p/20de0d70e3f2</guid>
            <dc:creator><![CDATA[Vanessa Jesik]]></dc:creator>
            <pubDate>Sat, 09 Sep 2023 05:55:13 GMT</pubDate>
            <atom:updated>2023-09-09T05:58:06.330Z</atom:updated>
            <content:encoded><![CDATA[<p>I have just finished my second group project as a student at Flatiron School — Software Engineering. This project afforded the opportunity to integrate many new skills. We built the app using Create React App. We incorporated client side routing using React Router v6. That was a fun challenge considering we had only just learned React Router v5 the previous week. We also utilized React Bootstrap for styling components which was my first foray into the world of CSS frameworks.</p><p>There are some specific nuances associated with applying React Router to React Bootstrap navigational components, however, I found information to solve those problems to be fairly easy to come by on the web. What I spent much more time seeking information on, and ultimately using a lot of trial and error to figure things out on my own, was how to customize color schemes over the default React Bootstrap colors.</p><p>React Bootstrap does offer a lot of choices already. For example, they have a rainbow of offerings to apply to a variant attribute to customize the color of web buttons. Here is a screenshot from their website on button options.</p><figure><img alt="From the React Bootstrap website, a screenshot of various coded examples of variant attributes to customize the color of web buttons. The image at the top displays buttons in blue, grey, green, yellow, red, etc." src="https://cdn-images-1.medium.com/max/737/1*9RSiB1hT28mvKeaqqUWgJw.png" /></figure><p>The issue we found is the colors are very primary in nature, and unfortunately, do not lend themselves well to designing an application with a color palette where various shades on a spectrum can be used to accent one another.</p><p>In hopes of helping others save a bit of time I would like to show you a few tools I found to be useful when attempting to customize a react app styled with react bootstrap components.</p><p>The first place to start is to inspect the element. I have been trained to use this feature in various ways, but I found a whole new appreciation for it’s usefulness during this project. Right click on whatever element you want to customize and click inspect. Then be sure to open the dev tools enough to the see the HTML of the elements as well as the CSS styling.</p><p>The style tab is where you really start to see the behind the curtains magic that performs all the default features. Pay close attention to everything there as there is no detail too small to be useful. There are numerous default class names and dozens of assigned values to scroll through.</p><p>As you locate the element and feature you want to overwrite, start by selecting the element by it’s assigned classname in your CSS file and attempt a custom attribute. Sometimes, this alone is enough, and sometimes it is not. When that does not overcome the default, the CSS !important rule can come in handy to force the hand of React Bootstrap. Add it behind a CSS value like so:</p><figure><img alt="A code snippet showing CSS styling on a React Bootstrap nav dropdown item. The color values are followed by the CSS important rule." src="https://cdn-images-1.medium.com/max/842/1*AIbCj8r4hwe7XfHhdCn6KA.png" /></figure><p>When using !important you want to understand that it is overwrites all styling on that type of element everywhere. Experimentation taught me that declaring a value !important will assign that value to that element everywhere it appears, assuming it shares the classname, even when the component where that element exists does not have an imported stylesheet or have direct linkage to an import of a stylesheet through the component hierarchy. This can be helpful, but can also have unintended consequences if you are not using it intentionally.</p><p>The next trick to be aware of is to pay attention to the state of the element at any given time. You may successfully change the background of an element, just to realize when that element is hovered over or clicked, the React Bootstrap default color is displayed again.</p><p>The Mozilla documents refer to them as pseudo-classes; the Chrome dev tools label them states. Either way, the Chrome dev tools has a small hover abbreviation, :hov, at the top of the Styles tab. Open this to find a useful tool to force the element state. It can be difficult to catch the CSS values associated with the different states simply by interacting with the page, so this tool allows you to force and persist the state so as to explore it’s attributes. The tool looks like this:</p><figure><img alt="A screenshot of Chrome dev tools force element state tool. It involves radio buttons to force and persist various HTML element states such as hover or active or visited." src="https://cdn-images-1.medium.com/max/425/1*jB9N3nMWMNcL87wtc128KQ.png" /></figure><p>When the state is forced, you can more easily locate and customize the features associated with each state.</p><p>The last nugget of wisdom I will leave you with involves the difference between a colon and a period. : versus . Recall I encouraged paying attention to even the smallest details and slightest differences when inspecting an element. At times, there will appear to be two selectors for a series of CSS values. An example:</p><figure><img alt="A screenshot of a classname on an HTML element designated by .active versus a pseudo-classname on the same element designated by :active. Dot active verse colon active." src="https://cdn-images-1.medium.com/max/422/1*70KWCpnS4lyeOTukizXEIg.png" /></figure><p>Here the .dropdown-item.active is the classname assigned by React Bootstrap while the .dropdown-item:active is the pseudo-classname or refers to the active state of that element. The important piece is they do not apply styling equally and both must be given attention to get the precise results you are looking for.</p><p>I certainly have so much more to learn about all the options available in the wide world of web styling, but I hope these hot tips can help save some time as others get their feet wet on the edge of the deep ocean that is React Bootstrap. If you have a trick or tip you think I ought to know, please reach out below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20de0d70e3f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recyclable Code]]></title>
            <link>https://medium.com/@vanessa-jesik/recyclable-code-cb6304e9ac6e?source=rss-887a54967115------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb6304e9ac6e</guid>
            <dc:creator><![CDATA[Vanessa Jesik]]></dc:creator>
            <pubDate>Fri, 18 Aug 2023 23:53:38 GMT</pubDate>
            <atom:updated>2023-08-18T23:53:38.970Z</atom:updated>
            <content:encoded><![CDATA[<p>I am just finishing up my first built-from-scratch project in my software engineering program. My two classmates and I are quite proud of what we developed using our newly learned JavaScript, HTML, and CSS skills. It is humbling to think about how far we have come in such a short time.</p><p>When I first learned to write JavaScript, as I tried to solve a given problem, I found myself frequently copy and pasting my code to replicate necessary performance in multiple instances. This was certainly functional, but resulted in cluttered code that was unnecessarily lengthy. Not to mention the code was difficult to read and follow.</p><p>Extrapolate that clutter to a larger project with many interconnected features on a website or application. Like an off-trail bushwhack through dense forest with decaying trees piled head high, repetitive code now becomes an elaborate visual and mental hurdle to slog through in order to properly navigate and error correct. Put simply, it becomes nauseatingly unbearable.</p><p>A much more tenable solution, that I am beginning to master, is to extract code function into smaller snippets that are breezy to read and understand, as well as reuse when necessary. Recyclable code. This not only makes your own life more efficient as you continue to develop subsequent features, but also aids anyone who wants to contribute to your project later on.</p><p>Let me provide you with an example of what I am talking about from our group project. The following snippet represents what my code looked like when I started as a developer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_JVIIxL1mUpx-9XyCm9nA.png" /></figure><p>Here is a fetch function sent to a JSON server. The response, once parsed, is an array of plant objects each with a name, photo, and description. The array is iterated over using the .forEach() method. A unique HTML &lt;div&gt; is created for each plant, assigned an ID attached to the plant object, and populated with the plant’s name. There is also a classname attached for styling purposes. Then, a number of event listeners are attached to each &lt;div&gt;. The mouseover and mouseleave listeners attach and detach, respectively, a classname that ultimately changes the styling of the plant name to show which on the list is being hovered over. The click listener populates queried HTML tags with information regarding whichever plant name was clicked on. The selected plant specifics are displayed in the browser in a styled card. Finally, each individual &lt;div&gt; is appended to the DOM. If all goes well with the GET request, the fetch alert, at the bottom of the code, is not triggered.</p><p>As a visual exercise, observe the length of the above paragraph. Wouldn’t it be easier to digest if the paragraph was divided into smaller paragraphs? Wouldn’t those smaller paragraphs aid in navigation of the text and editing for errors?</p><p>Similarly, code is better broken into smaller more readable pieces. Extracting function from within lengthy functions has the added benefit of making the code more recyclable. As the full functionality of the page is built out and features integrate with other aspects, code snippets can be used again and again.</p><p>Here is what this code can look like when split into more recyclable pieces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VxtZ-RsztyJvDikR7vtiZg.png" /></figure><p>Here the queried HTML elements are assigned to constants in the global scope. The fetch is isolated so it is simple to follow. The returned array is passed into a named function.</p><p>That named function, createPlantList, clearly iterates over an array passing each object into a function. The createPlantDiv function creates a &lt;div&gt;, assigns it attributes, attaches event listeners, and appends it to the DOM.</p><p>The click event listener calls displayPlantCard. This function populates a styled card with the specifics of the clicked on plant.</p><p>Much easier on the eyes! And now, as did become necessary in the project later on, the createPlantList, createPlantDiv, and displayPlantCard function can be recycled, or called again and again, without needing to duplicate their code block and messy the overall project.</p><p>I would also argue the skill of building recyclable code can be taken too far. One can build functions that endlessly call other functions that ultimately perform a simple task that could be adequately handled by a single function. However, especially when you intend to add functionality to a project over time, there is a helpful balance to strike early in the project to set contributing developers up for success down the line. Beginning with extracted, functional code that can be recycled later creates less of a headache than needing extensive reworking as you add features.</p><p>As we each grow as developers, we should strive to build recyclable code snippets so our overall projects are not repetative and messy. This skill will serve to make our code more readable and aid in our isolation of issues. All the benefits of recyclable code will ultimately allow us to be more effective collaborators and strengthen our contributions to the developer palette.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb6304e9ac6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>