<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Donna Amos</title>
    <description>The latest articles on Forem by Donna Amos (@donnacamos).</description>
    <link>https://forem.com/donnacamos</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F127314%2F41cddbf6-bc79-4f07-8795-751cb57e7bfb.jpg</url>
      <title>Forem: Donna Amos</title>
      <link>https://forem.com/donnacamos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/donnacamos"/>
    <language>en</language>
    <item>
      <title>Things I've Learned My First 90 Days as a Junior Developer</title>
      <dc:creator>Donna Amos</dc:creator>
      <pubDate>Sat, 16 May 2020 19:36:33 +0000</pubDate>
      <link>https://forem.com/donnacamos/things-i-ve-learned-my-first-90-days-as-a-junior-developer-4b9</link>
      <guid>https://forem.com/donnacamos/things-i-ve-learned-my-first-90-days-as-a-junior-developer-4b9</guid>
      <description>&lt;p&gt;Getting my first junior developer job was a long, hard road. A road that I could only see ending at the start of my job. I was so overwhelmed by the process of learning to be a developer that I didn't have the capacity to think about what I should do after I got the job. I tried to think about it but it's hard to think about something you've never really experienced.&lt;/p&gt;

&lt;p&gt;My first ninety days were somewhat rocky as they didn't have a set training program for juniors and a month after I got hired, the country went into lock down during the coronavirus pandemic, causing me all kinds of added anxiety on top of learning all the things at my new job. I made lots of mistakes and took longer to get results than I would've liked. &lt;/p&gt;

&lt;p&gt;Here's a list of what to do, what not to do and how to avoid the pitfalls that come up in the ever changing world of development at your first junior developer role. This list is by no means exhaustive and I'm sure there are others who've had different experiences for better or worse than I have. This is only from my experience and should be taken as such and nothing more or less. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Communicate, communicate, communicate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The importance of communication cannot be overemphasized. It's the foundation of all that programming is and without it, nothing can be done. If you don't know something or don't understand something don't smile and nod. Ask how to do it or what that word means. If you don't communicate what you're doing, what you have done and what you do or don't know, you're figuratively blindfolding your manager as to what you should be doing and his/her expectations for you. Your both adults and you don't have to be babysat by them but you do need to let them know exactly what you are doing with your time to make the most of it. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Knowledge is important but a good attitude is more important&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most programming jobs put emphasis on how much you know and while that is essential to your job as a developer, it's not as important as staying on good terms with your coworkers and your managers. You can have all the talent and abilities in the world but at the end of the day, it's your attitude and a kind spirit that keeps you at your job. If people enjoy working with you, they'll be much more likely to allow for mistakes and help you through gaps in your knowledge till you can catch up. Patience and understanding is worth twice as much as knowledge, which is saying a lot considering most companies hire for your knowledge. Both are valuable but a kind spirit is the most valuable. &lt;br&gt;
Remember, it's not what you say, it's how you say it. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problems: Is it a company specific or a general programming problem? &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learning programming is overwhelming. Even if you've been at it for several years, it's a lot to take in and there's so much you have to know. One of the things that really helped me was to distinguish between a company specific problem (e.g. do I have the right permissions? How does this system work?) versus a programming problem (e.g. Is this a bug I can find on Stackoverflow?) &lt;br&gt;
Once you can pick up on these patterns, it's much easier to know where or who to go to for help. If it's a company problem, ask right away. If not, Google it first before asking for help. Which brings us to the next topic. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to ask for help&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a junior, it's normal to ask for help. But asking for help is a skill in and of itself. First, determine what kind of a problem you're working on as we covered in the last paragraph. &lt;/p&gt;

&lt;p&gt;Next, Google the problem. If you've spent 30 minutes Googling and trying different solutions and nothing has helped, then ask. Be specific when you did. Communicate the problem, what you've tried and one specific question all the while taking into account they might be busy. &lt;/p&gt;

&lt;p&gt;I usually will send the question on Slack and let them know they can get to it when they can. Don't rush or be rude with another developer when asking for help. They have a full amount of work themselves and you are taking up their time. Don't apologize either though. It's part of their job to help you through a problem and help you learn what you don't know. Thank them instead. Thank them every time no matter how small the problem or quickly you figure things out. They're giving up their time and that's not always easy. &lt;/p&gt;

&lt;p&gt;Also, write down the steps it took to get through the problem for reference later. There are no dumb questions the first time but if you keep asking the same question over and over, you're not asking for help, you're asking them to do your job for you. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will have good days and bad days&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We all have our days where we're feeling good and getting stuff done. Then there are those days where we feel terrible and everything seems to blow up in our face. That's normal. What you have to fight is discouragement. As a junior, you will have a lot of bad days when nothing seems to go right, you don't feel like you will ever know enough and you will never catch up. But don't let that discourage you. Think of these days as times for you to fail and learn from those mistakes. I've made plenty of them but I haven't given up. I can't and don't want to. If I lost this job, I would look for another one. It's okay to get discouraged and have bad days but don't let that stop you. Another thing, when you do have a bad day and feel like crying, go ahead and cry. It's unhealthy to suppress those emotions. You can wait till you get home or do it in the privacy of the restroom but go ahead and let it out so you can move on again. It's not weak, it's called being human. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What you should focus on learning &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learn the flow of the system from cloning and downloading the repository to deploy. And don't forget to test your work after you've made updates or changes to the code. You can ask for a lot of help to understand how the system works and what to do. Take lots of notes and keep good records. Also, practice as much as you can going through the process. Experience is after all the best teacher. &lt;/p&gt;

&lt;p&gt;Learn how to use the tools (have someone help you walk through them). Developer tools have many features and if misused can result in some devastating events that could be avoided. I once ran a SQL update on a database, not realizing it would make changes and it took my boss eight hours to fix it. It was bad and I was horrified but I learned a valuable and painful lesson: slow down and learn how to use things before you royally screw things up. I've slowed down and been more careful ever since. &lt;/p&gt;

&lt;p&gt;Invest in yourself: buy books, courses, whatever you need to get to do better at your job. Do them in your off time or in your down time while waiting for feedback or further instructions. This profession is built on learning and growing every day. You can't know everything but you can learn a little more every single day. Take a massive problem or process and break it down into smaller bite sized pieces. &lt;/p&gt;

&lt;p&gt;Get very familiar with basic computer literacy processes and learn things other than coding languages. There's a lot more to programming than just coding languages. Principles and processes are more important to learn than languages as they can be changed but most processes and principles stay the same. Computers are complicated and there are a lot of people that have trouble using them and a lot less who know how they work on a deeper level. You must be vigilant and dedicated but don't try to remember it all. Good notes and careful records are ten times better than the best memory. Write it all down and practice, practice, practice. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take care of your health or your performance will suffer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your health is incredibly important to your work. It seems most devs suffer from insomnia and migraines. I believe this is due to stress. Being a developer is stressful since you can work for ten hours straight and still not see the results of what you've done. And then there's the overwhelming amount of knowledge you need to learn, coupled with daily tasks, communication, deadlines, meetings and no end in sight. It can get to be a black hole you feel you can't get out of and if you don't keep up your health, you could end up with anxiety and depression and other problems.&lt;/p&gt;

&lt;p&gt;The first thing I would recommend is a good night's sleep. There's no amount of coffee you can drink that will replace it. Next, is making sure you get outside at least 15 minutes a day to get some sun and a short walk. Even a walk every day is better than a long exercise routine once a week. It makes a difference. &lt;/p&gt;

&lt;p&gt;And don't forget to eat healthy and drink plenty of water. It's easy to grab pizza on the way home but eventually it will catch up to you if you do often enough. That doesn't mean that you can never do it. Just be smart about it and try to keep it to a special occasion. Remember, eating right is more about balance than restriction. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do your best&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is possibly the most important. It's easy to coast in the short term but it's also easy to for others to see through it. Your manager will pick up pretty quickly if your not getting things done. Doing your best, asking questions, taking notes, learning new things everyday is what really matters. Little by little you will start to see big results.&lt;/p&gt;

&lt;p&gt;Don't compare yourself to other juniors or think that you aren't a real developer because you didn't know something that was "common knowledge". You're job is to learn and do your best while your starting out. At the end of the day, that's all you can do.&lt;/p&gt;

&lt;p&gt;I hope you've learned some things from this short post and if you have anything else to add be sure to post in the comments below. Thanks for reading and good luck on your journey. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Tech Acronyms/Abbreviations Cheat Sheet</title>
      <dc:creator>Donna Amos</dc:creator>
      <pubDate>Tue, 20 Aug 2019 00:14:47 +0000</pubDate>
      <link>https://forem.com/donnacamos/tech-acronyms-abbreviations-cheat-sheet-477d</link>
      <guid>https://forem.com/donnacamos/tech-acronyms-abbreviations-cheat-sheet-477d</guid>
      <description>&lt;p&gt;I have a fairly poor memory when it comes to memorizing shortcuts, passwords and all things acronym. &lt;/p&gt;

&lt;p&gt;Tech has SO many of these that I finally decided it would just be best to list them all here and I will reference them when my memory fails me. &lt;/p&gt;

&lt;p&gt;I'll be adding to this list from time to time so feel free to comment your own abbreviated tech-related jargon and I'll add it to the list below. Each term is linked to its Wikipedia page for a quick reference. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AJAX - &lt;a href="https://en.wikipedia.org/wiki/Ajax_(programming)"&gt;Asynchronous JavaScript And XML&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;API - &lt;a href="https://en.wikipedia.org/wiki/Application_programming_interface"&gt;Application Programming Interface&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AR - &lt;a href="https://guides.rubyonrails.org/active_record_basics.html"&gt;ActiveRecord&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CLI - &lt;a href="https://en.wikipedia.org/wiki/Command-line_interface"&gt;Command Line Interface&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CRUD - &lt;a href="https://en.wikipedia.org/wiki/Create,_read,_update_and_delete"&gt;Create Read Update Delete&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CSS - &lt;a href="https://en.wikipedia.org/wiki/Cascading_Style_Sheets"&gt;Cascading Style Sheets&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;DB - &lt;a href="https://en.wikipedia.org/wiki/Database"&gt;Database&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;DoD - &lt;a href="https://www.agilealliance.org/glossary/definition-of-done/#q=~(infinite~false~filters~(postType~(~'page~'post~'aa_book~'aa_event_session~'aa_experience_report~'aa_glossary~'aa_research_paper~'aa_video)~tags~(~'definition*20of*20done))~searchTerm~'~sort~false~sortDirection~'asc~page~1)"&gt;Definition of Done&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;DOM - &lt;a href="https://en.wikipedia.org/wiki/Document_Object_Model"&gt;Document Object Model&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;DRY - &lt;a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself"&gt;Don't Repeat Yourself&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;ERB - &lt;a href="https://en.wikipedia.org/wiki/ERuby"&gt;Embedded Ruby&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;JS - &lt;a href="https://en.wikipedia.org/wiki/JavaScript"&gt;JavaScript&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;JSON - &lt;a href="https://en.wikipedia.org/wiki/JSON"&gt;JavaScript Object Notation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;HTML - &lt;a href="https://en.wikipedia.org/wiki/HTML"&gt;Hyper Text Markup Language&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;HTTP - &lt;a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol"&gt;HyperText Transfer Protocol&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;IDE - &lt;a href="https://en.wikipedia.org/wiki/Integrated_development_environment"&gt;Integrated Development Environment&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;IIFE - &lt;a href="https://en.wikipedia.org/wiki/Immediately_invoked_function_expression"&gt;Immediately Invoked Function Expression&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MVC - &lt;a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller"&gt;Model-View-Controller&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NPM - &lt;a href="https://en.wikipedia.org/wiki/Npm_(software)"&gt;Node Package Manager&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;OOP - &lt;a href="https://en.wikipedia.org/wiki/Object-oriented_programming"&gt;Object Oriented Programming&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;ORM - &lt;a href="https://en.wikipedia.org/wiki/Object-relational_mapping"&gt;Object-Relational Mapping&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;REGEX - &lt;a href="https://en.wikipedia.org/wiki/Regular_expression"&gt;REGular EXpression&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;REST - &lt;a href="https://en.wikipedia.org/wiki/Representational_state_transfer"&gt;REpresentational State Transfer&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;SQL - &lt;a href="https://en.wikipedia.org/wiki/SQL"&gt;Structured Query Language&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;XML - &lt;a href="https://en.wikipedia.org/wiki/XML"&gt;Extensible Markup Language&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>OO Ruby Concepts Part 3, Object Relationships</title>
      <dc:creator>Donna Amos</dc:creator>
      <pubDate>Thu, 25 Apr 2019 02:23:15 +0000</pubDate>
      <link>https://forem.com/donnacamos/oo-ruby-concepts-part-3-object-relationships-14po</link>
      <guid>https://forem.com/donnacamos/oo-ruby-concepts-part-3-object-relationships-14po</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvignette.wikia.nocookie.net%2Fplaystationallstarsfanfictionroyale%2Fimages%2F9%2F90%2FBF7_garfieldoddie.jpg%2Frevision%2Flatest%2Fscale-to-width-down%2F200%3Fcb%3D20130425191848" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvignette.wikia.nocookie.net%2Fplaystationallstarsfanfictionroyale%2Fimages%2F9%2F90%2FBF7_garfieldoddie.jpg%2Frevision%2Flatest%2Fscale-to-width-down%2F200%3Fcb%3D20130425191848" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last &lt;a href="https://dev.to/donnacamos88/oo-ruby-concepts-ii-object-attributes-5708"&gt;post&lt;/a&gt; we gave an object its attributes so it can become its own entity. But the object we made, Garfield, can't interact with any other objects. That's where object relationships comes in. If objects are modeling real world entities, they need to have a method to know who they belong to. This method is called "belongs to". Let's start with building the "Garfield" object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; &lt;span class="c1"&gt;#object &lt;/span&gt;
     &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt; &lt;span class="c1"&gt;# gives the object a name&lt;/span&gt;

   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Initialize method means the name attribute is called when #new is called &lt;/span&gt;
     &lt;span class="vi"&gt;@name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt; 
   &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

&lt;span class="n"&gt;garfield&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Garfield"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have made a cat object, Garfield, we need to give him an owner. Who else will feed him lasagna?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Owner&lt;/span&gt; &lt;span class="c1"&gt;#object &lt;/span&gt;
     &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:job&lt;/span&gt; &lt;span class="c1"&gt;# attributes about the object &lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Initialize method means the name and job attributes&lt;/span&gt;
    &lt;span class="vi"&gt;@name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt;            &lt;span class="c1"&gt;# are called when #new is called.  &lt;/span&gt;
    &lt;span class="vi"&gt;@job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt; 
  &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

 &lt;span class="n"&gt;jon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Jon"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"cartoonist"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# new method names the Owner, Jon, &lt;/span&gt;
                                      &lt;span class="c1"&gt;# and gives him a job, cartoonist  &lt;/span&gt;

 &lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;owner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;jon&lt;/span&gt; &lt;span class="c1"&gt;# Congrats! Now Garfield belongs to Jon. &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now Garfield knows that he belongs to Jon. However, what if Jon wanted another pet? In the real world, he can own as many pets as he wants. He's decided to get a dog. How do we give Jon another pet? &lt;/p&gt;

&lt;p&gt;With a method is called the "has many" relationship. It allows an object to have many objects and relate to one another. In this example, it allows the Owner, Jon, to have two pets. And any more if he wants them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;
&lt;span class="no"&gt;Class&lt;/span&gt; &lt;span class="no"&gt;Owner&lt;/span&gt; 
   &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:job&lt;/span&gt; 

 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
   &lt;span class="vi"&gt;@name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt; 
   &lt;span class="vi"&gt;@job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt; 
   &lt;span class="vi"&gt;@pets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;# this empty array is where all Jon's pets will go &lt;/span&gt;
 &lt;span class="k"&gt;end&lt;/span&gt; 

 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_pet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pet&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# this method allows Jon to add as many pets as he wants&lt;/span&gt;
   &lt;span class="vi"&gt;@pets&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;pet&lt;/span&gt; &lt;span class="c1"&gt;# the shovels(&amp;lt;&amp;lt;) push the pet class we've created into the array&lt;/span&gt;
 &lt;span class="k"&gt;end&lt;/span&gt; 

 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;pets&lt;/span&gt; &lt;span class="c1"&gt;# this method simply returns the @pets array when it is called&lt;/span&gt;
   &lt;span class="vi"&gt;@pets&lt;/span&gt; 
 &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

 &lt;span class="n"&gt;jon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pets&lt;/span&gt; &lt;span class="c1"&gt;# =&amp;gt; ["Garfield", "Odie"] this is the pets array when it is called&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to make an Object called Pet that we can use to give Jon more pets when this method is called.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Pet&lt;/span&gt; 
       &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:species&lt;/span&gt;  

   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;species&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="vi"&gt;@name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt; 
    &lt;span class="vi"&gt;@species&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;species&lt;/span&gt; 
   &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

  &lt;span class="n"&gt;odie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Pet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Odie"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"dog"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# "Odie" is the name, "dog" is the species&lt;/span&gt;
  &lt;span class="n"&gt;garfield&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Pet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Garfield"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"cat"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Congrats! Jon can now adopt his two pets.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One more method to bring all this together. The self keyword refers to the owner we're calling on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;
   &lt;span class="n"&gt;pet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;owner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt; 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this to the &lt;code&gt;add_pet&lt;/code&gt; method so we can call the &lt;code&gt;self&lt;/code&gt; keyword to let the pet know who his owner is.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;
&lt;span class="no"&gt;Class&lt;/span&gt; &lt;span class="no"&gt;Owner&lt;/span&gt; 
   &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:job&lt;/span&gt; 

 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
   &lt;span class="vi"&gt;@name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt; 
   &lt;span class="vi"&gt;@job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt; 
   &lt;span class="vi"&gt;@pets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; 
 &lt;span class="k"&gt;end&lt;/span&gt; 

 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_pet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pet&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
   &lt;span class="vi"&gt;@pets&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;pet&lt;/span&gt; 
   &lt;span class="n"&gt;pet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;owner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt; &lt;span class="c1"&gt;# self keyword &lt;/span&gt;
 &lt;span class="k"&gt;end&lt;/span&gt; 

 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;pets&lt;/span&gt; 
   &lt;span class="vi"&gt;@pets&lt;/span&gt; 
 &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 


 &lt;span class="n"&gt;jon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_pet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# calling the add_pet method &lt;/span&gt;

 &lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# =&amp;gt; "Jon", Garfield knows Jon is his owner &lt;/span&gt;

 &lt;span class="n"&gt;jon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_pet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;odie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

 &lt;span class="n"&gt;odie&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# =&amp;gt; "Jon", Odie knows Jon is his owner &lt;/span&gt;

 &lt;span class="c1"&gt;# Now Jon has two pets and they know they belong to him!&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ruby</category>
      <category>beginners</category>
    </item>
    <item>
      <title>OO Ruby Concepts Part 2, Object Attributes</title>
      <dc:creator>Donna Amos</dc:creator>
      <pubDate>Thu, 11 Apr 2019 22:17:47 +0000</pubDate>
      <link>https://forem.com/donnacamos/oo-ruby-concepts-ii-object-attributes-5708</link>
      <guid>https://forem.com/donnacamos/oo-ruby-concepts-ii-object-attributes-5708</guid>
      <description>&lt;p&gt;Last &lt;a href="https://dev.to/donnacamos88/oo-ruby-concepts-i-object-behavior-308a"&gt;post&lt;/a&gt; I discussed objects and their behavior. This post will cover the attributes of an object and how to manipulate them to cause a certain behavior. &lt;br&gt;
   Every object has attributes. To make this clear, I looked up the definition of "Attribute" on Google and here's what it said: &lt;/p&gt;

&lt;p&gt;at·trib·ute&lt;/p&gt;

&lt;p&gt;verb&lt;br&gt;
1.&lt;br&gt;
regard something as being caused by (someone or something).&lt;br&gt;
"he attributed the firm's success to the efforts of the managing director"&lt;/p&gt;

&lt;p&gt;noun&lt;br&gt;
1.&lt;br&gt;
a quality or feature regarded as a characteristic or inherent part of someone or something.&lt;br&gt;
"flexibility and mobility are the key attributes of our army" &lt;/p&gt;

&lt;p&gt;Let's stick with our Cat class from the previous post and give it two attributes, name and breed, using the 'setter' and 'getter' instance variable methods.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; &lt;span class="c1"&gt;# Object &lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#setter &lt;/span&gt;
  &lt;span class="vi"&gt;@name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;garfield&lt;/span&gt; 
  &lt;span class="k"&gt;end&lt;/span&gt; 
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;#getter &lt;/span&gt;
      &lt;span class="vi"&gt;@name&lt;/span&gt; 
  &lt;span class="k"&gt;end&lt;/span&gt; 
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;breed&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tabby&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#setter &lt;/span&gt;
     &lt;span class="vi"&gt;@breed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tabby&lt;/span&gt; 
  &lt;span class="k"&gt;end&lt;/span&gt; 
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;breed&lt;/span&gt; &lt;span class="c1"&gt;#getter &lt;/span&gt;
     &lt;span class="vi"&gt;@breed&lt;/span&gt; 
  &lt;span class="k"&gt;end&lt;/span&gt; 
 &lt;span class="k"&gt;end&lt;/span&gt; 

&lt;span class="n"&gt;garfield&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Garfield"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# "Garfield" &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This block of code contains both a "setter" and "getter" method which writes or sets the attribute and then reads or gets the attribute for the object to use. This code is long and becomes repetitive very quickly and unless you need to customize it, there's a better way to set and get attributes. &lt;br&gt;
 We use macro programming to accomplish this. Macros are a tool that allow programmers to reuse code. Attribute readers and writers are macros that implement this same code above with only two lines of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; 
   &lt;span class="nb"&gt;attr_writer&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:breed&lt;/span&gt;  &lt;span class="c1"&gt;#setter&lt;/span&gt;
   &lt;span class="nb"&gt;attr_reader&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:breed&lt;/span&gt;  &lt;span class="c1"&gt;#getter &lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, much more efficient. William Strunk, in his classic book "The Elements of Style" said, &lt;strong&gt;"Omit needless words"&lt;/strong&gt;. Macros in programming &lt;strong&gt;omit needless code&lt;/strong&gt; and allow the attributes to be added much more seamlessly. The attribute writer and reader can be further condensed with the attribute accessor like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; 
    &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:breed&lt;/span&gt; &lt;span class="c1"&gt;# setter and getter all in one line&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's make a new cat, with a name and breed and make it "Meow!" using the attribute accessor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; 
    &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:breed&lt;/span&gt; 
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;meow&lt;/span&gt; 
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Meow!"&lt;/span&gt; 
    &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

&lt;span class="n"&gt;garfield&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt; 
&lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Garfield"&lt;/span&gt; 
&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# Garfield &lt;/span&gt;
&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;breed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Tabby"&lt;/span&gt; 
&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;breed&lt;/span&gt; &lt;span class="c1"&gt;# Tabby &lt;/span&gt;
&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;meow&lt;/span&gt; &lt;span class="c1"&gt;# Meow! &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ruby</category>
      <category>beginners</category>
    </item>
    <item>
      <title>OO Ruby Concepts Part 1, Object Behavior</title>
      <dc:creator>Donna Amos</dc:creator>
      <pubDate>Wed, 10 Apr 2019 00:50:16 +0000</pubDate>
      <link>https://forem.com/donnacamos/oo-ruby-concepts-i-object-behavior-308a</link>
      <guid>https://forem.com/donnacamos/oo-ruby-concepts-i-object-behavior-308a</guid>
      <description>&lt;p&gt;Ruby's object oriented programming is hard for me to get my head around. To help me understand OO Ruby better I've decided to write a mini-series solely focused on the concepts behind the programming.&lt;/p&gt;

&lt;p&gt;I've found when learning anything, it's best to look up the definitions of the words themselves. What is Ruby programming and what's it used for? &lt;br&gt;
Let's ask Google:  &lt;/p&gt;

&lt;p&gt;Ruby is a dynamic, interpreted, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. According to the creator, Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, and Lisp.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Ruby_(programming_language)"&gt;Ruby (programming language) - Wikipedia&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What can Ruby be used for?&lt;/p&gt;

&lt;p&gt;It is used in a wide range of fields, but is best known as a language for Web Applications, because of the Ruby on Rails framework. The general purpose nature of Ruby makes it suitable for a wide array of programming tasks, just like Perl, Python and other general purpose languages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.quora.com/What-is-the-Ruby-language-and-in-which-field-is-it-used"&gt;What is the Ruby language and in which field is it used? - Quora&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great! Now that we know what Ruby is and what it is used for, we're ready to ask the next question. What is Object Oriented Programming? Google, if you please: &lt;/p&gt;

&lt;p&gt;Object-oriented programming (OOP) refers to a type of computer programming (software design) in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.webopedia.com/TERM/O/object_oriented_programming_OOP.html"&gt;What is Object-Oriented Programming? Webopedia Definition&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;You're probably thinking that I'm just looking up stuff on Google. And you'd be absolutely correct. Knowing how to use Google is one of the best skills a programmer can develop. It's a good idea to get really good at it by using it often. &lt;/p&gt;

&lt;p&gt;Now that we know what Ruby is, what it is used for and what object oriented programming, is we're ready to actually start coding. What I like to do is to get out a code block from Github, Codepen, or anywhere code is made and look at the code itself to break it down.Kind of like reverse engineering, only with code, you can use comments to explain as you go.&lt;/p&gt;

&lt;p&gt;I'm not going to take the time to explain every concept of OO Ruby. Just the Object's behavior and how it can be used in programming. Let's get right into it with a block of code with an object &lt;code&gt;Cat&lt;/code&gt; and make the &lt;code&gt;Cat&lt;/code&gt; do stuff. Let's even give it a name. Then I'll start breaking down the concepts of the object's behavior.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; &lt;span class="c1"&gt;# Cat is the object &lt;/span&gt;
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cat_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# the 'name' variable is created here &lt;/span&gt;
       &lt;span class="vi"&gt;@this_cats_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cat_name&lt;/span&gt; &lt;span class="c1"&gt;# Setter: sets up the variable for the object &lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt; 
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# this is now an instance variable. It can be called to create new Cats. &lt;/span&gt;
       &lt;span class="vi"&gt;@this_cats_name&lt;/span&gt; &lt;span class="c1"&gt;# Getter: gets the variable for the object &lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt; 
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;meow&lt;/span&gt; &lt;span class="c1"&gt;# this is a local variable and can only be used make the Cat object meow. &lt;/span&gt;
       &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Meow!"&lt;/span&gt; &lt;span class="c1"&gt;# no new cats can meow here &lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt; 
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;come&lt;/span&gt; &lt;span class="c1"&gt;# no new cats can come. Don't worry they won't come anyway. &lt;/span&gt;
       &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"I'll come when I'm ready!"&lt;/span&gt; 
   &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

&lt;span class="n"&gt;garfield&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;
&lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Garfield"&lt;/span&gt; 

&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# "Garfield" Congrats! You've made a new cat! &lt;/span&gt;

&lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;meow&lt;/span&gt; &lt;span class="c1"&gt;# Garfield can't meow. Why? meow isn't an instance variable like 'name'.&lt;/span&gt;
&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;meow&lt;/span&gt; &lt;span class="c1"&gt;# "Meow!" Cat can. Why? meow is a local variable. Only Cat can use it. &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a lot of code to begin with so let's build each method one at a time. &lt;br&gt;
First is the class method which acts as the blue print for building the object itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; 
&lt;span class="c1"&gt;# method body where stuff is built for the Cat &lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have the object Cat in our class method, let's write a local variable using an instance method and make the Cat meow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; 
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;meow&lt;/span&gt; 
   &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Meow!"&lt;/span&gt; 
   &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 

&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;meow&lt;/span&gt; &lt;span class="c1"&gt;# "Meow!" &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We made the Cat meow by creating an instance method within the class method. Instance methods make the object do stuff. The Cat can't meow unless the method is called using dot notation. Hence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;meow&lt;/span&gt; &lt;span class="c1"&gt;# puts "Meow!" &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is great! Only now we need to name the cat. Since local variables can only work on the object Cat, we need to find a way to create new cats using all the same instance methods. Otherwise, we'd have to repeat all the instance methods for every new cat. Since we're lazy programmers it's better to just reuse all the methods in Cat for every new cat we want to create. How is this done? Enter the instance variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; 
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cat_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# the 'name' variable is created here &lt;/span&gt;
       &lt;span class="vi"&gt;@this_cats_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cat_name&lt;/span&gt; &lt;span class="c1"&gt;# Setter: sets up the variable for the object &lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt; 
   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# this is now an instance variable. It can be called to create new Cats. &lt;/span&gt;
       &lt;span class="vi"&gt;@this_cats_name&lt;/span&gt; &lt;span class="c1"&gt;# Getter: gets the variable for the object &lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt; 


&lt;span class="n"&gt;garfield&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;
&lt;span class="no"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Garfield"&lt;/span&gt; 

&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;garfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt; &lt;span class="c1"&gt;# "Garfield" Congrats! You've made a new cat!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instance variables have two methods. The first method takes in an argument and sets that argument equal to a variable. The second method is responsible for reading or getting the name. The instance variable is called using the &lt;code&gt;@&lt;/code&gt; symbol. This assures the attribute or in this case the &lt;code&gt;name&lt;/code&gt; can be used to give other cats names, not just the object &lt;code&gt;Cat&lt;/code&gt;. &lt;br&gt;
Instance variables are basically containers for attributes of the object, which is the topic of &lt;a href="https://dev.to/donnacamos88/oo-ruby-concepts-ii-object-attributes-5708"&gt;Object Oriented Ruby Concepts Part 2&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>ruby</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
