<?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>DEV Community: Khalif Cooper</title>
    <description>The latest articles on DEV Community by Khalif Cooper (@kcooperdev).</description>
    <link>https://dev.to/kcooperdev</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%2F364512%2F7a398ccf-1a29-4c0b-b6d4-86131768b223.jpeg</url>
      <title>DEV Community: Khalif Cooper</title>
      <link>https://dev.to/kcooperdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kcooperdev"/>
    <language>en</language>
    <item>
      <title>What is Data Engineering?!!!</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Fri, 27 Nov 2020 18:06:30 +0000</pubDate>
      <link>https://dev.to/kcooperdev/what-is-data-engineering-4m95</link>
      <guid>https://dev.to/kcooperdev/what-is-data-engineering-4m95</guid>
      <description>&lt;p&gt;Data Engineering is not new concept or new career path. Its a old concept. The idea and core of data engineering, and what its' all about has been around for a long time. The only difference is now, its being redesigned, redeveloped and re modified. &lt;/p&gt;

&lt;p&gt;Think of full stack developers. A full stack developer, is just a back-end and front-end developer merged together. Likewise, If you ever  think about databases or know people that are DBAs, SQL, and ETL Developers, then you seen data engineering before. You just seen it in a different light or perspective. &lt;/p&gt;

&lt;p&gt;Data Engineering in simple terms consists of taking data from one place to another. To dive a little deeper, the reasoning behind why we need data engineering is the most important part. &lt;/p&gt;

&lt;p&gt;Lets start with ETL. ETL in the beginning sounds confusing but we are going to start with the basics. &lt;/p&gt;

&lt;p&gt;E stands for Extract. Extract meaning remove or withdraw, data from different sources. So the source can be data from ESPN, Yahoo News, CNN, CBS etc.. &lt;/p&gt;

&lt;p&gt;T stands for Transform. Initially when you extract data from these different sources, the data may be unstructured, may be under performing in terms of speed, or may need to join some data together into one table. This is where you will do this part. &lt;/p&gt;

&lt;p&gt;L stands for Load. So, this is the final part. It means to store the data, that was transform somewhere in a data lake or data warehouse.&lt;/p&gt;

&lt;p&gt;You can learn more about data lakes and data warehouses:&lt;a href="https://www.guru99.com/data-lake-vs-data-warehouse.html"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You store the data in Google Cloud's Big Query, Azure SQL Database or AWS Redshift Data Warehouse. This is ETL. Congrats! You now know what ETL is, if you always wanted to know or if you want to teach someone else. &lt;/p&gt;

&lt;p&gt;So there are some additional features around ETL, that you hear about such as Apache Airflow, Luigi, AWS Glue, Apache Spark. These are all tools that are either apart of the ETL process or makes the ETL pipelines more efficent at doing their job. &lt;/p&gt;

&lt;p&gt;For example, Apache Airflow is used for scheduling or creating cron jobs to say something like "update this table of users in this particular database everyday at 6am pacific time". There is a lot more in data engineering but this is the bare bones on data engineering to get you started. &lt;/p&gt;

&lt;p&gt;I hope this tutorial was informational and it gave a general idea of what data engineering is. Stay tuned to my next data engineering article where I am going to teach you how to write your own ETL pipeline in python. &lt;/p&gt;

</description>
      <category>datascience</category>
      <category>database</category>
      <category>news</category>
    </item>
    <item>
      <title>         Who wants a cookie? !</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Mon, 05 Oct 2020 19:12:57 +0000</pubDate>
      <link>https://dev.to/kcooperdev/who-wants-a-cookie-4d2k</link>
      <guid>https://dev.to/kcooperdev/who-wants-a-cookie-4d2k</guid>
      <description>&lt;ul&gt;
&lt;li&gt;What are cookies?!&lt;/li&gt;
&lt;li&gt;Why are they so darn important? &lt;/li&gt;
&lt;li&gt;And why do I need to know about them? &lt;/li&gt;
&lt;li&gt;Are cookies bad or good?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, I am going to explain what you need to know about cookies.Who, uses cookies; What are they used for and why we use cookies. I will show you the good, the bad, and the ugly. &lt;/p&gt;

&lt;h1&gt;
  
  
  What is a cookie?
&lt;/h1&gt;

&lt;p&gt;So, What is a cookie? Well, my friend, think of a cookie as a small digital box or file that collects and stores information.  So, let's say if you visit facebook.com or gmail.com to login or to create an account; When you make that action, the site triggers a cookie, file that collects and stores information, to captures your login information. The might include a unique identifier, username and password, as well as some other info we will talk about later in the article. &lt;/p&gt;

&lt;p&gt;So, next time, you go to facebook.com or gmail.com to login, the site will read the cookie from the last time you visited the site. That same cookie will be read and see your login information then you will be able to login, without providing any information again. This is how users are able to login automatically into a Instagram, Gmail, Facebook, and Outlook without logging in.&lt;/p&gt;

&lt;p&gt;This sounds awesome! so, what is the bad news..give it to me. So, there are two types of cookies, and by your personal preference one of them can bad. You have first party cookies and third party cookies. &lt;/p&gt;

&lt;h1&gt;
  
  
  First Party Cookies
&lt;/h1&gt;

&lt;p&gt;A First Party Cookies is a cookie that collect information for the particular site you are on, lets' say Twitch. Twitch will collect information to improve performance speed and other things so next time you visit their site you have a better experience. &lt;/p&gt;

&lt;h1&gt;
  
  
  Third Party Cookies
&lt;/h1&gt;

&lt;p&gt;A Third Party Party Cookie is a cookie created by domains and not the website. They are scripts that are place on other sites that are unrelated to the particular website that you are on. Like, first party cookies they also that collect information from you. And if you don't want to be track by random sites, well that would be where the bad part would come in. Although, third party cookies help other businesses for marketing purposes. &lt;/p&gt;

&lt;p&gt;So, this was an introduction to get you started on what cookies are? Why I need to know about them? etc.. I hope this article helped giving you so insight on cookies. Below I will drop some resources as well, if you want to see how to implement cookies in Javascript. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Resources&lt;/code&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies"&gt;https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>javascript</category>
    </item>
    <item>
      <title>  How Twitter Changed My Life As A Developer</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Fri, 24 Apr 2020 09:16:42 +0000</pubDate>
      <link>https://dev.to/kcooperdev/how-twitter-changed-my-life-as-a-developer-2g82</link>
      <guid>https://dev.to/kcooperdev/how-twitter-changed-my-life-as-a-developer-2g82</guid>
      <description>&lt;p&gt;&lt;strong&gt;(And How It Can Change Yours Too)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I never, personally was that big into social media. It always dawned on me how people spend countless hours staring at a screen eating away at their souls was beyond me. As time went on and I became a developer, I wanted to teach other people code and I didn't really know where to look or go. &lt;/p&gt;

&lt;p&gt;I wanted to meet and connect with developers outside my environment, and non-technical people who might be interested in tech, as well; Which hence, Twitter. And more social media. And then the holy grail of it all, we are human, and we like connection or connecting with people by human nature. And now even more, with the stay at home order in effect, social media is not really going anywhere at soon. If you are using social media, Tik Tok is life right now, these days. Its' Everywhere. &lt;/p&gt;

&lt;p&gt;So, What's the point of this article? To show you how social media can increase value as a developer or how you can leverage it to suit your needs about where you want to be in your career or your own business. &lt;/p&gt;

&lt;p&gt;1 . &lt;strong&gt;Twitter Will Help Grow Your Value As A Developer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/jkZc8OAlapk8DFRNlA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/jkZc8OAlapk8DFRNlA/giphy.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everyone who is everyone is on twitter, &lt;a href="https://twitter.com/wesbos"&gt;Wes Bos&lt;/a&gt;, &lt;a href="https://twitter.com/@stolinski"&gt;Scott Tolinski&lt;/a&gt;, &lt;a href="https://twitter.com/youyuxi"&gt;Evan You&lt;/a&gt;, the list goes on. If you are working on a new article, or video, or anything and you are active on the site. Random people see it and retweet it(non-twitter people [repost it]) and like it. And after a while, you will have more followers than you thought interested in your content. And then, next thing, you know it, everyone knows you by the content you wrote, or a podcast you did, which leads to the next reason...&lt;/p&gt;

&lt;p&gt;2 . &lt;strong&gt;Twitter Will Help Create More Opportunities For You&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/26gsiCIKW7ANEmxKE/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/26gsiCIKW7ANEmxKE/giphy.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before Twitter, don't get me wrong I still got job opportunities. But on twitter, there are people on twitter that literally spend their time helping people find jobs like &lt;a href="https://twitter.com/teneikaask_you/status/1252766623963938818"&gt;this one&lt;/a&gt;, &lt;a href="https://twitter.com/42jobs_react"&gt;and this one&lt;/a&gt;, just to name a few. You don't have to use it, but it doesn't hurt either. Other developers collaborate alot on the platform as well. &lt;a href="https://twitter.com/florinpop1705/status/1252708373323268099"&gt;Here is one&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;3 . &lt;strong&gt;Twitter Will Make You Care About The People On It&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/1XdeBbiapMAvgVKwTE/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/1XdeBbiapMAvgVKwTE/giphy.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I first started on Twitter, I thought of it as way, people just talk about random things, which is still true. But, everyone has a different purpose on there. For some its', simply to meet new people. For others, it is sharing their content, book they wrote, a new product they built, or a speaking engagement etc. And also it can be to meet other like minded or opposite minded people who can not only be colleagues but mentors as well. And when you are involve in all this, the connections you make, can also be the people you become friends with later, which makes it all pretty cool.  &lt;/p&gt;

&lt;p&gt;4 . &lt;strong&gt;Twitter Will 10x You or At Least Make More Aware of Tech Community&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xTiTnsEwaGCL1qUkBW/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xTiTnsEwaGCL1qUkBW/giphy.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I never thought I would say this but because of Twitter, I found Dev.to. I went to this conference two years ago, called &lt;a href="https://www.refactr.tech/"&gt;Refector Tech&lt;/a&gt; and then I met alot of Developer Advocates from Twilio, Cloudinary, Abstract etc. And they all kept asking if I have a Twitter, and I'm thinking who uses Twitter anymore. But, once I joined and took their advice, I was so wrong. &lt;/p&gt;

&lt;p&gt;When I joined I met a developer on Twitter, and he told me I should start writing on dev.to, and here I am. Its also nice to find out the latest release for dart, or react, or whatever language you programming in, instantly. Its' nice. Or to find out when your favorite people in tech are releasing new content or when a new conference or event is coming up.&lt;/p&gt;

&lt;p&gt;Twitter is not for everyone and there is definitely more ways to get the same response on other platforms but wanted to share how Twitter has and is evolving itself, and the dev community&lt;/p&gt;

</description>
      <category>devrel</category>
      <category>webdev</category>
      <category>career</category>
      <category>writing</category>
    </item>
    <item>
      <title>5 Steps To Your Dream Job </title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Wed, 15 Apr 2020 22:19:00 +0000</pubDate>
      <link>https://dev.to/kcooperdev/5-steps-to-your-dream-job-2fe0</link>
      <guid>https://dev.to/kcooperdev/5-steps-to-your-dream-job-2fe0</guid>
      <description>&lt;p&gt;1 . Learn Data Structures &amp;amp; Algorithms&lt;/p&gt;

&lt;p&gt;"You don't know the fundamentals". I was told this by one of my co-workers and I never really understood it until later in my career. I always thought "What are they talking about, I know what arrays, functions, lists, are and I know how they work". But, it wasn't until I heard it again, and it reminded me of a quote by Linus Torvalds, "Bad programmers worry about code. Good programmers worry about data structures and their relationships". Good data structures can make your code easier to follow and understand, will make your code easier to maintain, and will help your career as it develops, long term. A poor understanding of data structures and algorithms and your code will look like spaghetti and be hard to follow. Structuring how your code will look, what it should return, how it should work, line by line will give a deeper understanding of the code you write. Learning these fundamentals and concepts can be applied to any programming language, this is why it is important to know them and practice them. Great recommendations that has helped me learn them are:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.amazon.com/Grokking-Algorithms-illustrated-programmers-curious/dp/1617292230" rel="noopener noreferrer"&gt;Grokking Algorithms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press/dp/0262033844" rel="noopener noreferrer"&gt;Introduction to Algorithms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.amazon.com/Problem-Solving-Algorithms-Structures-Python/dp/1590282574/ref=sr_1_13crid=3C4H4OPML3E9P&amp;amp;keywords=data+structures+and+algorithms&amp;amp;qid=1548140193&amp;amp;s=Books&amp;amp;sprefix=data+structure%2Cstripbooks%2C143&amp;amp;sr=1-13" rel="noopener noreferrer"&gt;Problem Solving with Algorithms and Data Structures Using Python&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 . Attend Virtual or Online Meetups(Networking)&lt;/p&gt;

&lt;p&gt;Networking is a very important skill when you are looking for a job. It is one of the most important techniques to land your dream job. Even if you go to one virtual meetup a week, there is still at least 50% percent chance you might meet someone, who is one of these three people, a recruiter for the job you want, an employee who works for that company, or even better, a direct client that is trying to fulfill a vacancy for the position you have been looking for. Either way, it goes, meeting people creates a connection that brings you one step closer to your goal. Think of it this way, you can meet some one day, and the same person could get you into a position that you wanted or an interview at your dream company, all based on that connection. Networking creates connections and connections create opportunities.&lt;/p&gt;

&lt;p&gt;3 . Practice, Practice, Practice&lt;/p&gt;

&lt;p&gt;Code Everyday. Seriously. Have you ever worked out at the gym and stopped. Then maybe a couple months later, tried to workout again, and your muscles are hurt and sore for the first week and wonder why. Its because your body wasn't conditioned to the same workout you have done a couple months ago. So you have to retrain your body again. It is the same when you code, imagine you are in the middle of writing a program or maybe you built an application. And you stepped away for a week or two. When you come back, you will have no idea what you were working on and might even get lost in your application. So, it is vital to code everyday. If not everyday, at least two to three times a week. Practicing will challenge your mind, and help you grow as a programmer. Which leads to my next point...&lt;/p&gt;

&lt;p&gt;4 . Comment Your Code&lt;/p&gt;

&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%2Fimages.unsplash.com%2Fphoto-1517842645767-c639042777db%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1500%26q%3D80" 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%2Fimages.unsplash.com%2Fphoto-1517842645767-c639042777db%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1500%26q%3D80" alt="Photo by David Travis on Unsplash"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Commenting your code is a good tip, if you step away from your code or need a break to rest your mind for a few days. Write pseudo code or comments that specifically explain what your code is doing and how your code is supposed to work. Be descriptive. Imagine if you had to give a presentation to a group of new developers explaining how the classes or functions you wrote should work. For example, if you have a function that takes some parameters. Write what parameters, the function may expect, whether it is a string, a boolean or an integer. Write what the return value should look like, is it going to return dictionary? a list? or an object ? Commenting your code, can help you and other developers understand the code you have written.&lt;/p&gt;

&lt;p&gt;5 . Learn, Build, Teach...Then Repeat.&lt;/p&gt;

&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%2Fimages.unsplash.com%2Fphoto-1517768692594-b4295586b7d6%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1510%26q%3D80" 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%2Fimages.unsplash.com%2Fphoto-1517768692594-b4295586b7d6%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1510%26q%3D80" alt="Photo by Debby Hudson, building bricks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The last step to finding your dream job is to learn a new skill, something you don't have domain knowledge about. It could be a new language you are learning, a data structure you learned about, a new topic you are interested in etc. This is the learning phase. Next is build. Build something using what you learned. &lt;/p&gt;

&lt;p&gt;It doesn't have to be complex, it can be simple. What matters is recycling what you have learned and being able to implement it. Remember being a good developer and getting your career where you see it, is about taking small consistent steps everyday towards that goal. Another good way to learn is building a todo list, or calculator.&lt;/p&gt;

&lt;p&gt;Everyday, you can add or implement a new feature or concept to your todo list. The last phase is important. Teach, what you have learn and build. I have always went by this rule, if you can teach it to someone who knows nothing about it, and they can understand maybe not every technical detail but based on how you explain it able to understand the concepts. Then you know it.&lt;/p&gt;

&lt;p&gt;Another option is writing. Write an article. If you learn about recursion, linked lists, redux, or whatever you learn, write about it. It will not only cement what you know but also help other developers. One last option is give a talk or presentation at a meetup, about what you learned. Not only will that help teach others but will help build your network. And might possibly land you your dream job!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>codenewbie</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Encapsulation in Dart: Part 5</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Wed, 15 Apr 2020 00:14:50 +0000</pubDate>
      <link>https://dev.to/kcooperdev/encapsulation-in-dart-part-5-1oo4</link>
      <guid>https://dev.to/kcooperdev/encapsulation-in-dart-part-5-1oo4</guid>
      <description>&lt;p&gt;We made it! Part 5 of the object oriented programming series. we will be discussing what is the purpose, use cases, and what does encapsulation even mean. Encapsulation is use to hide a specific property or method  only making those properties accessible within the scope of the function.&lt;/p&gt;

&lt;p&gt;A real world example would be if you are with some friends. And you have a piece of cake in a public environment, those friends have also have access to your piece of cake but if you take your piece of cake to another area which is private or protected then the piece of cake is no longer accessible to your friends. This is a real world example of encapsulation.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;File: cake.dart&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;library&lt;/span&gt; &lt;span class="n"&gt;cake&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MainCake&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;//non-private property&lt;/span&gt;
&lt;span class="c1"&gt;//list of strings&lt;/span&gt;
 &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;randomPieceOfCakes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'cake3'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'cake4'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'cake5'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'cake6'&lt;/span&gt;&lt;span class="o"&gt;];&lt;/span&gt;

 &lt;span class="c1"&gt;//private properties&lt;/span&gt;
 &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;_pieceOfCake1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"cake1"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
 &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;pieceOfCake2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"cake2"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;p&gt;&lt;code&gt;File: main.dart&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'cake.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
  &lt;span class="n"&gt;MainCake&lt;/span&gt; &lt;span class="n"&gt;newCake&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;MainCake&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="c1"&gt;//non-private property -  randomPieceOfCakes&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCake&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;randomPieceOfCakes&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;//private property - piece of cake&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCake&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;_pieceOfCake1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// private property error&lt;/span&gt;

  &lt;span class="c1"&gt;// non-private private - piece of cake&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCake&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pieceOfCake2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Encapsulation in Dart happens at library level instead of class level unlike other object oriented programming languages.&lt;/p&gt;

&lt;p&gt;In Dart, (_) underscores in Dart are private. This wraps up the series on object oriented programming. Hope you enjoyed it!&lt;/p&gt;

</description>
      <category>oop</category>
      <category>dart</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Inheritance in Dart: Part 4</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Mon, 13 Apr 2020 20:46:15 +0000</pubDate>
      <link>https://dev.to/kcooperdev/inheritance-in-dart-part-4-4a66</link>
      <guid>https://dev.to/kcooperdev/inheritance-in-dart-part-4-4a66</guid>
      <description>&lt;p&gt;This is part 4 of the object oriented programming series. We started in Part 1 with Classes and Object, then over to Part 2 with Abstraction, then the previous article with Polymorphism. This section will be super short as we have implemented inheritance indirectly in the previous articles. We will be going over the example and will wrap up from there. &lt;/p&gt;

&lt;p&gt;Inheritance. What is Inheritance in programming? Inheritance is the process of inheriting or receiving features or methods from an existing class. In Abstraction we used inheritance, will we were extending the existing class and "inherited" some of the parent's class properties and methods. &lt;/p&gt;

&lt;p&gt;An example of Inheritance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;drive&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"driving"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Honda&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
   &lt;span class="n"&gt;Honda&lt;/span&gt; &lt;span class="n"&gt;car1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Honda&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="n"&gt;car1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;drive&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

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



&lt;p&gt;As you see in the example above; We create a new instance of the "Car" class(parent class). Next, we created a subclass(child class), with the class name of "Honda" and extend the "Car" class. Extending the "Car" class allows "Honda" to receive all the properties and features from the parent class. &lt;strong&gt;SIDE NOTE:&lt;/strong&gt; Unlike polymorphism, inheritance does not change the behavior or functionality of the methods that the class inherits or receives.&lt;/p&gt;

&lt;p&gt;Hope you enjoyed this article all about inheritance, until the next one...Stay Tuned..&lt;/p&gt;

</description>
      <category>oop</category>
      <category>dart</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Polymorphism in Dart: Part 3</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Sun, 12 Apr 2020 23:16:51 +0000</pubDate>
      <link>https://dev.to/kcooperdev/polymorphism-in-dart-part-3-3n2l</link>
      <guid>https://dev.to/kcooperdev/polymorphism-in-dart-part-3-3n2l</guid>
      <description>&lt;p&gt;We will be continuing our series on objected oriented programming. This article will be a bit short as we discussed it indirectly in the previous article. Need a hint? This principle involves method overriding. So next we are moving on to our topic, polymorphism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Poly&lt;/strong&gt;, which means "many" and &lt;strong&gt;morph&lt;/strong&gt;, meaning morphing into different forms or shapes. Together, Polymorphism, means creating many forms or configurations. A real world example of polymorphism would be if we are buying a car feature. Lets' say a new car feature was just released. The feature is to enable self driving. The result is the car will still drive no matter. But if we modify the driving feature or function and update it. Then instead of the basic automatic driving feature, we can update functionality, and the car can drive itself without human support. &lt;/p&gt;

&lt;p&gt;In the real world this is &lt;strong&gt;Polymorphism&lt;/strong&gt;. Polymorphism is updating or modifying a feature, function, or implementation that already exist in the parent's class. &lt;/p&gt;

&lt;p&gt;An Programmatic Example of Polymorphism:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;driving&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"driving car 1"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Honda&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;//override method overrides generic driving method&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;driving&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"driving car 2"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;driving&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//calls generic driving method&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt; 
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt; 
  &lt;span class="n"&gt;Honda&lt;/span&gt; &lt;span class="n"&gt;car1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Honda&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="n"&gt;car1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;driving&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nl"&gt;output:&lt;/span&gt;
&lt;span class="n"&gt;driving&lt;/span&gt; &lt;span class="n"&gt;car&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="n"&gt;driving&lt;/span&gt; &lt;span class="n"&gt;car&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

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



&lt;p&gt;The &lt;strong&gt;@override&lt;/strong&gt; annotation is a note/comment to let someone one know this method is overridden the generic method derived from the parent class. The keyword "super" calls the parent class. This sums of method overriding. Next up is inheritance. So, Stay tuned..&lt;/p&gt;

</description>
      <category>oop</category>
      <category>dart</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Abstraction in Dart: Part 2</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Sat, 11 Apr 2020 19:02:26 +0000</pubDate>
      <link>https://dev.to/kcooperdev/abstraction-in-dart-part-2-ipd</link>
      <guid>https://dev.to/kcooperdev/abstraction-in-dart-part-2-ipd</guid>
      <description>&lt;p&gt;Abstraction is one of the four main principles of objected oriented programming, as we discussed in the first part. Abstraction means in simple terms to hide unnecessary details.&lt;/p&gt;

&lt;p&gt;An example would be an application; On the back-end, users don't care about what server the application is running on, how much space is being allocated(space being used) or how many api requests are being made daily. Most users only care if the application is working correctly, and there are no errors on the front-end. &lt;/p&gt;

&lt;p&gt;In the example below, to initialize abstraction in dart; create an "abstract class" with the name of the class you want to create. And add some abstract methods, void methods, that don't return a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;(){}&lt;/span&gt;
      &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;awards&lt;/span&gt;&lt;span class="o"&gt;(){}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In the example below we create a subclass then extend it. In, abstraction, a subclass or child class extending an abstract class is also required to have methods from the parent class or else an error will occur.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JKRowling&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;//   void drive(){&lt;/span&gt;
&lt;span class="c1"&gt;//     print("driving");&lt;/span&gt;
&lt;span class="c1"&gt;//   }&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;JKRowling&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nl"&gt;output:&lt;/span&gt;
  &lt;span class="nl"&gt;Error:&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;non&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="nc"&gt;JKRowling&lt;/span&gt;&lt;span class="s"&gt;' is missing implementations for 
  these members 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If we uncomment the method in the JKRowling's class derived from the Author's class. Then, create a new instance of the JKRowling's class; We will see that our output no longer gives us an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JKRowling&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"harry potter"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;JKRowling&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But, the example above will not output anything because the books method in the parent class is null. In order to see&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;bookswritten1.books()&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 value; The parent class, Author's books method has to be overridden. It is also called method overriding. Method overriding lets you modify or update a specific implementation of a method from a parent's class. Every subclass that uses the abstract class needs to have an override method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JKRowling&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"harry potter"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
   &lt;span class="n"&gt;JKRowling&lt;/span&gt; &lt;span class="n"&gt;booksWritten1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;JKRowling&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
   &lt;span class="n"&gt;booksWritten1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;output&lt;/span&gt;
&lt;span class="n"&gt;harry&lt;/span&gt; &lt;span class="n"&gt;potter&lt;/span&gt;

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



&lt;p&gt;Now we see what we were expecting.&lt;/p&gt;

&lt;p&gt;Abstract classes also can't create new instances of themselves. Look in the example below..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JKRowling&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"harry potter"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
   &lt;span class="n"&gt;Author&lt;/span&gt; &lt;span class="n"&gt;author1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nl"&gt;output:&lt;/span&gt; 
&lt;span class="nl"&gt;Error:&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="s"&gt;' is abstract and can'&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;instantiated&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SIDE NOTE:&lt;/strong&gt; Abstract classes can't extend or use multiple abstract classes. If you run the code below, it will spit out an error. If we wanted to use multiple abstract classes's functionalities we would have to look to another type of abstraction called interfaces.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Movies&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JKRowling&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Movies&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"harry potter"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
   &lt;span class="n"&gt;JKRowling&lt;/span&gt; &lt;span class="n"&gt;booksWritten1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;JKRowling&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
   &lt;span class="n"&gt;booksWritten1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Interfaces is similar to abstractions but the main difference, is that &lt;strong&gt;interfaces&lt;/strong&gt; can extend or "implement" multiple abstract classes. In dart, there aren't any interfaces. So, here we create our own interface using abstract classes. In other programming languages, "interface class_name" is used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Movies&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JKRowling&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="n"&gt;Author&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Movies&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"harry potter"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
   &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"fantastic beasts and where to find them"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;JKRowling&lt;/span&gt; &lt;span class="n"&gt;booksWritten1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;JKRowling&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;booksWritten1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;books&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;booksWritten1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nl"&gt;output:&lt;/span&gt;
&lt;span class="n"&gt;harry&lt;/span&gt; &lt;span class="n"&gt;potter&lt;/span&gt;
&lt;span class="n"&gt;fantastic&lt;/span&gt; &lt;span class="n"&gt;beasts&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;where&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;find&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt;

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



&lt;p&gt;In the example above, we can see that how interfaces can be useful to us.&lt;/p&gt;

&lt;p&gt;This is was an introduction in knowing what abstraction is, how is it works, what purpose abstraction serves and ways that it can be beneficial.&lt;/p&gt;

</description>
      <category>dart</category>
      <category>oop</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Classes and Objects in Dart: Part 1</title>
      <dc:creator>Khalif Cooper</dc:creator>
      <pubDate>Sat, 11 Apr 2020 01:59:56 +0000</pubDate>
      <link>https://dev.to/kcooperdev/classes-and-objects-in-dart-part-1-24o5</link>
      <guid>https://dev.to/kcooperdev/classes-and-objects-in-dart-part-1-24o5</guid>
      <description>&lt;p&gt;Do you ever have trouble with OOP? Object Oriented Programming. Do you know what it entails? Do you want to be able to not only understand the concepts but, be able to implement them as well? If you answered yes to any of the following questions, then today is your day.&lt;/p&gt;

&lt;p&gt;I will be creating a series of five parts going over objected oriented programming discussing classes, objects, (abstraction, polymorphism, encapsulation and inheritance). Outside of classes, and objects; these four concepts make up what is called the four pillars or principles of object oriented programming.&lt;/p&gt;

&lt;p&gt;Other objected oriented languages that you might use everyday include Java, C#, C++, PHP, JavaScript, Smalltalk, Python, Dart, Swift, etc.&lt;/p&gt;

&lt;p&gt;Dart will be the language used in this series. If you want to follow along, you can use this awesome &lt;a href="https://dartpad.dev/"&gt;online dart editor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note: "class" is a keyword in dart and what follows after is the class name.&lt;/p&gt;

&lt;p&gt;Think of a class as an initial blueprint or template. Lets' imagine for a minute, a car with nothing on it, a bare bones car, with no wheels, no windows, no color, nothing. The car itself is a class. A class tells you "What" it is and a class can only be declared once. So, for example, a type of a car could be a Limo, Sedan, Truck, Van, and a Taxi; but at the end of the day, every type of car, is still a car itself. They are all made from the initial car. So lets' see what a car class looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;  &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now on to Objects! In the example above, we created an initial blueprint, "class" with the class name of "Car".&lt;/p&gt;

&lt;p&gt;An object is also the name of a class, which is "Car" in our case. And if we wanted to create one copy of the "Car" class; it will create an object that will be an instance of a class. So, to put it all together, every time a copy of the initial class is created, an instance of an object and class will be created as well.&lt;/p&gt;

&lt;p&gt;How? Lets' go back to our imagination again. You are at the dealership and you are not able to make up your mind what type of car you want. So you buy a Limo, Sedan, Truck, Van, and a Taxi. Every car that is made will use this original "Car" model class to create another one. All of those types of cars, will be considered objects that are "instances" or copies derived from the original "Car" class we made above. So in code that would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

   &lt;span class="o"&gt;}&lt;/span&gt;

 &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;limo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;sedan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;van&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;taxi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limo&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//instance of 'Car'&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Note: In Dart, we use the "void" keyword, which is used when you create a method or function that doesn't return a value. The main method is required in dart to run any code. And In the main method we use the "new" keyword to create those instances. When we print out the limo instance, it tells us, we created an instance of the car class.&lt;/p&gt;

&lt;p&gt;Now that is cleared up, lets' go back to our "Car" class. Inside of our "Car" class, we need to include some information or details as well as functionality about our car. For example, color, wheels, windows, make, how fast it goes, what sound does the car make etc..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
     &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;wheels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
     &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;windows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;mph&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"up to &lt;/span&gt;&lt;span class="si"&gt;$speed&lt;/span&gt;&lt;span class="s"&gt; mph"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
     &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;carEngineStart&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
       &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"zzzrrrroooommmm"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
       &lt;span class="o"&gt;}&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;

 &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;limo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;sedan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;van&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
     &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;taxi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;wheels&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 4&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;windows&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 4&lt;/span&gt;
     &lt;span class="n"&gt;limo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;carEngineStart&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;&lt;span class="c1"&gt;// zzzrrrroooommmm&lt;/span&gt;
     &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;limo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;mph&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;&lt;span class="c1"&gt;// up to 65 mph&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In the example, we created a void method that takes an integer and prints out the speed and string method that prints out car sound. Then in the main method, we called those methods on the instances.&lt;/p&gt;

&lt;p&gt;Hope you learned about what OOP is in this article. And learned in summary, that when a class is first created, it creates a blueprint of an object. Also inside of a class, you can create methods and properties that can be initialize when you create multiple copies or instances of the original class. And when you will create instances of the class. You also create instances of the object as well.&lt;/p&gt;

</description>
      <category>oop</category>
      <category>dart</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
