<?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: Ian</title>
    <description>The latest articles on DEV Community by Ian (@dreamhollow4219).</description>
    <link>https://dev.to/dreamhollow4219</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%2F1090852%2F8c6bc5ae-2bb6-4813-8dfb-f9a95611528c.jpeg</url>
      <title>DEV Community: Ian</title>
      <link>https://dev.to/dreamhollow4219</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dreamhollow4219"/>
    <language>en</language>
    <item>
      <title>Really understanding "objects" in object-oriented programming.</title>
      <dc:creator>Ian</dc:creator>
      <pubDate>Sat, 28 Oct 2023 18:42:53 +0000</pubDate>
      <link>https://dev.to/dreamhollow4219/really-understanding-objects-in-object-oriented-programming-1em0</link>
      <guid>https://dev.to/dreamhollow4219/really-understanding-objects-in-object-oriented-programming-1em0</guid>
      <description>&lt;h2&gt;
  
  
  What is object oriented programming and why is it used?
&lt;/h2&gt;

&lt;p&gt;Reviewing the reason for the popularity and widespread usage of object oriented programming is important for everyone interested in languages that favor such a programming style.&lt;/p&gt;

&lt;p&gt;Simply put, object oriented programming is the idea that your code is broken down into uniquely controlled and accessible sections of data.&lt;/p&gt;

&lt;p&gt;These "sections" are objects; data types with uniquely modified traits that allow program parts to interact with less overhead.&lt;/p&gt;

&lt;p&gt;But why are they used?&lt;/p&gt;

&lt;p&gt;The most common reason would be using sets of data in different parts of a program without having a developer making special calls or functions to execute what can be re-used.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an example of an object in a program?
&lt;/h2&gt;

&lt;p&gt;Think of a simple button.&lt;/p&gt;

&lt;p&gt;In most situations, a button has a singular purpose tied to it's overall function. If someone presses the "home" button on a web browser, they expect their browser to take them to the webpage they set as their "home" website.&lt;/p&gt;

&lt;p&gt;Another example is a "New Game" button in a videogame. A player pressing the "New Game" button knows exactly what the button is supposed to do; it's supposed to start the sequence of code that allows a player to start a game from the beginning.&lt;/p&gt;

&lt;p&gt;Here is a sample of some actual C++ code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// New game
if (this-&amp;gt;buttons["GAME_STATE"]-&amp;gt;isPressed()) {
    this-&amp;gt;states-&amp;gt;push(new GameState(this-&amp;gt;stateData));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "Game State" button is pressed, but the button itself says "New Game" and is meant to start the events that begin the game. There's a complex unseen event sequence happening here where the program will load in a bunch of relevant data; this includes players, enemies, map data, in-game objects, and more!&lt;/p&gt;

&lt;p&gt;All from the press of the 'button' object.&lt;/p&gt;

&lt;p&gt;This should help clarify for anyone who might not fully understand the true nature of "object oriented" programming. &lt;/p&gt;

&lt;p&gt;It is a complex but highly modular way to design your programs to design code to execute in highly specialized ways.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>python</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
