Skip to content

Commit

Permalink
Merge pull request #112 from turingschool/spooky-ruby
Browse files Browse the repository at this point in the history
Adds spooky ruby session
  • Loading branch information
memcmahon authored Oct 15, 2024
2 parents 347e030 + 5b51a63 commit ca649d7
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 0 deletions.
Binary file added popup-oop-halloween/assets/candy_bowl.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions popup-oop-halloween/class-syntax/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: lesson
---

<a href="../">Back to Setup Page</a>

# Class Syntax

We've talked at a high level about classes, instances and attributes, and you may be starting to wonder what this will look like in code!

<div class="try-it-new">
<h2>Explore Class Syntax</h2>
<p>While this may feel uncomfortable at first, research shows this is one of the most effective ways to learn. Instead of your instructor typing code and explaining every character, you are going to read some Ruby code that's already been written. You will likely have some questions about what X or Y is doing, and you'll also likely be able to make some deductions about what other pieces are doing. We will talk through it all after you've had a chance to push your brain and make some connections on your own.</p>
<p>Look at the <a target="blank" href="https://repl.it/@turingschool/class-syntax-intro#main.rb">code in this repl.it</a> and think through the guiding questions:</p>
<ul>
<li>What is the name of the class?</li>
<li>How many instances are being made?</li>
<li>What is the attribute?</li>
<li>Can you make another instance?</li>
</ul>
</div>

<div class="try-it-new">
<h2>Create a Candy Bowl</h2>
<p>Now that you've seen an example of a class, let's work on making two classes - Candy and CandyBowl. We'll use the structure of Candy that we discussed earlier (candy should have a size and type) and our CandyBowl should be able to hold and dispense candy.</p>

<p>Some things to think about:</p>
<ul>
<li>What attributes (state) should our classes have?</li>
<li>What behaviors (methods) should our classes have?</li>
</ul>
</div>

## Connection to Apps we Use

Now that you've seen how this "factory" concept can be used in code, you may be wondering about how this code concept is used within apps we use every day.

We won't get all the way there in illustrating it today, but, we can look at Instagram for a moment to talk through where we see some use of classes and instances.

![Instagram screenshot with annotations for user profile class and post class.](/assets/images/instagram-oop.png)

<a href="../wrap-up">Next Steps</a>
65 changes: 65 additions & 0 deletions popup-oop-halloween/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
layout: lesson
---

# Pop Up: Valentines OOP

![Skeleton costumed child, holding a pumpkin-shaped bowl of candy](./assets/candy_bowl.jpg)
<br>

Thinking of trink-or-treating and big bowls of halloween candy may make you nostalgic. But these days, they are covered in germs. In this live, instructor-led workshop, you will build and customize your very own computer program that will generate Valentines, while learning the fundamentals of Object-Oriented Programming!

_This will be best experienced on a desktop or laptop computer._

## Welcome!

We are so glad you are here! To get set up...
1. Open up <a target="blank" href="http://repl.it/">repl.it</a> in a browser (preferably Chrome) and log in to your account
1. Please change your zoom name to first, last initial, pronouns (ex: _Amy H. (she/her)_)
1. Introduce yourself in the zoom chat - where are you calling in from?
<br><br>

## Goals

- Explain the core concepts of Object-Oriented Programming
- Gain _exposure_ and familiarity with the Ruby syntax for classes and instances
- Build a Valentine Generator!
- Determine if coding is something you enjoy doing and want to pursue further

Disclaimer: We won't become experts in Ruby or Object-Oriented Programming today. And you may leave with more questions than answers!
<br><br>

## Programming Concepts We Will Use

Back-End Engineering is concerned with the management of data for an application. There are different ways we can structure the data itself as well as the systems that manage it. Object-Oriented Programming (OOP) is one way to design a program to manage the data in a Back-End.

While OOP is not exclusive to Ruby, the Ruby programming languages usually follows the patterns of OOP.

<section class="data-type-cards language-cards">
<div>
<h3>Ruby</h3>
<p>Ruby is the programming lanugage we will write in today, to give instructions to the computer. It's known to be a beginner friendly language because of it's syntax and similarities to the English language!</p>
</div>
<div>
<h3>OOP</h3>
<p>Object-Oriented Programming (OOP) is a programming paradigm that we can use with many lanuages, including Ruby and Python. It focuses on writing re-usable code.</p>
</div>
</section>
<br><br>

## Brief Ruby + repl.it Intro

To gain some familiarity with repl.it, the interface we will use to write code in today, and start looking at some Ruby code, click [this link](https://repl.it/@turingschool/Ruby-Replit-Intro#main.rb).
- Change the text `NAME` on line 2 to your name
- Click the green run/play button at the top center of the page

<div class="try-it-new">
<h2>Write some Code!</h2>
<p>Now that we've seen what variables can do and how to run our code, let's add on to what is existing. Write at least 2 more variables under line 2. Print all variables out, and re-run the code to make sure they are working as expected!</p>
</div>

## Now, it gets even more fun:
- [OOP - Candy Factory](./oop)
- [OOP - Syntax Activity](./class-syntax)
- [Automating Valentines](./valentine)
- [Wrap Up](./wrap-up)
38 changes: 38 additions & 0 deletions popup-oop-halloween/oop/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
layout: lesson
---

<a href="../">Back to Setup Page</a>

# OOP & Candy Factory

In the introduction, we shared that Object Oriented Programming (OOP) is a paradigm for how we can organize code. Without seeing examples, that definition just feels... unhelpful. In this section, we won't dig into code quite yet, but we'll do some thinking and list making to set ourselves up to write code in the next section!

## Candy Factory

Let's think about some components of the candy factory that makes the conversation hearts. We may make some stuff up, but this analogy should help us build context for what OOP is.
- The factory has machinery that is designed to make LOTS of chocolate candies (think snickers, twix, kit-kat, etc...)
- All candy should be chocolate-based
- The size and type of candy could change

With the information above, in theory, the manager at the factory should be able to say "make me a fun-size snickers", and that should be possible.

That example about the Candy Factory tie directly to concepts of OOP. We will use three main technical terms today. They are below, with the connection to the Candy Factory example:
- **`class`** - A class is like a blueprint or template. The factory machines are designed to make a certain sized heart shape candy with a certain material - that is the template for ALL candies. We could probably name it the _Candy_ class.
- **`instance`** - An instance is an object that is made from the class template. The fun-sized snickers that the manager requested, then later held in her hand, are instances of the Candy class.
- **`attribute`** - An attribute is a specific characteristic about an instance that has the potential of varying from other instances. With our candies, _size_ and _type_ would be attributes, because they weren't programmed into the template, but were extra information the manager was able to give.

<div class="try-it-new">
<h2>Classes and Objects - At Home!</h2>
<p>Pick an object that you see sitting around in your home. It could be a candle, water bottle, glove, anything!</p>
<p>Jot down the following, and be ready to share out with the group:</p>
<ul>
<li>What type of object is it? i.e., what might the class name be?</li>
<li>Are there multiple instances of it in your home, or in the world? List a few.</li>
<li>What are some of its attributes?</li>
</ul>
</div>

Are you still wondering how in the world this connects to writing software? That's what we'll discuss next!

<a href="../class-syntax">Next: How to CODE these concepts</a>
23 changes: 23 additions & 0 deletions popup-oop-halloween/wrap-up/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
layout: lesson
---

# Next Steps

## Feedback

At Turing, we rely on constant feedback from our students to improve the Turing experience. Please take two minutes at this time to fill out <a target="blank" href="https://airtable.com/appR5bqtCZv7u3xXX/shr8IHKqMDPRxVZlz">this survey</a> to give us feedback on this Try Coding session today.

## Attend Other Events

We are always creating new, exciting events for prospective students. Check out our upcoming events <a target="blank" href="https://www.eventbrite.com/o/turing-school-of-software-design-9895674202">here</a>!

## Talk to Us

We know everyone has different barriers or concerns as they start this process. Our team is here to help you find solutions to each barrier and ease your concerns from how to pay for Turing to what is the job support like.

Reach out if you have any questions at all - from _Can I afford this?_ to _Is Software Engineering for me?_ to _What is a typical day like as a Turing student?_ - we're here for you! Email **[email protected]** with your questions and we'll schedule a one on one call with you!

## Apply!

Let's do it! Start your application today at <a target="blank" href="https://apply.turing.edu/">apply.turing.edu</a>.
1 change: 1 addition & 0 deletions workshop-curriculum/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h2>Try Coding</h2>
<a class="s-button s-button-secondary-inverse" href="../try-coding-general">Basics of Programming (Ruby)</a>
<!-- <a class="s-button s-button-secondary-inverse" href="../try-coding-fe">Coding Fundamentals (JavaScript Focus)</a> -->
<a class="s-button s-button-secondary-inverse" href="../popup-lite-brite">Basics of Web Development (HTML/CSS + Javascript)</a>
<a class="s-button s-button-secondary-inverse" href="../popup-oop-halloween/">Spooky Ruby (OOP)</a>
</section>

<!-- <section class="card fe-card">
Expand Down

0 comments on commit ca649d7

Please sign in to comment.