<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://ellpeck.de/feed.xml" rel="self" type="application/atom+xml" /><link href="https://ellpeck.de/" rel="alternate" type="text/html" /><updated>2026-04-30T20:36:30+00:00</updated><id>https://ellpeck.de/feed.xml</id><title type="html">Ellpeck.de</title><subtitle>Ell&apos;s Little Internet Place</subtitle><author><name>Ellpeck</name></author><entry><title type="html">🎓 It’s Been a Long Time Coming</title><link href="https://ellpeck.de/blog/bachelors-thesis-postmortem/" rel="alternate" type="text/html" title="🎓 It’s Been a Long Time Coming" /><published>2025-08-27T00:00:00+00:00</published><updated>2025-08-27T00:00:00+00:00</updated><id>https://ellpeck.de/blog/bachelors-thesis-postmortem</id><content type="html" xml:base="https://ellpeck.de/blog/bachelors-thesis-postmortem/"><![CDATA[<p>On Monday, I submitted my bachelor’s thesis, and with it, a tremendeous weight lifted off my shoulders. I started the journey of studying computer science in late 2017. That’s eight years of a bachelor’s degree. Why did it take me so long, and how does it feel now?</p>

<h2 id="the-beginning">The Beginning</h2>

<p>This might sound silly to say, but I used to consider myself pretty smart. I don’t think I was necessarily the biggest know-it-all in my year at school, but I was certainly up there. Everyone in my family told me I could accomplish great things, and I believed so too.</p>

<p>From an early age, I had a slight, then passionate, interest in computer science and especially programming, partly because of my dad’s influence (he’s also a programmer), and partly because the idea of creating my own <em>stuff</em>, but, like, on a screen, fascinated me.</p>

<p>In 2017’s winter semester, a few months after I’d completed my Abitur<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>, I enrolled into RWTH Aachen<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup>’s first-semester computer science courses. The RWTH is generally considered a very difficult university, especially for computer science courses, but people also see degrees from there as pretty prestigious compared to a lot of other universities. Having never struggled in school, I thought I’d easily be good enough, and so I moved from my hometown of Neuss into student accommodation on a hill in Aachen. I was excited to start working first on my bachelor’s, then on my master’s, and probably eventually on my PhD. It’s just what smart people like me did.</p>

<p>The first semester, then, hit me like a brick wall.</p>

<p>I was overly ambitious and too confident, and I went to lectures and did coursework 100% sure that I would nail every exam. Midway into the semester, my first proper boyfriend broke up with me, and I spiraled into depression. It wasn’t the first time it had happened to me by any means; it was just the first time that it felt like it really did something permanent to me. I think through my failure at uni—which I’ll get to in a sentence or so, don’t you worry—this would’ve happened anyway, but the breakup certainly accelerated it. I didn’t feel confident anymore, in my intelligence, in my ability to live this smart-person life I’d dreamed about. Then, near the end of 2017, the first exams hit—math, math, and programming—and it was the first time I really had to study for anything. It sounds like a humble brag, but it was devastatingly difficult. I made index cards—which I still do, I think they’re great—but they weren’t enough. I hadn’t made any friends yet then, and I hadn’t realized that there are so many more ways to study. Redoing coursework from the semester, doing practice exams and old exams from previous semesters. I just studied my index cards, and I had no idea how to apply the things I learned from them. I went into the exams, and I was graded accordingly: I failed one of the math ones, I barely scraped by with a pass for the programming one, and I was so devastated that I couldn’t bring myself to even take part in the second math one.</p>

<p>I hadn’t been prepared for the exams, but much, much worse: I hadn’t been prepared for failure. At all.</p>

<h2 id="the-inbetween">The Inbetween</h2>

<p>For the next few semesters, I regained my footing a little bit after gaining a small, surface-level friend group. You know, the type of people you go for lunch and study with, but not the type of people you talk to about your fears. They helped a little, and I had a pretty promising third semester, but it all didn’t really last.</p>

<p>I kept the friend group for a little while, but I also kept <em>failling</em>. And I still hadn’t developed any tools for dealing with it.</p>

<p>I started seeing an amazing psychiatrist<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup>, and I went on antidepressants—the same ones I still take to this day, with a couple adjustments here and there—and therapy. The antidepressants really helped, the therapy felt good but, at least for me, it didn’t leave any lasting impact I don’t think. After however many sessions, the quota that health insurance pays for ran dry, and I couldn’t really justify paying out of pocket. I still had the meds though, which kept me stable enough.</p>

<p>Somewhere around this point, I started dating my current boyfriend, who I’ve now been with for over six years. Being with him made me realize that it wasn’t just failure that held me back. I wasn’t happy in Aachen. I hated my apartment, and I felt isolated and alienated by the university and the way that everyone there, and all of my friends, just seemed to have everything under control somehow. Of course, they probably didn’t, but then again: lunch-and-study friends, not tell-them-your-deepest-fears friends.</p>

<h2 id="the-new-beginning">The New Beginning</h2>

<p>So in 2022, after a lot of Covid had passed and life was slowly starting to get normal again, I left. In the span of a few months, I found an apartment in Neu-Ulm—the apartment I’m sitting in now, writing this—, my boyfriend went and viewed it for me, saw that it was great, and I applied. And with what felt like a crazy amount of luck, I got it. The first apartment I had someone view, and the first apartment I applied for. It’s not something I really believe in, but looking back, it felt a little bit like fate.</p>

<p>I enrolled into Ulm University<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup> for their summer semester, and a substantial amount of the credit points I had accumulated at RWTH were able to be passed over, so I didn’t have to start from scratch. There were one or two courses that I’d have to retake, but after such a long time of being so unhappy at my old university, it felt like it was going to be worth it.</p>

<p>It was. At first, I was still a little unhappy. I hadn’t made any new friends in Ulm yet, and it still felt like uni was a little difficult for me to manage. I also learned to live with that though. It took me a long time, but I accepted that running at full capacity—the kind of capacity that the regular course curriculum requires of you—is just not something that I’m capable of with my mental health. So I continued taking courses at my own pace, and it felt fine. It felt doable.</p>

<h2 id="the-job">The Job</h2>

<p>In late 2023, I got an email from someone at my university. I didn’t know them, but they offered me a job. I’d just passed an exam in a programming course—it was mostly Java, which I’d been using heavily for years, so it was pretty easy for me—and they asked me to take a job as a tutor in the next semester.</p>

<p>I didn’t think this was for me. I can’t really deal with people, especially people asking me questions or judging me or looking at me while I’m there trying to explain a thing to them. It all sounded horrifying. So I said no.</p>

<p>They followed up pretty quickly. What about a student job working on their project, as a programmer? I responded that I don’t think I’m cut out for that. I said I can’t work at the capacity that most people can, and besides, I’m not nearly as capable as they seem to think I am. I really said that in the email.</p>

<p>Still, they were adamant. They looked at my GitHub profile<sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">5</a></sup> and they’re certain I’d be the perfect fit. So finally, I said yes.</p>

<p>Our first meeting, I came in to sign the contract and talk about what the job was going to entail. I was, to put it lightly, shit-scared. After hiding in a corner crying for a good half hour—not, like, an exaggeration or a figure of speech, unfortunately—I mustered up the courage and went to their office. It was a job working on an analysis tool for the programming language R. I hadn’t ever used, or even heard of, R before, and the tool was written in TypeScript, a language I’d only used very sparingly up to that point. But again, something compelled me to say yes.</p>

<p>This, it turns out, was one of the best decisions of my life.</p>

<h2 id="the-now">The Now</h2>

<p>I’m about to sign the contract for my fourth semester working this job. In the time since I started, I made friends that I talk to about everything. Johanna, Lars and Finnika know all about my struggles with uni, with my confidence, with how little work I feel I get done. My boss, Flo, who originally invited me into his team despite my obvious confidence issues in the first few emails, has become one of my closest friends. I’m probably sending all of them this post once I’m done writing it.</p>

<p>A little over half a year ago, I started on my bachelor’s thesis. Flo approached me, asking if I wanted to do it with him and his project, flowR<sup id="fnref:6" role="doc-noteref"><a href="#fn:6" class="footnote" rel="footnote">6</a></sup>, on which I was already working for my student job. Again hesitant, and again unsure about my abilities and whether he was seeing something in me that wasn’t going to be there, I said yes.</p>

<p>So here I am, a little over half a year later, finally free. It does sound cheesy, but I’m not free from university, or academia, or this godforsaken bachelor’s degree that it took me so long to make happen. I’m free from the isolation and the loneliness and the agonizing feeling that I’m just not good enough. Yes, I still have fears, and I still feel inadequate a lot, but I now know in my heart that I’m just being hard on myself.</p>

<p>I don’t know what the moral of this story is. Is it that all you need is a miracle student job to make all your problems go away? Probably not. It was still hard, and it still took me a long time to get to this place. Throughout all this time, I thought about quitting uni so, so many times, both then in Aachen and here in Ulm. But I have a kind of courage now that I didn’t have then. Maybe the moral is that you need friends? That seems counterproductive, especially since, for people like me and maybe you, there’s no easy way to just <em>get</em> friends, especially the kind you can share your anxiety with. They certainly help though, and I don’t think I would’ve gotten to where I am now without them.</p>

<p>You know, I haven’t said this yet, but I’m staying for my master’s. I’m continuing my student job and I’m doing a master’s degree. It’s something that, before starting university, I thought of as the natural path my life would take, and then during university, I didn’t ever imagine wanting or being able to do again. I don’t know if I’ll follow through with the whole thing, or if I’ll just continue doing this job for a few semesters and then drop out and move on to something else. But I’m looking forward to trying. I really am.</p>

<p>To close out this ramble, I want to share a part of my bachelor’s thesis that means a lot to me. I poured a lot of work into the thesis, and I’m proud of the research I did and the code I wrote, but the thing I most want to share with you all is what I wrote in the acknowledgements<sup id="fnref:7" role="doc-noteref"><a href="#fn:7" class="footnote" rel="footnote">7</a></sup>:</p>

<blockquote>
  <p>This thesis was made possible by the support of many people.</p>

  <p>First and foremost, I would like to thank my exceedingly patient supervisor Florian, who, over our almost two years of working together, has become not only a trusted mentor, but also a close friend.</p>

  <p>I would also like to thank some of my friends from and surrounding the flowR team, including, but not limited to, Johanna, Lars, Annika R., and Ruben, all of whom, alongside Florian, have supported me throughout my many doubts about this thesis and my work as a whole.</p>

  <p>Finally, I extend my deepest appreciation to Nicolas, who, despite his interests not extending to query language design and linting R code, has kindly endured having to listen to my ramblings about the topic for several months, and who has lended me more emotional support than I could ever have asked for.</p>
</blockquote>

<p>Thanks for reading, everyone. ❤️</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p><a href="https://en.wikipedia.org/wiki/Abitur">https://en.wikipedia.org/wiki/Abitur</a> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p><a href="https://www.rwth-aachen.de/">https://www.rwth-aachen.de/</a> <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>If you live in Aachen and you’re looking for a psychiatrist, I cannot recommend Dr. Burkhardt enough. <a href="https://www.neurologie-psychiatrie-aachen.de/">https://www.neurologie-psychiatrie-aachen.de/</a> <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:4" role="doc-endnote">
      <p><a href="https://www.uni-ulm.de/">https://www.uni-ulm.de/</a> <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:5" role="doc-endnote">
      <p><a href="https://github.com/Ellpeck">https://github.com/Ellpeck</a> <a href="#fnref:5" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:6" role="doc-endnote">
      <p><a href="https://github.com/flowr-analysis/flowr">https://github.com/flowr-analysis/flowr</a> <a href="#fnref:6" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:7" role="doc-endnote">
      <p>I removed everyone’s last names for a vague sense of anonymity, despite the fact that they’re probably all easy enough to find through their work on flowR. <a href="#fnref:7" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Miscellaneous" /><category term="Featured" /><summary type="html"><![CDATA[This week, I submitted my bachelor's thesis after eight years of studying. Why did it take me so long, and how does it feel now?]]></summary></entry><entry><title type="html">📚 My Favorite Reads of 2022</title><link href="https://ellpeck.de/blog/reading_faves_2022/" rel="alternate" type="text/html" title="📚 My Favorite Reads of 2022" /><published>2022-12-13T00:00:00+00:00</published><updated>2022-12-13T00:00:00+00:00</updated><id>https://ellpeck.de/blog/reading_faves_2022</id><content type="html" xml:base="https://ellpeck.de/blog/reading_faves_2022/"><![CDATA[<p>2022 has been an interesting year, to say the least. I moved to a new city at the other side of the country, I continued my studies at a new university, and I read a <em>ton</em> of books.</p>

<p>Well, okay, not necessarily a ton by some people’s standards. But seeing as I’ve only read about twelve books <a href="https://ellpeck.de/blog/reading_faves_2021/">last year</a>, and zero books the year before that, I think this year’s twenty-nine<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> books is a pretty good amount.</p>

<p>I’m tracking my reads using <a href="https://app.thestorygraph.com/profile/ellpeck">the StoryGraph</a>, which is an incredibly helpful tool for helping myself remember what I even read and how much I liked it. My favorite genre is romance, as you can quite clearly see looking at my <a href="https://app.thestorygraph.com/stats/ellpeck?year=">statistics</a>, but I try to read a nonfiction book from time to time, too.</p>

<p>Here’s a list of some of the books I read this year that I enjoyed most. I’ll try not to include any major spoilers in them, but I will talk about the story a bit to highlight the parts that I particularly enjoyed, and I’ll also include some quotes I found funny, cute or otherwise relevant.</p>

<p>These aren’t the <em>only</em> books I read this year that I’d recommend, by any means, but they’re the ones I’d perhaps recommend most if you happen to like similar stuff to what I like. These are in no particular order, so this isn’t a ranked list by any means.</p>

<h2 id="-they-both-die-at-the-end-and-the-first-to-die-at-the-end">📱 They Both Die at the End (and The First to Die at the End)</h2>
<p>So, right off the bat, I need you to know that I don’t usually read books with sad endings. While I agree that crying can be freeing, I also have a pesky habit of getting depressed about fictional dead characters for a week after they die. Which I don’t particularly enjoy.</p>

<p>But when I saw <em>They Both Die at the End</em> by Adam Silvera, I didn’t <em>know</em> it was going to be as bittersweet as it was. Well, I had some idea based on the title, of course, but for some reason I didn’t clock that it was going to be a romance. A romance where both characters die at the end. <em>I cried so much.</em></p>

<p><em>They Both Die at the End</em>, and its prequel, <em>The First to Die at the End</em>, are set in a fictionalized universe where a service exists that will tell you about the day you’re going to die. On the day, they call you on the phone and deliver the frankly disturbingly true prediction. They don’t tell you why, or how, you’re going to die, but they tell you that you <em>will</em> definitely die on that day. The stories are told from multiple people’s perspectives, with each chapter being told either by one of the two main characters, or occasionally by some of the many side characters. The people dying, called “Deckers” (for a somewhat silly reason that will become apparent in the prequel), are encouraged to make their last day beautiful, and fill it with as many memorable moments as possible. In both books, this includes a boy falling in love with another boy (who may or may not also die today). They have a beautiful one-day romance, until death happens at the end and the reader cries themselves
to sleep, replaying the scene in their head for hours.</p>

<p>If you like close-to-reality sci-fi, and heartbreakingly tragic queer romance stories, then I really recommend these two books.</p>

<blockquote>
  <p>“What the hell am I supposed to say?” I ask. “Speak from your heart,” Dalma says. “Not your dick.” “Speak from my heart, not my dick; speak from my heart, not my dick,” I mutter like a mantra.</p>
</blockquote>

<blockquote>
  <p>He’s got to be thinking I’m prepping for a kiss, which I mean, I’m not, but also, I wouldn’t be mad at all. Damn, maybe I am thinking with my dick.</p>
</blockquote>

<blockquote>
  <p>“You’re positive about a movie theater in the afterlife but not if you’ll have your glasses? Seems like an oversight in your heavenly blueprint.” He removes my glasses and puts them on. “Wow. Your eyes suck.”</p>
</blockquote>

<h2 id="️-im-glad-my-mom-died">⚱️ I’m Glad My Mom Died</h2>
<p><em>If you struggle with physically or emotionally abusive relatives or severe eating disorders, this book and this section of the blog post may not be for you.</em></p>

<p>We all know Jennette McCurdy, right? If you don’t, she’s an ex-actress (now writer and director) who used to work for Nickelodeon, with her most popular role having been Sam Puckett in <em>iCarly</em> and later <em>Sam &amp; Cat</em>.</p>

<p>I’m Glad My Mom Died is her memoir about her childhood and early adulthood, which was hugely influenced by her abusive mother who forced her daughter into eating disorders and acting, neither of which McCurdy was particularly interested in herself. The book is deeply tragic, but also hopeful, and it depicts the actress, her family, her characters, and the people she worked for, in a raw and heartbreaking way.</p>

<p>I don’t want to say that much more about the book’s content here because I don’t want to glamorize or romanticize McCurdy’s experiences, but I do want to invite you to read the book for yourself. It really gives you another insight into how much of people’s trauma isn’t visible to the outside world, and how seemingly impossible it is to get out of an abusive situation when that situation your entire life. It also gives you a deep appreciation for honesty, openness, and mental health support through intimate friendships and therapy. It’s also incredibly well written, making you feel like you’re reading a diary that isn’t meant to be read by anyone but the one who wrote it. The book’s second section is also deeply hopeful, showing McCurdy’s escape and subsequent healing from her traumatizing past.</p>

<h2 id="-love-on-the-brain">🚀 Love on the Brain</h2>
<p>Ali Hazelwood is a romance author who seems to primarily write stories related to academia in some form. Being a student, this should be deeply relatable to me, but being an antisocial mess, I rarely ever actually interact with people at university. Nevertheless, I read two of Ali’s books this year: The Love Hypothesis in the first half, and Love on the Brain, her most recent release.</p>

<p>While I think they are both amazing, I’m passionate about Love on the Brain because it contains two adorable romances, a cast of hilarious characters, and a cute cat that may or may not be real. In the book, the main character Bee starts a job at NASA along with her assistant, where she meets her apathetic, but secretly adorable, love interest Levi.</p>

<p>If you love a good wacky romance, a punky queer feminist, and a chaotic story, you’ll love… on the Brain.</p>

<blockquote>
  <p>“Sorry.” I scratch the back of my neck. “Just to be clear, you two were having intercourse with…” “With each other,” she tells me proudly. “How did Boris even … find you?” “Guy cam into our office looking for something, found us on your desk, ratted us out.” “On <em>my</em>—why did you have to do it on <em>my</em>—” I stop. Take a deep breath. “To be clear.” I look between them. “This was … consensual?” “Very,” they answer in unison, locking eyes and smiling like idiots.</p>
</blockquote>

<blockquote>
  <p>As I wait for the crowd to disperse, I take stock of the room. His team appears to be WurstFest™️ material. The well-known Meatwave. A Dicksplosion in the Testosteroven. The good old Brodeo.</p>
</blockquote>

<h2 id="-we-are-not-like-them">✊🏿 We Are Not Like Them</h2>
<p>The story of We Are Not Like Them, by Christine Pride and Jo Piazza, is… <em>intense</em>, to say the least. The book is told from the perspectives of a pair of childhood friends: Riley, a black news anchor, and Jen, a white woman with a policeman husband named Kevin.</p>

<p>I think you can see where this is going.</p>

<p>After Kevin shoots an unarmed black teenager, Jen has to reevaluate her relationship with her husband while Riley covers the events and aftermath on the news. The book perfectly delivers the heartfelt, troubling accounts of both women, their interactions with each other, and the difficult question of what it all means for their relationship. In emotionally packed and heartbreaking descriptions, we also see Riley reporting on, and subsequently getting closer to, the mother of the victim and the rest of their family.</p>

<p>If you’re into troubling, but deeply honest depictions of racial issues, and the effect they have not only on the victims and their families, but also on everyone around them, I highly recommend We Are Not Like Them.</p>

<blockquote>
  <p>“They think it’s so cool that my best friend is black.” She rolled her eyes as she said it, but it was still clear that it was some sort of weird badge of honor for her, like I was a trendy accessory—otherwise why mention it at all?</p>
</blockquote>

<blockquote>
  <p>“You know, I used to think you were such a weirdo for getting annoyed when people want to touch your hair, but now that I’ve got this”—she places a hand on either side of her stomach—“I get it now. I’m like Aladdin’s lamp. No one asks. They just rub.” It isn’t the same thing at all, but I let it go.</p>
</blockquote>

<h2 id="️️-meet-cute-diary">🏳️‍⚧️ Meet Cute Diary</h2>
<p>Okay. Okay. Let’s get back to <em>adorable stories</em>. The Meet Cute Diary, by Emery Lee, is a story about Noah, a trans boy who runs a blog that features stories about trans people finding love through adorable meet cutes. The only problem: They’re all fake, and no one knows Noah is making them up.</p>

<p>It’s a beautiful and sometimes heartbreaking story about what trans people go through, and the struggles that extend far beyond strangers and straight into personal relationships. It’s also incredibly hopeful, though, depicting Noah as someone who gets more comfortable with himself and his identity while figuring out who is the one for him.</p>

<p>The story also includes a character who is trying to figure out which pronouns suit them best, and the book cleverly incorporates this process into the story by using the pronouns they’re currently trying while talking about them.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<blockquote>
  <p>“They’re your pronouns. You don’t have to consider anyone else before you pick them.” His eyes widen, and then I don’t know hat changes, but he smlies like all his problems have melted away, and it really is a beautiful smile. “Thanks. Do you mind using they/them for me from now on?” I roll my eyes. “No, I don’t mind. They’re your pronouns.” And they smile again, and for a moment, my heart feels heavy.</p>
</blockquote>

<blockquote>
  <p>He smirks over at me and says, “This is Noah, my boyfriend. Noah, this is Matt. We used to ski together.” “Damn, dude, I didn’t know you were gay,” Matt says. Drew laughs. “I’m not. Noah’s special.” And I know he means it as a compliment, but it makes me feel kind of dirty, like I’m just not enough of a boy or too much of an anomaly to really be anything at all. I mean, it’s not like he’s a trans rights activist. He doesn’t know better, so I’ll just mention it when I get a chance. No big deal.</p>
</blockquote>

<p>(<em>It is a big deal, though. This is awful. Don’t be like this, please.</em>)</p>

<h2 id="️-the-sky-blues">🌧️ The Sky Blues</h2>
<p>The Sky Blues, by Robbie Couch, is a beautiful coming-of-age story about a high school student named Sky, who ends up starting a revolution at his school. After deciding to ask out a guy to Prom, his secret plans get leaked and an e-blast is spread around the school, containing and subsequently causing a wildfire of homophobic and racist rhetoric. But Sky doesn’t back down, and his friends and allies quickly assemble a protest that threatens to get the prom canceled, but that might also save Sky’s leaked promposal plans.</p>

<p>I absolutely adore this book. However, I do have to admit that some parts felt hard to read because they reminded me of my high school years, where I was still closeted due to the very fears that come true in The Sky Blues. It also gave me hope though, that younger people can feel empowered by the story and rise up for themselves or their queer friends as well.</p>

<p>It also contains the best teacher that has ever existed (or, well, <em>fictionally</em> existed), and I want her to have been my teacher in high school.</p>

<blockquote>
  <p>“Please, for the love of God, don’t tell me you were masturbating.” “Stop!” “You totally were, weren’t you?” “I can barely tie my shoes before eight a.m. I don’t have the motivation to do that before school. I was shower-dreaming about him, sure. But that’s it.” “Shower-dreaming?” She tils her head, confused. “Is that gay for ‘masturbating’?”</p>
</blockquote>

<blockquote>
  <p>“Principal Burger.” Winter smiles. “Surely we can figure this out without taking prom away from students?” “Ms. Winter.” Burger returns the smile, but maliciously. “How about this? Unless you plan on chaperoning your own prom for your Yearbook class, you’ll need to enforce the ban.” “Well,” Winter sighs, thinking. “Okay, then.” Burger blinks. “Okay you’ll enforce the ban?” “Okay I’ll be chaperoning my own prom for my Yearbook students,” she says.</p>
</blockquote>

<h2 id="-smoke-gets-in-your-eyes">🔥 Smoke Gets In Your Eyes</h2>
<p>Lastly, but certainly not least…ly, a great nonfiction book by one of my favorite YouTubers and activists: Caitlin Doughty, a mortician from Los Angeles who specializes in advocating for people having access to the body disposition options they want after their death.</p>

<p>Smoke Gets In Your Eyes is her first book (and my favorite of the three she’s published so far), and it’s about her early twenties, where she worked as a crematory operator. It’s packed with funny, heartfelt, and sometimes rather serious stories, but also contains a ton of fascinating information about the funeral industry. As almost all of her content, it’s also delightfully macabre in an incredibly endearing way.</p>

<p>If learning about deathcare traditions in various cultures is more your stlye, I also thoroughly recommend her From Here to Eternity, which, as the subtitle suggests, is all about traveling the world to find the good death.</p>

<blockquote>
  <p>To my great annoyance I found him stacked below Mr. Willard, Mrs. Nagasaki, and Mr. Shelton. That meant stacking and restacking the cardboard boxes like a game of body-fridge Tetris.</p>
</blockquote>

<blockquote>
  <p>“Yes, Mother?” I probably called her Mom or Mommy, but in my memories I’m a very polite British child with exquisite manners.</p>
</blockquote>

<blockquote>
  <p>But young lovers take note: above all else, the phrase every girl truly wants to hear is “Hi, this is Amy from Science Support; I’m dropping off some heads.”</p>
</blockquote>

<blockquote>
  <p>The anxiety I felt was no longer caused by the fear of an afterlife, of pain, of a void of nothingness, or even a fear of my own decomposing corpse. All my plans and projects would come to an end. The last thing preventing me from accepting death was, ironically, my desire to help people accept death.</p>
</blockquote>

<h2 id="closing-remarks">Closing Remarks</h2>
<p>I hope you enjoyed this little look into some of the books I really enjoyed this year. As I said at the top, for a more in-depth look at my kind of books, you can check out my profile on <a href="https://app.thestorygraph.com/profile/ellpeck">the StoryGraph</a>.</p>

<p>I also write my own short stories occasionally, so if you’re into cutesy romantic stuff, you can check them out <a href="https://ellpeck.de/#blog-short-stories">here on the blog</a> as well.</p>

<p>Feel free to let me know what you think about my picks, and also feel free to let me know what you read this year, and if you have any recommendations for what I should read next year. ❤️</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>And counting! <em>The year is not done yet.</em> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>They don’t end up using they/them pronouns in the end, but I feel it would take away from the storytelling to tell you the pronouns they do end up using. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Reading" /><summary type="html"><![CDATA[I read so many books this year! Here are some of my favorites, what I liked about them, and why you might like them too.]]></summary></entry><entry><title type="html">🚢 The Cruise That Changed it All</title><link href="https://ellpeck.de/blog/cruise_that_changed_it_all/" rel="alternate" type="text/html" title="🚢 The Cruise That Changed it All" /><published>2022-07-21T00:00:00+00:00</published><updated>2022-07-21T00:00:00+00:00</updated><id>https://ellpeck.de/blog/cruise_that_changed_it_all</id><content type="html" xml:base="https://ellpeck.de/blog/cruise_that_changed_it_all/"><![CDATA[<p>Tom was not normally one to dwell on specifics, but when his mother reminded him that he’d promised he would join her on this cruise, he got just the tiniest bit defensive. Because while, yes, he’d <em>technically</em> promised her he’d join her, it wasn’t necessarily without any coercion or guilt-tripping, both of which his mom was absolutely famous for. Because what his mom hadn’t told him was that this cruise would be <em>two weeks long</em> and that her best friend Suzy and her incredibly annoying son Jaz would be joining them.</p>

<p>“Honey, you have to give Jaz a chance,” Tom’s mom was saying in what he perceived to be an overly accusatory tone. “I don’t even understand why you don’t like him.”</p>

<p>She knew <em>exactly</em> why Tom didn’t like him. “You know <em>exactly</em> why I don’t like Jaz”, he replied, in a similarly accusatory tone. Tom threw a half folded t-shirt at her, and she picked it up and sighed.</p>

<p>Jaz had always been a little too much for him, admittedly. Because, while Tom was somewhat outgoing and <em>did</em> occasionally like to go on parties, or hang out with friends, or get a little drunk, Jaz did all of those things <em>constantly</em> and never stopped talking about them, ever. We get it, dude, you’re so good with the guys that there isn’t a single one you haven’t seen naked yet.</p>

<p>There was, Tom had to admit to himself, a little jealously hidden in that criticism of Jaz. Because occasionally Tom asked himself why he hasn’t had sex yet—as any 20-something guy would, or so he thought. The only difference being that, according to what he heard from his friends—and Jaz—, usually people actually <em>wanted</em> to have sex, and enjoyed the idea of doing so.</p>

<p>Not Tom. Admittedly, he never quite understood what all the fuss was about. He felt kind of ashamed about it, too, in a way. He didn’t really enjoy talking to his friends about sex, either. They’d all go on and on about how amazing it was, and how much they’d been looking forward to their first time. Meanwhile, Tom would always feel like there was something wrong with him for not being interested in pursuing that.</p>

<p>Maybe that contributed to his hatred of Jaz.</p>

<p>Or maybe Jaz was just really annoying.</p>

<hr />

<p>Tom had his own cabin adjacent to his mom’s one. A few days had passed on the ship and, despite his expectations, Tom was actually enjoying himself. Jaz’s cabin was just down the hall from his, and occasionally they’d cross paths, but they wouldn’t speak much. Tom didn’t really want to, and it seemed like Jaz probably knew that he didn’t want to.</p>

<p>One evening, after the four of them had eaten dinner together and their moms had stayed to grab drinks at the bar, Tom was stopped by Jaz in the hallway unexpectedly.</p>

<p>“Hey, dude, I wanna talk to you,” he said after tapping him from the shoulder from behind. He sounded out of breath. Was he <em>running</em> after Tom? Kinda creepy.</p>

<p>Tom immediately felt himself pulling a face. “What? Why?”, he demanded.</p>

<p>“Well,” Jaz began while scratching the back of his head. He was just standing there now, looking… confused? Guilty? Worried? Tom couldn’t tell.</p>

<p>“I feel like you don’t like me, Tom,” he said, before looking up again and meeting eyes with him. “And I want to know why.”</p>

<p>Tom froze. Oh God, this was it. This was the type of situation that he <em>really</em> didn’t know how to deal with.</p>

<p>“What?”, he said after a couple seconds of deliberating whether to tell the truth. Apparently, his brain had accidentally decided not to tell the truth. Great. “I like you! Why wouldn’t I?”, he said.</p>

<p>Tom had averted his gaze, but now turned to meet eyes with Jaz again. Jaz looked <em>sad</em>. “You sure?”, he asked. His eyes narrowed before he continued, “It’s not because I’m trans, is it? Because my mom always gave me the impression that you’d be totally cool with that.”</p>

<p>Jaz was…? He– what? Tom just stood there and said nothing for a good ten seconds or so. Jaz closed his eyes and sighed.</p>

<p>“Wait, what?”, Tom finally asked.</p>

<p>“Wait,” Jaz began again. “You didn’t <em>know</em>?”</p>

<p>Tom was embarrassed now. He felt his face heat up and Jaz could probably observe it turning bright red like a goddamn tomato.</p>

<p>“Oh my God, you’re the first person in the <em>world</em> that didn’t immediately realize. Are you <em>serious</em>?”</p>

<p>“I– I’m sorry,” Tom heard himself say.</p>

<p>“Dude! Sorry for <em>what</em>? I’m passing, I’m fucking <em>passing</em> and I didn’t even <em>realize</em>. This is <em>amazing</em>!”, Jaz exclaimed, and immediately pulled Tom in for a hug.</p>

<p>Tom felt some of his worries ease away, sure that Jaz had forgotten about the whole <em>Tom hates me and doesn’t want to tell me why</em> situation. Tom reciprocated the hug, and they just stood there in the hallway for a minute, hugging like a couple of idiots.</p>

<p>But Tom felt vulnerable now. And, to him, vulnerable meant honest.</p>

<p>“Actually,” Tom began after Jaz finally pulled away. “I used to think you were kind of… annoying?” Tom ended with a rising tone, as if to inquire whether Jaz understood what he meant. Instead, Jaz frowned. Oh, no.</p>

<p>“I– don’t get me wrong, I think you’re really cool, and– this is not about you being trans <em>at all</em>, but I just– you always talk so much about the–”, he stammered. He was making a fucking fool out of himself.</p>

<p>“Oh God,” Jaz interjected. He turned bright red and averted his eyes. “You think I’m just some horny fuckboy, don’t you?”</p>

<p>Weirdly, Tom was happy that Jaz just said clearly what Tom had tried so hard to eloquently describe. But how to continue this hell of a conversation now was the tricky part. So he didn’t, and he just stared instead.</p>

<p>Jaz, out of nowhere, started to laugh. “I mean, you know… I kind of <em>am</em>. I don’t blame you.”</p>

<p>For some twisted reason, Jaz seemed to be totally fine with Tom essentially insulting his entire <em>lifestyle</em> just then, and so Tom decided that he absolutely had to fix this situation. Just <em>how</em>, he wondered.</p>

<p>“N– no, it’s not really that. I mean, kind of? It has to do with that. I– whenever you talk about this– whenever my <em>friends</em> talk about this–”, he began, and immediately wished he hadn’t. But there was no turning back now.</p>

<p>“It’s not about the <em>amount</em> of sex you have. Like, at all. It’s just that… you all seem so <em>excited</em> about having sex, and I’m happy that you are, but I’ve never felt that way about it. Talking about it just makes me feel kind of… weird? Like, why am I not interested in this? Why is everyone excited by the idea, and I’m not? Is there something wrong with me? I don’t–” Tom started to cry now. Tears were flowing from his stupid eyes like a stupid goddamn waterfall, and he was just standing there like a stupid fucking idiot.</p>

<p>And then Jaz laid his hand on Tom’s shoulder and frowned again. “Dude,” he said. “There’s nothing wrong with you. Not everyone’s interested in sex.”</p>

<p>Tom tried to wipe his eyes on his sweatshirt sleeve without much success. “Clearly, you haven’t talked to a human before.”</p>

<p>Jaz chuckled. “I’ll have you know that I’ve talked to plenty of asexual people in my life.”</p>

<p>Asexual people?</p>

<p>“Asexual people?”, Tom asked, puzzled.</p>

<p>“Ah,” Jaz said and smiled. “Well. When someone identifies as asexual, they usually aren’t interested in having sex, or they’re only interested in having sex in certain situations, like with a partner they feel emotionally connected to. Well, it’s a spectrum, really. But it’s not <em>weird</em> or <em>broken</em>. At all.”</p>

<p>Wow. Well… that was a whole-ass <em>revelation</em> to Tom. He stared at Jaz, who was looking back and still smiling. “Oh my God,” Tom finally said. “I’m such an idiot.”</p>

<p>Jaz laughed, again, because apparently that was all he did nowadays. “Dude, it’s okay,” he said. “Not everyone knows everything.”</p>

<p>That was true, Tom had to admit. But how had he not known about this? Jaz made it sound like there was this entire <em>community</em> of people that probably felt exactly like he did, and he never cared to do <em>any</em> research about this? He felt like a proper idiot now.</p>

<p>“I guess,” he began again. “I never did any research on this because… I just felt so strange about it,” he admitted to himself and to Jaz.</p>

<p>Jaz nodded, and pulled him in for a hug again.</p>

<p>Before this, Tom had never known how thoughtful Jaz was. How caring.</p>

<hr />

<p>Tom did not want to admit it, but that interaction had really changed things for him. He was tossing and turning in his bed, going back to grabbing his phone and looking up asexuality on the internet over and over again. He blamed himself. He couldn’t believe that it had taken him this long to find out about it. He knew that people always say that “it’s never too late to find yourself”, and that you shouldn’t blame yourself for struggling with your identity. But he blamed himself anyway, because that’s just what he did.</p>

<p>When it got to the morning hours and the light started creeping into his cabin, Tom pulled himself out of bed and put on the first coherent outfit he could find. Like someone from those teen movies he occasionally watched with his mom, he mulled it over in the mirror before switching to a different one. While undressing, he wondered why he was even doing this—something he didn’t recall ever doing before.</p>

<p>It wasn’t for Jaz. That much was clear.</p>

<p>It was for a totally different occasion that had nothing to do with Jaz.</p>

<p>Yea.</p>

<hr />

<p>The two families met up for breakfast, just like they’d done every day while on the cruise, and Jaz sat down opposite Tom and smiled. After engaging in various conversations about the previous few days, the night and the plans for the day ahead of them, their moms left to go to the bathroom. Tom was about to get up to get more orange juice, but he hesitated when he noticed that Jaz seemed to be intently staring at him.</p>

<p>Jaz’s light blue eyes were fixed to his, and after a few seconds, Jaz started to smile. Sitting there across from Jaz, Tom noticed for the first time how beautiful his eyes looked, and how his dark brown bangs were covering his eyebrows. He wasn’t sure if Jaz styled them or if they were naturally this curly, but he felt it’d be weird to inquire about that now. Eventually, Jaz picked up his own glass and started walking away, presumably to get more juice for himself. Too mesmerized by Jaz’s eyes, and movements, and his stupid curly bangs bouncing as he moved, he totally forgot to ask Jaz to get him a refill too, or to just tag along to the juice bar. What was going on with him?</p>

<p>After Jaz was out of eyeshot, Tom decided to get his act together and started focusing on his breakfast again, slowly working away at the massive pile of tasty things he’d picked up from the buffet. When Jaz came back a minute or so later, he plonked down a full glass of orange juice next to Tom’s empty one, and then placed down another one next to his own plate. Tom was confused for a moment, because social cues weren’t necessarily his strong suit, but after a moment of silence, Jaz smiled down at him and said, “Thought you might want some more juice.”</p>

<p>“Thanks,” Tom said quietly and lowered his head again, trying to focus on the massive tower of vegetables, bread rolls and cold cuts in front of him.</p>

<p>Jaz was really thoughtful, he thought to himself then, and felt his face getting warmer. He was blushing. How embarrassing. This was just a meaningless gesture, right? Nothing to blush over. Nothing to obsess about. Right?</p>

<p>After their moms came back, Tom sat in relative silence for the rest of the meal.</p>

<hr />

<p>After breakfast, Tom’s mom suggested going to the pool on the roof. Jaz’s mom seemed skeptical at first, but was easily swayed by her son’s suggestion of a big glass of lemonade and a deck chair.</p>

<p>Tom did not like the pool idea. He’d always been insecure about his looks, especially his belly and his legs, which was why he rarely ever wore shorts in the summer. Meanwhile, Jaz always rocked crop tops and cute hats, and yea, maybe Tom was a little jealous of that. Sometimes, he wished he could have the effortless confidence that Jaz seemed to have.</p>

<p>When they got to the pool, their moms immediately pulled off their bright summer tops and jumped into the water, but Tom hesitated, because of course he did. He stood for a minute or two and just observed the water, the little waves and ripples it created and the effects that the bright midday sun had on it. He noticed that Jaz hadn’t pulled his shirt off yet either, and that he was standing almost as awkwardly as Tom was. He’d never seen Jaz like this, he thought. Tom observed Jaz pulling his shirt up slightly, but then stopping just shy of his chest and letting go of the fabric again. It took him a few seconds, but eventually he understood why.</p>

<p>He understood anxiety like this. This was his <em>thing</em>, and for once, he felt like he knew how to talk about it.</p>

<p>“Hey, are you okay?”, he asked quietly as he put a hand on Jaz’s shoulder.</p>

<p>“Yea, I’m good. Just don’t wanna take off this shirt, you know?”, Jaz replied sheepishly and lowered his head again.</p>

<p>Tom asked why, even though he was almost certain that he knew why.</p>

<p>“Well, the…”, Jaz started, but then hesitated. He turned a bit so Tom and Jaz were facing each other straight on, and then pulled up his shirt slightly higher than he had previously, revealing two horizontal scars on his lower chest. His top surgery scars, Tom thought to himself.</p>

<p>“These,” Jaz said and pointed at one of them with his other hand. “They’re from my top surgery a few years ago,” he added.</p>

<p>“Oh,” Tom said, trying to appear somewhat surprised. “They look cute, though.”</p>

<p>For a second, Tom wasn’t sure if he’d just said that out loud or just thought it in his head. But when Jaz started blushing and then smirking, he knew that he’d definitely said it out loud.</p>

<p>Oh, no.</p>

<p>“Well, I mean– not <em>cute</em>, but– well, not <em>not</em> cute– they’re like, when– they–” Tom stopped for a second and took a deep breath. Jaz was still smirking, a little wider now.</p>

<p>“They’re like–”, Tom tried again. “They show that you went through something and came out on top, you know?” On <em>top</em>? Come on, Tom.</p>

<p>“Well, not– on <em>top</em>, but like–”, he began again. But Jaz put a hand on Tom’s shoulder and laughed. “Don’t worry, I get it.”</p>

<p>Probably thinking about Tom’s little wisdom, Jaz ran his hand along one of the scars. Finally, he said, “You’re kind of right, you know? I shouldn’t be embarrassed about them.”</p>

<p>Tom breathed a sigh of relief before quietly telling him that, no, he doesn’t have to be.</p>

<p>“Thanks, though,” Jaz said and laughed again. “Wanna jump in together?”</p>

<hr />

<p>At the end of the day, Jaz tapped Tom’s shoulder in the hallway again, just like he did that one night, the night Tom noticed that there was something between them. Something other than hate or ambivalence.</p>

<p>Tom turned around and saw Jaz, his curly hair still messy ever since the pool, beaming the same way he did after Tom had talked to him about the scars. “Today was fun,” Jaz said.</p>

<p>“Yea,” Tom replied. “You’re fun to spend time with,” he added without thinking about it.</p>

<p>For some reason, he didn’t feel like he had to take it back this time, though. Not only did he feel that it was true, he felt that Jaz had to <em>know</em> how Tom felt about him.</p>

<p>“Yea,” Jaz said quietly, before taking a step closer to Tom. He seemed kind of insecure now, the way he was at the pool. Was there something else about his surgery? About his scars?</p>

<p>No, this seemed like a different kind of insecurity.</p>

<p>“So, uh,” Jaz began, before moving in even closer. “We don’t have to do anything else, but…” He gently took Tom’s hand. “Do you maybe want to, uh, kiss?”, he asked.</p>

<p>Jaz asked to kiss him, right then, in the hallway, where they had their first ever honest conversation. Where Tom learned that Jaz wasn’t just some dumb idiot, but that he was funny, and caring, and <em>complex</em>.</p>

<p>Tom didn’t reply; he just drew Jaz in for the kiss instead. And then they stood there, their hands intertwined, with their eyes closed and their lips touching for the first time.</p>

<p>Maybe it’d been meant to be like this all along.</p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Tom didn't like his mom's friend's son Jaz, though he wasn't entirely sure why. But stuck on a ship with him, he found out a lot about him, and even more about himself.]]></summary></entry><entry><title type="html">📦 Of Abby, Love and Butt-Shaped Pillows</title><link href="https://ellpeck.de/blog/abby_love_and_boxes/" rel="alternate" type="text/html" title="📦 Of Abby, Love and Butt-Shaped Pillows" /><published>2022-02-16T00:00:00+00:00</published><updated>2022-02-16T00:00:00+00:00</updated><id>https://ellpeck.de/blog/abby_love_and_boxes</id><content type="html" xml:base="https://ellpeck.de/blog/abby_love_and_boxes/"><![CDATA[<p>Jeremy was sitting in his kitchen as suddenly, the room went dark.</p>

<p>Great. Two months living here, and the house is already falling apart. That was just Jeremy’s luck, wasn’t it?</p>

<p>He got up from one of his brand-new kitchen chairs and started making his way up the stairs to the attic, which is where he’d probably stored the light bulbs he brought from his old apartment. He didn’t actually remember, mind you, because Jeremy hardly ever remembered anything. Jeremy was a man of few words, and a man of few thoughts.</p>

<p>Now standing on the wobbly ladder that folded down from the ceiling, he used most of the strength his body allowed him to lift a thick wooden board out of the way to reveal a hole in the ceiling to the attic. He climbed the scary ladder all the way and breathed in the stale air that had accumulated over all of those years that the house had stood on its own. After shuffling around some boxes with various words on them (like “kitchen” and “bathroom” and “heavy shit”), he finally spotted a small, transparent plastic box that contained a few light bulbs. Crouching into the corner to retrieve them, he noticed something he hadn’t seen the few times that he’d been up here: A small, heart-shaped box, almost hidden entirely by the layers and layers of dust that were covering it.</p>

<p>Ready to reveal an old family secret or a bomb or, more realistically, just some weed in a little bag, he shuffled closer to the box and reached out to grab it. It was dusty. And kind of disgustingly sticky. Why was it <em>sticky</em>?</p>

<hr />

<p>Light bulb changed, box dusted and un-sticked with a sponge that he now <em>desperately</em> wanted to throw away, Jeremy was ready to open it and reveal the weed-covered family bombs inside. The box was made of a thick cardboard-y substance (that was the technical term, he was sure), and dusting it revealed that it had been pink all this time.</p>

<p>The box contained several pieces of paper, a tiny, butt-shaped pillow that was probably supposed to look like a heart, and a silver necklace that represented half of a heart. Presumably, it was one of those where another person wore another one that was the opposite half, and it was a metaphor for their undying love, or a metaphor for the fact that a lot of people get divorced. Jeremy was never really sure. All in all, it was a lot of heart-shaped, love-related items, though.</p>

<p>But who had the other half of the necklace?</p>

<p>Clearly, this box had been meant for someone else. Obviously, it was not meant for <em>Jeremy</em>, but he knew that. He thought that it must’ve been meant for someone other than the person that had put it in his attic. Which was probably the previous owner of the house. Reading them, Jeremy quickly realized that the pieces of paper were actually letters. Love letters to someone named <em>Barb</em>. Was that even a <em>name</em>? Maybe it was short for Barbara?</p>

<p>There was one letter that stood out to him in particular. Most of the other ones seemed like they were just kind of <em>in</em> the box without actually belonging there (they were short notes about making plans and meeting up and holidays), but there was one that was clearly about this very box.</p>

<p><em>My beloved Barb,</em>
<em>Before you, I never met anyone who was quite as intoxicating, as filled with love, as passionate as you. I want you to know that, now and forever, I love you.</em>
<em>I did not tell you this before, because I was scared. I was worried that you would not feel the same about me. I was worried about so many things. But now that our paths are about to part, and now that we might never see each other again, I need to give you this.</em>
<em>It is all the things I could never give you. It is all the things I bought, and made, and wrote, and then stowed away instead of giving them to you. Because I was scared.</em>
<em>But I will not be scared this time.</em>
<em>I love you, Barb.</em></p>

<p>Well. To say that Jeremy was moved by this letter was an understatement. Jeremy, as few words and thoughts as he had, he really had a lot of space in his heart. And clearly, Barb, whoever they were, had never received this box… right? In his head, he calculated how old this box could <em>possibly</em> be. None of the letters seemed to be dated, and none of the other items were food, so they didn’t have expiration dates. The butt pillow had a little sign attached to it that was filled with washing instructions and small print, but also had the number 95 on it. Was it made in 1995? Maybe. Probably not, though. No one post-1995 was named Barbara, let alone <em>Barb</em>. And the previous owner had never mentioned a Barb, or a Barbara, or a barbarian, or anyone like that.</p>

<p>More importantly, what was he even going to do with this knowledge? And this box? Was he really going to spend his afternoon trying to figure out how to get it to its rightful recipient? And what were the ethics of doing that, anyway? What if this anonymous romantic had already moved on from Barb, probably to a person with a human name?</p>

<p>No, he was determined now. Jeremy loved love. He’d have done anything for love. Even chase down a person that might not exist based on some information from a sticky pink box.</p>

<p>One thing he knew for sure was the house’s previous owner’s name: Mariland Smith. Also not a human name, he noted. Maybe Mariland knew something about this box of butts and secrets.</p>

<p>Mariland was easy enough to reach, given he’d already talked to them a few times about the bathrooms and the piping and the power bills and the keys and how to get up to the attic. Weird then that they’d never mentioned a mystery box up there, though.</p>

<p>“A Barb, you say? Hmm,” Mariland began after Jeremy told the story. Of course, Mariland didn’t point out how peculiar the name Barb was because they had an equally ridiculous name. Instead, they pointed out that they’d rarely used the attic and that that was probably the reason they never saw the package. Made sense, Jeremy guessed.</p>

<p>After some silence, Mariland gasped.</p>

<p>“Actually, one of the neighbors did talk about a Barb from time to time. I think it was Mr. Garcia just down the road. You know, honey, I’m really sorry, but I didn’t really know many of the people there.”</p>

<p>Jeremy smiled. That was surprisingly helpful. “Thank you so much, that is honestly really helpful,” he said earnestly, and after some goodbye-ing of the regular sort, he hung up.</p>

<hr />

<p>Mr. Garcia, while being very old and exceptionally grumpy, actually had quite a bit of useful information for Jeremy. It wasn’t the wild goose chase he feared to find out that Barb was, amazingly, short for <em>Abigail</em>, which seemed like some made-up shit to Jeremy. Maybe they read the first two letters backwards? And then added more random letters? Whatever.</p>

<p>A-barb-igail turned out to be an older lady that also used to live in the neighborhood, but Mr. Garcia didn’t know whether she still did, or whether she was even still <em>alive</em>. How reassuring. He also made sure to point out to Jeremy that he’d never liked people like her, too eccentric, too loud, and too fully of energy. Thanks, Mr. Grumpy.</p>

<p>He made his way down the street to where Abigail-slash-Barb’s house was meant to be. With Jeremy’s luck, he’d probably find some ruins there, or a small forest, or a full-on black hole. What he really found was a small bungalow with washed-out, light blue side panels. It looked a lot smaller than his new house, but the roof looked a little less steep and the foundation seemed different, so he didn’t know for sure.</p>

<p>He rang the doorbell, <em>praying</em> for the person opening to be Barb, with a sign hanging around her neck that says “Hello, I am Barb, and you don’t have to speak to more people. This whole adventure was not a mistake, and it is now over, you have successfully found me.” A short woman with a long ponytail opened the door. Jeremy introduced himself, and tried to get to the point as quickly as possible.</p>

<p>This was not Barb. Of course, it wasn’t. It was Lucy. Jeremy told the story of the box, and the butt-shaped pillow, and the adorable note, and the half-heart-shaped necklace, and Lucy listened with wide eyes, and she was beaming.</p>

<p>“My gran… she never <em>knew</em>,” she suddenly said. Wait, her <em>grandma</em>?</p>

<p>“Wait, y-your <em>grandma</em>?”, he stammered.</p>

<p>She laughed. “Abigail. Yeah. I would always call her ‘Granny Abby’, but she tried to get everyone to call her Barb. I don’t know why.”</p>

<p>Jeremy sighed. She couldn’t have said this at the start? When he asked about a Barb? Well, at least <em>Lucy</em> had a normal name.</p>

<p>“Down the road, you said? The green house?”, she asked.</p>

<p>His new house wasn’t really green anymore, since nobody had repainted it in a few years, probably even a decade. Jeremy didn’t mind, because he never saw the outside much himself, and he couldn’t care less what some strangers down the road thought of the state and dilapidation of his house.</p>

<p>“Yea, Maple 17,” he replied.</p>

<p>“Evelyn Sherwood”, she muttered somberly. “Her and Abby were best friends. Ever since I can remember, they spend most of their time together. Of course, no one thought about it at the time because an old lady like that–people thought she’d have herself figured out, I guess. Maybe they just didn’t talk about it much back then, either.”</p>

<p>Lucy had been staring into the hallway from where she was sitting, with a kind of intensity that implied she was focusing on something. But there was nothing there. What was she picturing?</p>

<p>“Yea, people had to be a lot quieter about it back then.” He paused for a second to arrange his thoughts. All of a sudden, he had a lot of those. Emotions, too.</p>

<p>“The letter makes so much more sense to me now,” he finally said. “She said that she was too scared to tell your grandma. Maybe it wasn’t just about the anxiety for her.”</p>

<p>“Yea,” she said under her breath, which had become heavier. “I can’t believe she never-“</p>

<p>Lucy let her head drop gently onto her folded arms, which were resting on the table. Jeremy sat there quietly, not knowing what to do. Surely, anything would be better than just sitting there like a fucking idiot, he thought. So he took the leap and trusted his instinct.</p>

<p>“I’m so sorry, Lucy,” he said. He waited a second in an attempt to figure out if she heard him or not. “When did she pass?”, he asked finally.</p>

<p>It took a few moments for Lucy to catch her breath. Awkwardly, she used the sleeves of her purple sweater to wipe away her tears, along with most of her makeup.</p>

<p>“It’s been almost a year now,” she muttered. “We’re still not fine. I know it’s- I know it seems pathetic, but my mom hasn’t recovered yet, either. She never spent more than a week away.”</p>

<p>Jeremy hastily searched his jacket and jeans pockets for a pack of tissues. Once he finally found it, he placed it on the table in front of her.</p>

<p>“It’s not pathetic at all,” he managed. He was awful at social situations, let alone situations in which someone was crying because they suffered a tragic loss. Jeremy was completely out of his depth here, but somehow, he still felt like he was managing fine.</p>

<p>“I know,” she said sniffly. “It’s just hard for us.” She took one of the tissues. “Thanks.”</p>

<p>Jeremy looked at Lucy as she blew her nose and used a second tissue to pat her face dry. It was a mess now, with her black eyeshadow having spread lines all over her face. But he didn’t mind at all. He understood emotions well (at least he liked to think so), and he understood how hard it was to lose a loved one.</p>

<p>They sat for a little longer before Lucy recovered somewhat and went to make some tea for the two of them.</p>

<hr />

<p>A few days had passed, and Jeremy found out a lot more about Barb, Evelyn and their story. He and Lucy had been talking frequently, and with every time she talked about their story, she seemed to lighten up more. It started out just like that first day, with her crying, and Jeremy feeling awful about asking in the first place. But as their conversations went on, Lucy started to seem excited about the love story that could have been.</p>

<p>That day, she called him on the phone while he was in the kitchen, sitting over his laptop and eating a bowl of cereal. He picked up the phone.</p>

<p>“Oh my <em>God</em>,” Lucy immediately began on the other end, with a kind of excitement in her voice that Jeremy didn’t think he’d heard from her yet. “I completely forgot that they went to the same <em>retirement home</em>!”</p>

<p>Retirement home? “Retirement home?”, he asked out loud.</p>

<p>“Abby and Ev! Like five years ago, my mom got busier with her job because of some big promotion, and obviously I was at school all day, so my grandma decided to move into a home, and she visited home every weekend. But she talked about that place all the time, because Evelyn lived there and talked about it all the time! <em>That’s</em> why she said in the letter that they might never meet again!”</p>

<p>Jeremy finally understood what she was implying, and he was smiling now. “Wait, and so you think-“</p>

<p>She didn’t interrupt him, per se, as that was exactly what he’d wanted her to do. “<em>They shared a room</em>, Jer,” she said, as if this was some big life-changing revelation for her. Maybe it was.</p>

<p>“Shared a <em>room</em>? I didn’t even know you could do that in a retirement home,” he said, half-surprised, half-excited.</p>

<p>“There is <em>no way</em> that Ev didn’t admit it to her all that time. Absolutely no way. Jer, they were <em>literally roommates</em>, and none of us got it. Oh my God.” Lucy seemed like she couldn’t stop talking. It was all just flowing out of her, but Jeremy really enjoyed hearing her like this.</p>

<p>They talked for a little longer, and Lucy told more stories about Ev and Abby, and Jeremy loved listening to it all. He imagined her grandma and Evelyn, going on dates, and holding hands at the lake, and eating dinner together. Lucy imagined them sitting together, outside, on a porch swing, with their hands intertwined, looking out at the sunset. It was a perfect date straight out of a movie, the way she seemed to picture it.</p>

<p>After they both hung up, he finally finished his cereal, and he started thinking about the box again. Once he was done eating, he fetched it from on top of his kitchen cabinet, where he’d put it to avoid having to enter the attic again.</p>

<p>He grabbed the small, heart-shaped pillow out of the box and held it in his hand, squeezing it slightly. It was still kind of sticky, but this time around, Jeremy didn’t seem to mind. Right now, he was feeling inexplicably brave.</p>

<p>He picked up his phone and started typing up a message to Lucy.</p>

<p>“Speaking of perfect dates,” he started. “Wanna see a movie tonight?”</p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Jeremy had just moved into a new house when he found a mysterious, heart-shaped box in the attic. Intrigued by its contents, he started asking his neighbors about it, and he would soon discover a secret love story.]]></summary></entry><entry><title type="html">📚 My Favorite Reads of 2021</title><link href="https://ellpeck.de/blog/reading_faves_2021/" rel="alternate" type="text/html" title="📚 My Favorite Reads of 2021" /><published>2021-12-04T00:00:00+00:00</published><updated>2021-12-04T00:00:00+00:00</updated><id>https://ellpeck.de/blog/reading_faves_2021</id><content type="html" xml:base="https://ellpeck.de/blog/reading_faves_2021/"><![CDATA[<p>2021 has been a rough year. For all of us. I decided to use it to do some more reading again. This is a list of some of my favorite books I read this year. As you’ll be able to tell pretty quickly, my main interest is very gay romance books. <em>What a surprise.</em></p>

<p>I compiled this list by going through my <a href="https://app.thestorygraph.com/profile/ellpeck">StoryGraph</a> 5⭐ reviews and picking the ones that I thought it would be most interesting to talk about. There won’t be many, if any, spoilers, but I’ll definitely be summarizing the plot of these books in this post and putting a few funny quotes. These also aren’t in any particular order, either.</p>

<h2 id="-boyfriend-material-by-alexis-hall">🪲 Boyfriend Material, by Alexis Hall</h2>
<p><a href="https://app.thestorygraph.com/books/4ecc34c0-04e1-420f-a303-2a900063397e">Boyfriend Material</a> was the first book written by Alexis Hall that I had the pleasure of reading. And I found out pretty quickly that he is an absolutely <em>fantastic</em> author. His writing is incredibly funny, but also deeply emotional and touching in certain places. It’s an amazing mix.</p>

<p>Boyfriend Material is about two guys who have absolutely no business falling in love… falling in love. Luc works at a charity for some sort of beetle that has (surprisingly) little significance in the story, and Oliver is some sort of fancy lawyer-type person. Luc’s friends are incredibly funny (not just their personalities, but also the way they’re presented), and the way that Luc and Oliver interact is delightfully embarrassing, but also incredibly cute.</p>

<p>There’s also two characters called James Royce-Royce and James Royce-Royce. I promise I’m not making that up.</p>

<blockquote>
  <p>I met James Royce and James Royce (now James Royce-Royce and James Royce-Royce) at a university LGBTQ+ event. In some ways, it’s strange the two of them work so well together because their name is pretty much the only thing they’ve ever had in common.</p>
</blockquote>

<p>The book is a great first step in discovering the amazing, witty and hilarious writing of Alexis Hall. There’s at least three of his other books that I’d love to talk about here. I promise I won’t. But actually, I will. Two more of his books are coming up.</p>

<h2 id="-one-last-stop-by-casey-mcquiston">🚇 One Last Stop, by Casey McQuiston</h2>
<p><a href="https://app.thestorygraph.com/books/28386517-30cc-4ce4-bb90-9336c370a9dd">One Last Stop</a> falls into a genre that I usually can’t quite get myself to enjoy: Somewhat far-fetched science fiction. I’d previously read one of Casey McQuiston’s books, namely <a href="https://app.thestorygraph.com/books/d9b32ad2-41d2-4663-a19c-f65ffc7b0091">Red, White and Royal Blue</a> and absolutely adored it, and so I thought it was a good opportunity to discover some more of their writing.</p>

<p>One Last Stop is about a girl, whom I will refer to exclusively as Coffee Girl, who moves to a big city and immediately falls in love with a girl she meets on the train, whom I will refer to as Subway Girl. There’s a bit of a problem, though: Subway Girl is <em>not from this time</em>. Spooky. She’s actually stuck in the train due to some sort of time… problem that I shan’t go into because, to me, it is very far from the most interesting part of the book.</p>

<p>What I enjoy most is the way that the main character struggles with this issue, and the way her emotions are depicted, not only in relation to Subway Girl, but also in relation to her hilarious queer friends, her chaotic and possibly not-very-good mother, and the ever-present dread of having to go to University instead of hanging out with the girl on the train for all eternity.</p>

<blockquote>
  <p>“I swear to God, if a ghost kills me, I’ll haunt the shower,” Wes says. “You guys will never have hot water again.” “We don’t have hot water now,” August points out. “Fine, I’ll haunt the toilet.” “Why do you want to haunt a bathroom, man?” Isaiah asks. “It’s where people are most vulnerable,” Wes says, like it’s obvious. Isaiah frowns thoughtfully and nods.</p>
</blockquote>

<p>Please read this book, <em>especially</em> if you enjoy the sci-fi aspect more than me. Which I’m sure you do, given I ignored it as best I could.</p>

<h2 id="-jews-dont-count-by-david-baddiel">🕍 Jews Don’t Count, by David Baddiel</h2>
<p><a href="https://app.thestorygraph.com/books/e13bcb3b-a0ea-474e-8259-e55d1b0fe4ef">Jews Don’t Count</a> is the only non-fiction book on this list, because it turns out that I enjoy fiction far more, given it’s usually a lot less depressing.</p>

<p>Now, I’m not jewish. I feel the need to point this out right off the bat because I’m not a big fan of talking about political problems that I don’t have any personal experience with. That being said, I <em>am</em> from Germany, and the troubles surrounding antisemitism have been absolutely drilled into our heads as schoolchildren. Even moreso did it make me feel very uncomfortable about my own observation skills, as well as my own (lack of) political interest in this topic, that this book proves that antisemitism goes mostly ignored when it comes to debate around racism, religious freedom and cultural identity.</p>

<p>If you want to educate yourself on political topics that you don’t have much personal experience with (as you should!), Jews Don’t Count is a great read. It’s aimed at leftists like me and probably you, and it aims to shine a light on the way that antisemitism is treated in the Western world in the current times. As it turns out: It’s treated very poorly. The book, however, treats the topic it’s about with respect, brings up a lot of current day examples to illustrate the issues, and is only about 150 pages long, making it deliver a very quick, but also very powerful, message.</p>

<h2 id="-rosaline-palmer-takes-the-cake-by-alexis-hall">🎂 Rosaline Palmer Takes the Cake, by Alexis Hall</h2>
<p>I’ve talked about Alexis Hall before. In fact, it was this very blog post. Just… a few minutes ago, actually. But here I am, yet again, talking about his absolutely brilliant writing.</p>

<p><a href="https://app.thestorygraph.com/books/bbac9ac1-8d25-4413-8cbd-acb82e79cb67">The book</a>, whose title is far too long, is about Rosaline Palmer, a bisexual single mother who makes the terrible (but great) decision of joining what is essentially a not-so-trademarked version of the British Bake-Off, only with exactly the same amount of chaos and hilarity. When that isn’t currently the main thing messing up her life, it’s also about her relationship with a very, uh, <em>lovely</em> man, the relationship with her daughter, and the relationship with her excellent and sexy friend Anvita (her words, not mine).</p>

<p>Here’s a lot of quotes, because <em>Jesus Christ, this book is funny</em>. But also very real. I’m not quoting the real parts, because they’re not as funny. But it gets very emotional, and very “there’s a lot of problems with the way bisexuality is perceived by straight people”, and very “life is hard sometimes”. But this is just some funny parts. Don’t wanna bring you down.</p>

<blockquote>
  <p>Grace Forsythe tried to give her a reassuring look from the opposite side of a cake that was rapidly turning into a landslide. “It’s fine. I’ll just stand here holding it for the rest of my life. You can tell the judges I’m an especially elaborate fondant decoration. Which, now I think about it, is what my ex-girlfriend used to call me.”</p>
</blockquote>

<blockquote>
  <p>To her horror, she was actually crying. And the next thing she knew, Grace Forsythe was gently removing the spoon from her hands. “Fuck shit piss wank bollocks drink Coca-Cola buy Smeg ovens legalise cannabis abolish the monarchy. Oh sorry, did I ruin the segment? What a shame. Maybe go film someone else for a bit.” The producer and camera operator dutifully departed. Rosaline drew in a shaky breath and wiped her eyes. “God, thank you.”</p>
</blockquote>

<p>Hi Alexis, if you’re somehow reading this: I am <em>begging you</em> to make a second book that is just about Grace Forsythe and her life. Please. I’ll do anything.</p>

<h2 id="-act-your-age-eve-brown-by-talia-hibbert">🏨 Act Your Age, Eve Brown, by Talia Hibbert</h2>
<p>Talia Hibbert is also one of my favorite authors. She writes brilliantly about diverse people, be that sexuality, race, personality or illnesses. Out of the three Brown Sisters books, <a href="https://app.thestorygraph.com/books/8a97c89d-1436-4563-bc1f-e44836a750b9">Act Your Age, Eve Brown</a> is by far my favorite.</p>

<p>Act Your Age, Eve Brown is about Eve Brown, who stumbles into a… hotel-slash-inn ran by a particularly charming, but also (to her) extremely irritating, young man named Jacob. As it turns out, Jacob doesn’t quite like Eve either… <em>at first</em>. If you know what I mean.</p>

<p>The book is written from both perspectives on a per-scene and per-chapter basis, and it is a fantastic read. The relationship between the two main characters is hilarious, and with Eve actually <em>getting a job</em> from the very guy whom she <em>ran over</em> with her car (yes, really), it is quite the rollercoaster, to say the least.</p>

<p>Also, the writing is hilarious. Just look.</p>

<blockquote>
  <p>Jacob Wayne was never screwed. Well, not like that—obviously he was sometimes screwed in other, better ways. Although not as often as he’d like, but—you know—ah, fuck it, never mind.</p>
</blockquote>

<blockquote>
  <p>There was that voice again, strange and yet familiar. His mind was hot and sticky like fudge. Yum, fudge. Was this a guest, maybe? A yummy, fudgy guest? Fuck. No lying around in the street in front of guests. It was inappropriate and irresponsible and very bad business.</p>
</blockquote>

<p>Yum, fudge.</p>

<h2 id="-murder-most-actual-by-alexis-hall">🔎 Murder Most Actual, by Alexis Hall</h2>
<p><a href="https://app.thestorygraph.com/books/3f146f4d-136e-4c75-9cd7-4bdd50aa25b3">Murder Most Actual</a> is the last of these books I read. It’s by Alexis Hall, whom you may have heard of from the last seventeen thousand times I talked about him. He’s brilliant, blah blah blah, you’ve heard this already, but what you haven’t heard yet is the fact that I downloaded an e-book from a site I’d never used before, made an account and everything, and then painstakingly shoved it onto my Kindle, so I could read it. As it turns out, it was worth it. Very. In fact, this is probably his best book yet. Maybe. I’m not sure.</p>

<p>Murder Most Actual is about murder, but in a most actual way. Yes. It follows a couple of lesbians (as in “a lesbian couple”, not, like, 3 stray lesbians), because everyone in Alexis Hall’s books is gay (which is not criticism, it’s exactly the way I want it to be), as they arrive at a hotel that is hosting a fun murder mystery dinner. The only problem is that it’s not so much a murder mystery dinner as <em>multiple murders</em>, <em>multiple mysteries</em> and an ever-growing shortness of dinner. Over the course of the book, the relationship between the two main characters redevelops into something absolutely adorable, and they also solve the murders. Somewhat. With the help of a particularly disgruntled police guy, who I think should also get his own spin-off eventually.</p>

<p>It’s also, and I know I’m starting to sound like I’m repeating myself, <em>incredibly funny</em>. Getting these quotes onto my computer was an absolute nightmare, by the way, becasue the notes and highlighted sections from my Kindle don’t sync with my computer because it’s not a… proper Kindle… Amazon… book. Thing.</p>

<blockquote>
  <p>Liza was suddenly aware of an absence at her side as Hanna stepped forward to join the free-for-all. “Just a wacky, out-there suggestion somebody might want to jump on. Could we, maybe, call the police?”</p>
</blockquote>

<blockquote>
  <p>Now Sir Richard was looking genuinely crestfallen. “You know, between the two of you, you’re almost taking all the fun out of this.” “Out of the dead man?” Hanna clarified.</p>
</blockquote>

<blockquote>
  <p>Neither the professor nor the killer had been courteous enough to wear shoes that were notably large or small, or characterised with a distinctive tread, or perhaps conveniently embossed with the name of a manufacturer who only ever made three pairs of shoes a year for a very select list of clients.</p>
</blockquote>

<p>Also, I love Hanna. Just wanted to say that. <em>Also</em>, each chapter has a fun Clue(do)-style title with a person, and an object, and a location. It’s great. I love it.</p>

<h2 id="so-yea">So Yea,</h2>
<p>I think the main thing we learn from this list is that I love romantic fiction, and I love Alexis Hall. I’m sorry, it’s just all so good.</p>

<p>Anyway, I hope this post was interesting to at least a small subset of you. I know that this isn’t what I regularly talk about, and this post contains a surprising lack of programming-related things (there you go, now it contains programming-related things, sort of), but reading is also something I really enjoy doing. Although I do have to admit that I’m not very good at doing it consistently.</p>

<p>Either way, thanks so much for reading, and if you’re Alexis Hall, please write more books. No pressure, though.</p>]]></content><author><name>Ellpeck</name></author><category term="Reading" /><summary type="html"><![CDATA[I've been using 2021 to read some more again. As it turns out, there are quite a few really good books out there. Here are some of my favorites I read in 2021.]]></summary></entry><entry><title type="html">🎉 Vince, a Party and Brandon</title><link href="https://ellpeck.de/blog/vince_a_party_and_brandon/" rel="alternate" type="text/html" title="🎉 Vince, a Party and Brandon" /><published>2021-07-27T00:00:00+00:00</published><updated>2021-07-27T00:00:00+00:00</updated><id>https://ellpeck.de/blog/vince_a_party_and_brandon</id><content type="html" xml:base="https://ellpeck.de/blog/vince_a_party_and_brandon/"><![CDATA[<p>After dreading it for multiple hours now, it was finally time for Vincent to read the messages that his friend had been blowing up his phone with. It was a little difficult for him, because the conversation that he’d anxiously, but silently, opted out of was regarding the party that Myra was throwing later today. Vince rolled over in his bed and reached blindly for his phone, which he was sure had fallen onto the ground at some point in the afternoon. Unlocking it, he was immediately bombarded by about thirty-seven thousand messages from his friend.</p>

<p><strong>are you coming tonight</strong></p>

<p><strong>hey, stop ignorign me</strong></p>

<p><strong>read my messages you cheap ass</strong></p>

<p>He groaned and rolled over again, kicking the blanket onto the floor with his feet. For a moment, he considered just saying no. But he wasn’t going to let himself give up that easily. Not again.</p>

<p><em>i dont know ok</em></p>

<p><em>youre just gonna talk to someone else</em></p>

<p><em>and ill be all by myself</em></p>

<p>The little tick marks turned blue, and his face followed suit quickly when his phone began to vibrate violently in his hand. A call? Really?</p>

<p>“If you don’t come, I will literally cry, Vincent. What the fuck am I going to do without you?”</p>

<p>Myra genuinely sounded a little annoyed, but Vince knew this game: She’d pretend to be pissed at him for a minute until he started feeling genuinely bad, and then she had to explain to him that she was just joking, like always. It was less of a game and more of a <em>Myra being a normal friend while Vince stumbles around his inability to be a functioning person</em>. So, pretty much like always.</p>

<p>“Damn it, Vince, you know I’m not being serious, right?” There it was. “You’re the only person who it’s fun to drink with.”</p>

<p>Admittedly, he <em>was</em> pretty fun when he managed to leave his anxiety behind at the bottom of a glass. And drunk Vince and drunk Myra would always start deep, meaninglessly meaningful conversations that made them think deeply and then cackle embarrassingly again and again.</p>

<p>And if he said no to this party, he would’ve not only denied his best friend, who was there for him pretty much constantly, but he’d just have to have another sad Saturday night consisting of chips, memes and maybe a, uh, <em>fun toy</em> and some porn. Admittedly, that sounded a lot more fun than some jock-infested party.</p>

<p>“Look, listen,” Myra began after enduring the awkward silence for longer than she reasonably should have. “There’s this guy coming to the party who is really sweet, and he looks pretty cute too. Dan even said that he might be, you know, <em>a top</em>, and I know how desperate you’ve been for that sort of thing recently.”</p>

<p>Damn it. Why did Vincent tell anyone anything, ever?</p>

<p>“Why do I tell you anything, ever?” He half-whispered into his phone and sat up into a surprisingly graceful cross-legged situation and picked up the dildo that he spotted at the foot of his bed. He really had to take better care of his belongings.</p>

<p>“I’m not sure. It’s weird. But no judgement, babe. I know what it’s like.”</p>

<p>“You literally just said that it’s weird, how is that <em>not</em> judgement?”</p>

<p>“Listen. Are you coming or not? I’m not going to spend the rest of the evening getting your sad ass laid.”</p>

<p>Vince rolled his eyes and sighed, deliberately loud enough for her to hear it clearly.</p>

<p>“Stop rolling your eyes at me. Yes or no?”</p>

<p>She knew him too well. He looked at the toy in his hand and fondled it a little. <em>Non-sexually</em> fondled it. He really <em>did</em> want to do stuff with a guy again, but he also quite enjoyed the idea of not having to go out and meet new people.</p>

<p>“Fuck, fine,” he said and flopped back onto his back. Goddamn it.</p>

<p>“There we go,” Myra exclaimed loudly and immediately hung up.</p>

<p>There we fucking go.</p>

<hr />

<p>Myra’s party turned out to be happening at a different house that apparently belonged to a friend of hers or something. Vince was kind of relieved, as Myra’s apartment didn’t feature a lot of space to hide from sweaty crowds of drunken people in. The night was unfurling as people around him started showing clear signs of a buzz, and of course, Myra was absolutely nowhere to be found. Great.</p>

<p>In his frustration, Vince decided to sit down on one of the chic living room sofas that were very clearly too expensive to house his poor ass. Nevertheless, it seemed to invite him to take a little break from the crowds and the anxiety and just <em>breathe</em> for a second.</p>

<p>If he was being honest with himself, Vincent wasn’t at all interested in this party or the people at it. He sipped his drink tentatively, a vodka and coke that tasted more like a vodka and vodka with a side of coke, and looked around the bustling living room. Not only had Myra seemingly disappeared, any other people that he may know and be able to interact with were also nowhere to be found. And while this meant that there were <em>also</em> no people around that he might want to run-away-slash-hide from, it was still kind of a bummer to be wasting his night at this place and still sit around alone.</p>

<p>A few more minutes went by, and Vince started spotting one or two people that he <em>did</em> know, but none of which he wanted to talk to. There was a guy that he’d briefly hooked up with at another one of Myra’s parties about a year ago (he was one of the “straight, but I have needs, too” guys), and there was a girl who had flirted with him a lot before Vince found out that he was, in fact, not at all interested in her or her gender. They’d still continue talking every now and again after that, but it seemed to Vince like she’d only been interested in him as a potential romantic (or sexual) partner, which was fair enough.</p>

<p>Myra finally reappeared by tapping Vincent on the shoulder from behind the sofa. She was radiating confidence and also, maybe, probably, a slight bit of drunkenness. Those tended to go hand in hand for her.</p>

<p>“Hey, stranger,” she said to him as if they hadn’t talked for, like, months, and not literally less than half an hour.</p>

<p>“Is this a rickroll situation, and you just forgot the actual lyrics, or what’s going on with you?” He said to her with a snarky grin.</p>

<p>“Shut up,” she said, jumped over the backrest and landed on the soft, brown leather beside him. She came a little closer and tilted her head to whisper into Vince’s ear.</p>

<p>“Okay, listen. Brandon is here,” she said.</p>

<p>Vince made one of his famous faces. “Who the hell is Brandon?”</p>

<p>“The guy I was telling you about! The cute one with a dick that isn’t made of silicone?”</p>

<p>Ah, yes. The human dick man.</p>

<p>“Couldn’t you guess from the <em>name</em>?” She laughed. He did not.</p>

<p>He chose a smooth “How much have you had to drink?” as his reply and then pushed her head off of his shoulder. “Where is he?”</p>

<p>“He’s, uh…” She narrowed her eyes and began to investigate the crowd.</p>

<p>“Right there!” She exclaimed and jumped up from the couch. “Go to him! Come on!”</p>

<hr />

<p>Brandon was, in fact, quite cute. Actually, Vince might have been drooling over him just a tiny bit while waiting for Myra to resurface earlier, even before he knew that he was the cute, gay friend in question. Well, he might have been bi or pan or something. That wasn’t important right now.</p>

<p>What <em>was</em> important right now was getting Brandon out of the hot tub and into one of the spare bedrooms. Why was there even a <em>hot tub</em>? Had someone taken this house from a high school movie? Though, in the hot tub’s defense, it did allow Vince to see Brandon’s not-quite-chiseled chest and his not-so-short hair that was flowing over his surprisingly broad shoulders. He hadn’t quite decided if he found Brandon cute or hot yet, but he <em>had</em> decided that he would quite enjoy spending some more time with him to figure it out.</p>

<p>Vincent, being the perfect-at-social-interaction smooth talker that he was, stood in front of the hot tub like an idiot, just staring at Brandon’s beautiful fucking face. How did humans do that <em>speaking</em> thing again?</p>

<p>Brandon turned around and saw Vince standing there like an idiotic statue. He looked at him for a second and then turned to jump out of the hot tub gracefully, with little streams of water running down his chest and over his abs and dripping off of his Bermudas. That’s just what water usually did, but it looked fantastic on this guy. Of course.</p>

<p>“Oh hey,” Brandon began, to Vince’s absolute surprise. He tried to snap out of his continued statueing and blinked. “You’re Vince, right? Myra told me all about you.”</p>

<p>“Yup, yea, that’s… that’s me. Hi.” He stood there awkwardly, debating whether he should extend his hand? Go in for a hug? No, he was dripping wet. The— <em>Brandon</em> was dripping wet. Yes.</p>

<p>Not too long after the most awkward thirty-five seconds of his life, Vince found himself sitting next to Brandon on a bed in a room that Vince was pretty sure was at least twice as big as his own apartment. Brandon had, despite Vincent’s wordless disapproval, towel dried himself off and put on a shirt.</p>

<p>After staring at each other for a few seconds, their thighs rubbing together on the bed, things started going pretty fast. Brandon took of Vince’s shirt and then his own, and Vincent started making use of his free hands to feel Brandon’s rather muscular body. Brandon took off his Bermudas and they both realized that he was not wearing anything else underneath, revealing his rock hard—and very human—cock. Vince also took off his pants after struggling with his belt buckle for an embarrassing amount of time, and then he found himself laying on his back with Brandon’s chest pressed against his, their cocks rubbing against each other. Brandon got up from the bed and grabbed Vince’s legs, pulling him towards the edge of the bed.</p>

<p>Vincent knew where this was going, and he really, <em>really</em> wanted to like it. But as Brandon was pulling Vincent closer to his throbbing cock and bending his lower legs to rest them on his own shoulders, some sort of switch flicked inside Vince’s head. Yes, of course he wanted to have his brains fucked out by a hot guy. By <em>this</em> hot guy. But he didn’t want it right now, like this, so fast and without a single question asked.</p>

<p>Brandon was fumbling with a condom wrapper and Vincent quickly decided to use the moment to slide up a bit towards the head of the bed, taking his legs back and starting to hug them.</p>

<p>“Can we,” He began. “Can we slow down a bit? I don’t think I’m ready for that yet.” Vincent frowned and looked at Brandon, whose expression was unreadable to him.</p>

<p>“What?” Brandon asked, still expressionless. His tone wasn’t aggressive, but it wasn’t all that calm, either. Had Vincent said something wrong?</p>

<p>“I thought this is what you wanted. That’s what Myra said!”</p>

<p>What the fuck? Was Myra, his best friend, just going around telling random guys that Vincent was desperate to be <em>fucked</em> by some stranger stud?</p>

<p>Vincent started breathing heavily. It took a second for him to start speaking, but then he did. “Oh, and you just signed the fuck up right away, didn’t you? Just ready to fuck some random guy and then never talk to him again? Is that what you do every weekend?”</p>

<p>Brandon frowned and closed his eyes. He sighed. He didn’t say anything for a solid thirty seconds, which gave Vincent plenty of time to develop his famous instant regrets. Even if Brandon <em>was</em> that sort of guy, what did it matter to Vince? He <em>was</em> a little desperate to be fucked, and this stranger seemed a hell of a lot better to him than any of the other strangers at this party. And Myra had said that he was <em>sweet</em>, too. Maybe something could have happened here. But he just ruined it, officially and irrevocably. Right?</p>

<p>“Fuck,” Vincent began again. He shook his head slowly and frowned. “I’m sorry, that came out wrong.”</p>

<p>Brandon just stood there. “It did, didn’t it?”</p>

<p>Then he walked away.</p>

<hr />

<p>When Vincent trotted slowly down the stairs, the party was still in full swing, and he absolutely hated it. Not only were there a million humans that all reeked of alcohol and just generally existed, which was usually bad enough, Vincent had also ruined a very good opportunity to have sex with a very hot and, according to Myra, very sweet guy. A guy whom, even after looking around the living room and the kitchen, he wasn’t able to find anywhere.</p>

<p>This was, as Vincent told himself, the perfect time to give up. Find Myra, say goodbye, and head home to his bed and his stupid toys. He didn’t deserve human dick anyway, because all he could do was <em>be</em> a human dick.</p>

<p>If he talked to Myra right now, all she’d tell him would be to stop wallowing in self-pity and do something about the problem or some crap. Maybe she’d instruct him to find Brandon, or find some other guy, or apologize through text because she probably had his number, too. But Vincent wasn’t ready for rationality right now. Being mad at himself felt good, in a fucked up way. And maybe it had its purpose, or at least that’s what he began telling himself as he was walking outside to check the hot tub for any signs of the guy he’d just hurt for no reason.</p>

<p>Brandon was, in fact, in the hot tub. He sat there with his hands by his sides, less happy and less confident than the first time he saw him here.</p>

<p>Vincent slowly walked up to him. He closed his eyes for a second and started feeling sick to his stomach. If he was going to leave, he should leave <em>right now</em>. But that’s what he usually did, and he wasn’t going to mess this up again. He wanted to give this guy a chance. He wanted to give <em>himself</em> a chance, too.</p>

<p>“Hey, uh, Brandon?” He said and Brandon turned around. He narrowed his eyes as he looked into Vincent’s. “Can we talk?”</p>

<hr />

<p>Vincent and Brandon were sitting on a log bench at the far side of the unreasonably large backyard.</p>

<p>“Fuck, I’m so sorry,” Vincent said apologetically, again. “I just… I thought about something stupid and then I snapped. I really didn’t mean what I said.”</p>

<p>Brandon looked at him and frowned, his eyes twitching back and forth between the ground and Vincent’s face.</p>

<p>“No, you were right, man. I should have asked if you wanted to do the stuff we did. I was too fast.” He didn’t sound disingenuous. If anything, he sounded like he was mad at himself.</p>

<p>“I <em>did</em> want to do the stuff you did. I really wanted to. I <em>still</em> want to.” After saying that, Vincent decided it was probably time to shut up. Was he being too vulnerable or honest now? Was Brandon just going to walk back to the hot tub, or go inside and fuck any of the twenty other cute guys that were less of an emotional mess than Vincent was?</p>

<p>Brandon chuckled and smiled.</p>

<p>“Okay,” He said. “Let’s do it, then.”</p>

<p>“Wait, really?” Vincent blurted out and raised his eyebrows to the fucking sky.</p>

<p>“Yea. I still want to, too. Plus, I haven’t really gotten to take a proper look at your ass yet.”</p>

<p>“Hey now, I’m not <em>just</em> an ass, Brandon.” Vincent said and smiled.</p>

<p>“So far, you were,” Brandon whispered into his ear, and Vincent knew that it was true, but he wasn’t sure if this was Brandon dirty talking or just… telling him how much of an ass he was.</p>

<p>It didn’t take long until he found out, because Brandon turned Vincent’s head towards his own.</p>

<p>“Can I make out with you?” He asked quietly and bit his lip.</p>

<p>“Yes,” Vincent replied with a grin, and he kissed Brandon on the lips and didn’t let go.</p>

<p>Eventually, their tongues were intertwined and only momentarily separated as Brandon made sure that he was doing everything exactly as Vincent wanted him to. They went slower this time, but still did all the things that they’d both wanted to do.</p>

<p>When they were done, they were both sweaty and out of breath. They cleaned themselves (and the bench) up with some tissues that Vincent found in his back pocket and kissed a final time before walking back towards the house-slash-mansion together.</p>

<p>Vincent looked at Brandon, who was walking next to him, and quietly said a genuine, vulnerable “Thanks.”</p>

<p>Brandon looked back and chuckled. “It was fun.” He said. Then he came a little closer.</p>

<p>“Hey, Vincent,” He began. “Can I take your hand?”</p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Vincent is an anxious introvert who is desperate to find a guy to have some fun with. At his best friend's party, he gets the chance to do just that, but his anxiety threatens to screw it all up.]]></summary></entry><entry><title type="html">🐶 Dog-Earing and Other Terrible Reading Habits</title><link href="https://ellpeck.de/blog/reading_habits/" rel="alternate" type="text/html" title="🐶 Dog-Earing and Other Terrible Reading Habits" /><published>2021-06-26T00:00:00+00:00</published><updated>2021-06-26T00:00:00+00:00</updated><id>https://ellpeck.de/blog/reading_habits</id><content type="html" xml:base="https://ellpeck.de/blog/reading_habits/"><![CDATA[<p>So recently, I’ve been reading a lot more again. Since I got my first Kindle <a href="https://ellpeck.de/blog/reading">and talked about it</a> a while ago, I have now also started tracking my reading progress on <a href="https://app.thestorygraph.com/profile/ellpeck">the StoryGraph</a>. I also started watching some more book- and reading-related YouTube videos, and I came across this tag that I thought would be <em>perfect</em> for me to talk about for one specific reason, which I’ll get to shortly.</p>

<p>To sum it up: My boyfriend thinks dog-earing books (that you own!) is the worst, and he despises me for doing it. But I want all of you to <em>hear my case</em> about this. So read on. Please.</p>

<h2 id="do-you-have-a-certain-place-at-home-for-reading">Do you have a certain place at home for reading?</h2>
<p>A while ago, I actually got one of those cheap-but-nice IKEA chairs that everyone seems to have and set it up as a little reading nook in a corner.</p>

<p>But then I realized that reading in bed, before going to sleep, actually works a lot better for me because I take sleeping pills, but they take a while to start working. So I got into the habit of taking them, and then reading for an hour or so in bed, and then putting the book away and dozing off right when I feel the medication starting to make me drowsy.</p>

<h2 id="bookmark-or-random-piece-of-paper">Bookmark or random piece of paper?</h2>
<p>Okay, hear me out: <em>Dog-earing</em>. Of course, if you get a library book or read a friend’s book, this is not a nice thing to do, because, after all, it <em>is</em> damaging someone else’s property. In that case, a random piece of paper is a pretty good way to go, in my opinion.</p>

<p><em>But.</em></p>

<p>A book that looks like it’s been read, with the pages a little warped and the spine maybe, possibly a little broken, and the marks of dog ears on some pages looks <em>so much nicer</em> than a book that looks all new and fancy and clean.</p>

<p>Listen, okay? Dog ears tell a <em>story</em>. Not only do they show you where you (or other people) took a reading break, but they also show you which parts of the book might have been difficult or otherwise slow to read, because those parts would have a lot more dog ears than other parts of the book.</p>

<p>Okay, maybe this is just me defending something that is objectively terrible. I like it, though.</p>

<h2 id="can-you-just-stop-reading-or-do-you-have-to-stop-after-a-chapter-a-certain-amount-of-pages">Can you just stop reading or do you have to stop after a chapter/ a certain amount of pages?</h2>
<p>I absolutely can’t stop reading in the middle of a chapter. For me, it’s not necessarily that I want to know how the chapter ends or that I enjoy stopping at the end of a chapter because it’s a cliffhanger, and it’ll make me feel excited to get back into the book later.</p>

<p>My real reason is a lot more boring, because it’s just that… for some reason, it feels <em>wrong</em> stopping before the end of a chapter, similarly to how it feels wrong for some reason to stop watching a show in the middle of an episode.</p>

<p>Chapters were made for a reason, and the author probably thought about the pacing of the book and, as a result, the placement of the chapters. It doesn’t feel like my place to just disrupt that pacing. And that placement.</p>

<h2 id="do-you-eat-or-drink-while-reading">Do you eat or drink while reading?</h2>
<p>I don’t think I’ve ever eaten while reading. It seems… unfitting. Especially because there are so many foods that make your fingers greasy or smudgy or… crumby. I wouldn’t want to get that on my precious book. Or Kindle.</p>

<p>I do sometimes drink while reading, though. Especially when I prepared a little place and time to read, like when it’s a nice day out, and I set aside some time to read and get a sunburn I mean suntan. I’ll usually get a big glass of something nice. Yea.</p>

<h2 id="multitasking-music-or-tv-while-reading">Multitasking: Music or TV while reading?</h2>
<p>I… do people do that? How? I don’t have the mental capacity for that.</p>

<h2 id="one-book-at-a-time-or-several-at-once">One book at a time or several at once?</h2>
<p>I really <em>want</em> to be reading several books at once. I like the idea of reading one fiction book and one non-fiction book and then choosing which one to read based on how science-y I feel on any particular day. But whenever I try to start another book while I’m already reading one, I get one of two feelings: <em>The other book is so much more fun to read</em> or <em>This one is so much better than the other one</em>, both of which just make me end up reading just a single book again.</p>

<h2 id="reading-at-home-or-everywhere">Reading at home or everywhere?</h2>
<p>Since I mostly read on my Kindle, it would make a lot of sense for me to read in other, non-home places too. But I rarely do. Partly because, when focusing on something like a screen or a book for too long while riding a bus or a train makes me feel <em>incredibly</em> dizzy. But also partly because I read a lot of somewhat raunchy romance novels, talking about which, and showing the covers of which, in public sounds like <em>a time</em> for an introverted person like me.</p>

<h2 id="reading-out-loud-or-silently-in-your-head">Reading out loud or silently in your head?</h2>
<p>I didn’t realize there were people that read out loud, to be honest. It sounds kind of fun. I should try that.</p>

<h2 id="do-you-read-ahead-or-even-skip-pages">Do you read ahead or even skip pages?</h2>
<p>I used to read the end of a book right away when I was a little kid, because I was scared that the book would have a sad ending. Actually, I used to also <em>change</em> the endings of sad books by writing a nicer ending into the book to ease my mind. I was wholesome like that. I was also, like, 9. So ease off with the pitchforks.</p>

<p>Nowadays, I don’t even really have the urge to find out what happens later on in the book. After all, the current part is already interesting, and I’ll find out soon enough what happens in the future, I guess.</p>

<h2 id="breaking-the-spine-or-keeping-it-like-new">Breaking the spine or keeping it like new?</h2>
<p>I will <em>absolutely</em> break the spine of any book I read (if I own it), because otherwise books are just too V-shaped to hold comfortably. It’s not my fault that books are as flexible as a rock, okay? Do some yoga or something.</p>

<h2 id="do-you-write-in-your-books">Do you write in your books?</h2>
<p>Depends on the book. If it’s a science-y book that I want to go back to, I’ll definitely write notes and highlight sections in it. Since I mostly read on the Kindle, I’ll actually highlight sections that I find funny or interesting to be able to get back to them later. Or to be able to share them with my boyfriend, who isn’t <em>the least bit interested</em>.</p>

<h2 id="conclusion">Conclusion</h2>
<p>I think my reading habits can be summed up pretty accurately as “book murderer”. Which I’m honestly fine with.</p>

<p>I don’t do it to books that aren’t mine, though. I’m not, like, a library… hater. Or anything. Libraries are cool.</p>

<p>Since I’ve been reading a lot more again in recent history, I also want to start writing more blog posts about my reading habits and the books I enjoy. If you’re interested in that sort of thing, you can head back to <a href="https://ellpeck.de/#blog-reading">the post list</a> to see other posts in the Reading category, and you can also subscribe to the blog’s RSS feed there too. If anyone still does that. I think RSS is dead. Right?</p>]]></content><author><name>Ellpeck</name></author><category term="Reading" /><summary type="html"><![CDATA[Since I've been reading a lot more in recent history, I thought I'd start writing some blog posts about the reading. So first up, here are some of my terrible reading habits that would probably make a lot of book lovers angry. This isn't clickbait. I'm just terrible.]]></summary></entry><entry><title type="html">🍝 Ketchup, Mayo and Barbecue Sauce</title><link href="https://ellpeck.de/blog/ketchup_mayo_barbecue_sauce/" rel="alternate" type="text/html" title="🍝 Ketchup, Mayo and Barbecue Sauce" /><published>2021-05-28T00:00:00+00:00</published><updated>2021-05-28T00:00:00+00:00</updated><id>https://ellpeck.de/blog/ketchup_mayo_barbecue_sauce</id><content type="html" xml:base="https://ellpeck.de/blog/ketchup_mayo_barbecue_sauce/"><![CDATA[<p>Sally strolled along the shopping street with her favorite, rainbow-colored bag swung over her left shoulder. Looking around the shops, she wondered if she’d gotten everything from her list. Unsure, but willing to be <em>absolutely certain</em>, she pulled her phone out of her shiny bag and opened her notes. There was one item left on it, unticked: <em>short skirt, blue, summer</em>. She held the bag open with one hand and started rummaging through it with the other. Sally had already bought a skirt, but it wasn’t blue, and it wasn’t fit for summer either. It was longer, and the colors made her think of the fall. Of dancing around in the rain, of jumping straight into a pile of leaves. Of <em>Joey</em>.</p>

<p>Oh, God.</p>

<p>She took the skirt out of its protective casing and checked the price tag, which was still firmly attached to the waistband. Forty-seven dollars, it said. That was a lot of money to pay for a skirt, wasn’t it? She jerked around on the busy street in an instant, almost bumping into a stranger, while trying to locate the store where she’d gotten this stupid thing.</p>

<p>Ah, there it was. Without thinking much, she stuffed the skirt back into her bag and headed straight for the entrance of the small boutique.</p>

<p>As she started scanning the other skirts on the racks close to the entrance, she concluded that this store was clearly ill-fitting for her goal of completing the last item on her to-do list. There were no skirts in fun, summery colors. Slightly outraged, and about ready to head to the counter to return the expensive fall skirt, she noticed a familiar face in line for the register.</p>

<p>Was it really–? No, it couldn’t have been. As the long-haired guy turned around, she quickly ducked behind one of the racks as to not make it seem like she’d just been staring at him. Naturally. What could be a better way to make it seem like you’re <em>totally</em> minding your own business than hiding under some random clothes rack like a nine-year-old?</p>

<p>Oh, well. It was too late now to seem normal.</p>

<p>As she raised her head carefully above the rack, just enough to be able to spy– look at David, she realized how much he’d changed since the last time she saw him. He was wearing a flashy jacket, not the weird high school varsity kind, but a punky sort of dark, possibly faux-leather looking thing. His shoulders were–wow, his shoulders were broad, and they looked strong as hell. How much had he been lifting? Did he carry boulders for fun? For only a quick second, definitely absolutely not for longer, she imagined him scooping her up and carrying her like a princess. She imagined herself, staring up into his dark brown eyes, wondering what it would be like to look into them before she fell asleep.</p>

<p>Joey would’ve never done anything like that with her. It wasn’t that he hadn’t been strong enough to carry her or anything, it’s that he just wasn’t the <em>romantic</em> type. The type of person to kiss her out of nowhere, the type to turn around while walking next to her and pull her into a tight, warm embrace. But David, <em>oh, David</em>, maybe he could be that, for her.</p>

<p>After a few more minutes of dreaming, and possibly a tiny bit of <em>drooling</em>, she caught herself doing exactly the thing that she promised herself she’d never do again: <em>Pining</em> for someone, someone who probably didn’t even remember she existed. Someone she hadn’t even <em>talked to</em> yet. Jesus Christ.</p>

<p>She needed to get her act together, she thought to herself. And what better way to do that than to return that ugly fall skirt she’d bought and get a perfect, blue summer one just like her to-do list demanded of her. She sat up, turned away from David, who looked like he was almost finished checking out by now, and pulled the stupid skirt back out of her bag. But looking at it, she realized again how beautiful the pattern on it was. How the thin lines connected to form what looked like a network of pathways, or maybe a tree with thousands of small branches.</p>

<p>She stuffed the skirt right back into her bag and deliberated. She could always just get the blue summer skirt <em>on top</em> of the fall one, and keep both. But surely, she’d never <em>wear</em> both of them, because she already had so many other skirts, and dresses, and jeans. Why did she have <em>so many clothes</em>? She didn’t even need to buy any more today. This whole thing was so unnecessary, she realized.</p>

<p>Determined to keep the skirt (because of the beautiful lines, et cetera), but not buy another skirt (because of the full closet), she headed straight for the exit with big, confident strides. So confident, in fact, that she ran right into the backside of none other than David, who had stopped in the doorway of the store, probably to check his phone or something.</p>

<p>Oh, fucking hell.</p>

<p>David leapt forward immediately and scrambled to keep his phone in his hand. He turned around and shot Sally a weird look.</p>

<p>“I’m so sorry,” she mumbled, sounding overly apologetic. “I didn’t look where I was going.”</p>

<p>“It’s no problem,” he said and the corner of his mouth tilted upwards a little. “Wait, don’t I know you from somewhere?”</p>

<p>Sally paused. A person who <em>hadn’t</em> just stalked her old high school classmate from behind a fucking skirt rack would probably be confused for a second before, like her, immediately saying “Yea, hi, I’m Sally, back from school.”</p>

<p>He arched an eyebrow. “Sally…,” he began. “Sally, like, debate team Sally?”</p>

<p>“Is that what you thought of me as?”, she said almost instinctively. “I didn’t even do it for that long.”</p>

<p>“Well,” David began awkwardly and stuffed his phone into his pocket. “The other Sally made it hard to think of you as just ‘Sally’”, he explained.</p>

<p>Ah, that made a lot of sense, actually. Sally (the other one) was one of the popular girls, and <em>this</em> Sally was never that popular at school, or anywhere, really. She hung around the debate team for a while, but quit fairly quickly and moved on to a different club. And right now, still standing in the doorway of the store, awkwardly looking at David, she pulled a face and tried to remember what she <em>did</em> after she quit the debate team.</p>

<p>“Anyway,” David said with a blank expression. “I was about to grab lunch…”</p>

<p>He paused, and Sally just kind of stared. She was still thinking about that damn club.</p>

<p>“You want to come?” David finally said.</p>

<p>“Uh, what?” Sally began awkwardly. It took a second for her brain to process what David had just said. “Oh, yea, sure, that sounds great!”, and it really <em>did</em> sound great to her, too.</p>

<hr />

<p>Sally couldn’t quite believe it, but David had actually given her his <em>phone number</em> after their lunch date thing. They’d walked to a nearby fast food place and both ordered a burger and fries, and, while waiting for the food to arrive, they’d talked about what both of them had started doing after finishing school.</p>

<p>Sally was sitting in her bed now and looking down at her phone, the bright screen displaying David’s contact information. He’d entered his first name only, along with his phone number. For a moment, Sally wondered if he might have given her some sort of fake number, but that wouldn’t make much sense, because <em>he</em> was the one who’d invited her to lunch, after all.</p>

<p>She hovered over the green call button with her thumb, considering her options. Maybe she should just text him? What would she say, though? A call just seemed easier. Plus, it was cheaper, right? With her contract and all. Finally, she tapped the button with a shaky finger.</p>

<p>“Hello?” a familiar voice said on the other end of the line.</p>

<p>“Hey, it’s me, Sally, from lunch,” she said awkwardly. “Do you want to go out again, maybe?”</p>

<p>Wow, that was <em>bold</em> of her, wasn’t it? What had gotten into her all of a sudden? She never used to be like this with Joey, or anyone else, for that matter. She shook her head and followed up with a <em>super</em> smooth “Only if you want, though. Of course.” Fucking hell.</p>

<p>“I’d love to! I’m so glad you asked,” he said. “I was worried you weren’t going to call.”</p>

<p>He was… <em>worried</em>? That was a surprise to Sally. And a nice thing to say, too, in a weird sort of way.</p>

<p>They decided to meet up for lunch again the next day, and David picked out another fast food place in town that sold Asian takeout. Sally wasn’t sure if she was going to like it, but she knew she liked <em>David</em>, and that was the main thing that mattered to her.</p>

<p>Later that night, she lay awake, staring at the ceiling, thinking about David. About how nice he’d been on the phone. About lunch. <em>Had</em> he been really nice, or had she just forgotten what talking to a nice person was like? The thought was a little depressing to her, so she dismissed it as quickly as it came. No, he <em>had</em> been very nice to her, she concluded. He was a great lunch buddy.</p>

<hr />

<p>David checked himself in the mirror and pulled a face. He wet his hand in the sink and tried to smooth over a rogue curl in his otherwise silky smooth, brown hair. As he let go, the stupid thing bounced back up, and he quickly admitted defeat. <em>Fine</em>, he thought to himself with a kind of confidence that he didn’t normally seem to possess. <em>This day will go great either way.</em></p>

<p>Sally had suggested a place that he’d never been to this time around, a place that–from the images online–looked to be a small restaurant with a large outdoor seating area. For a moment, he thought to himself if maybe she picked this place because it looked romantic.</p>

<p>He shrugged off the thought as a notification made his phone vibrate in his pocket. For a second, he wondered if this was Sally canceling their date– lunch meeting– <em>friendly hangout session</em>.</p>

<p>It was, indeed, Sally. Evidently, she hadn’t messaged him to cancel, though.</p>

<p>The little banner notification at the top of his screen captured the start of her message: <em>been deliberating. do you mind if we go to the thai place i talked abo…</em> David chuckled to himself as he tapped the notification. She’d already presented him with about seventeen choices last night, asking him which one <em>he</em> would choose. What was up with that girl?</p>

<p><em>Whatever you want</em>, he texted back. Damn it, did that sound too disinterested? <em>You’re choosing today</em>, he added. He liked the idea of doing what Sally wanted. Of seeing her happy. Of <em>making</em> her happy. Why was he so into her all of a sudden?</p>

<p><em>damn it</em>, she texted back. <em>reading online now that the thai place is closed, nvm</em>.</p>

<p>Fair enough.</p>

<hr />

<p>David looked around the big seating area to spot Sally, sitting at a far table for two, awkwardly waving at him. He waved back briefly and made his way over to her. Sitting down at the table, he asked sarcastically, “Is this the place you want to eat, or should we check out some others instead?”</p>

<p>She pulled a tiny frown and rolled her eyes. “Shut up.”</p>

<p>They continued bantering as they ordered food and until after their drinks arrived. This seemed to be their rapport now: Making fun of each other over drinks and varying cuisine. It was good. No, actually. It was <em>great</em>.</p>

<p>While eating his burger (and fries with mayonnaise, of course), he looked up to meet Sally’s eyes for a quick moment, who smiled back before returning her focus to her own burger, also with fries and mayo. And ketchup. <em>And</em> barbecue sauce.
Jesus Christ.</p>

<p>He continued looking at Sally for another few seconds, studying her features, taking in her eyes, which were nestled neatly between the rims of her glasses and below her long, blonde bangs. It was warm today, and Sally was wearing a flowy, bright top and a short, blue skirt that looked like she’d just bought it the same day.</p>

<p>Sally looked back up at him. “You know,” she began. “I’ve really been enjoying our dates.”</p>

<p><em>Our dates</em>. Did she mean their lunch meetups? Or did she really mean <em>dates</em>? He gave her the benefit of the doubt, because for him, too, it was difficult to come up with names for this… arrangement.</p>

<p>“Me too,” he shot back before stuffing a couple of fries into his mouth. After he swallowed, he raised an eyebrow and asked: “Dates?”</p>

<p>She looked back up at him and smiled. “I mean, if you like. We’re eating, we’re talking, we’re… having fun.” She paused. “Isn’t that what a date is?”</p>

<p>David let what that sink in for a moment. He looked at her and smiled. Of course, he admitted to himself, he’d been <em>hoping</em> that these were proper dates. And sitting across from Sally, right here, right now, <em>knowing</em> that she also thought of them as <em>dates</em>… it made him feel a sort of happiness that he hadn’t felt in a long time. He quietly smiled to himself and looked down at his plate again, stuffing another handful of fries into his mouth.</p>

<hr />

<p>As she arrived home and unlocked the front door, Sally realized that she’d been thinking about David, and David alone, for the last few days. Whenever she watched TV and saw a cute scene, she thought of David. When chatting with her friends about their relationships, she thought of David. And, yes, she admitted to herself, she’d also thought of David while touching herself. Once or twice.</p>

<p>But that wasn’t bad, she concluded. In fact, she accepted all of it as what it was: A sign that she really liked David. She smiled to herself as she went up to her room, throwing her jacket onto a chair in the corner.</p>

<p>She let herself drop backwards onto the bed like a brick and pulled out her phone, holding it over her head. She opened her message thread with David and typed the words <em>Today was fun.</em> Then, she followed up with another message: <em>I really like you, David.</em></p>

<p>This was, for the first time since Sally could remember, something she was absolutely certain about. She didn’t have to think twice before sending those messages. She didn’t even <em>want</em> to think twice about them, because it was so unusually clear to her. She liked David, and there would be nothing she could tell herself, no question she could ask herself, to change that.</p>

<p>Before he even read the message, Sally moved into her contact list with a few quick swipes, scrolling down to the entries that started with the letter J. <em>J</em>, as in <em>Joey</em>, of course. She tapped his name and immediately felt a weird sense of unease, a dread that she’d always felt when she had to think about him. She scrolled down past the phone numbers and his address until, right there, in the center of her screen, was a big red button with a trash can icon and the word <em>Delete</em> next to it.</p>

<p>She thought of the lunches with David again, the way he stuffed fries into his mouth. The way he snickered when she asked the waiter for three different condiments. The way his smooth hair dissolved into more and more curls the longer he was outside in the dry summer heat. The way things seemed so <em>easy</em> with him. All of a sudden, the dread that Joey’s name brought up in her vanished, just like that.</p>

<p>And then she pressed the button.</p>

<p>As she watched Joey’s name slide off-screen in the contact list, all the other J names shuffling up and down neatly to fill the gap, a banner notification came down from the top of her screen. It was David.</p>

<p><em>I like you too, Sally. Really like you.</em></p>

<p>Another notification came down. <em>Lunch again tomorrow?</em></p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Sally can't quite decide what skirt to buy. When she starts going out for lunch with David, an old crush from high school, she can't quite decide what to order. But she's sure about one thing: She likes David. A lot.]]></summary></entry><entry><title type="html">🤡 One Year of Tiny Life, and Cursed Comment Time</title><link href="https://ellpeck.de/blog/tiny_life_one_year/" rel="alternate" type="text/html" title="🤡 One Year of Tiny Life, and Cursed Comment Time" /><published>2021-05-24T00:00:00+00:00</published><updated>2021-05-24T00:00:00+00:00</updated><id>https://ellpeck.de/blog/tiny_life_one_year</id><content type="html" xml:base="https://ellpeck.de/blog/tiny_life_one_year/"><![CDATA[<p>On this day, exactly one year ago, I made my first commit to the Tiny Life repository. Since that first commit, which included some code for the isometric perspective that the game uses, Tiny Life has come <em>a long way</em>.</p>

<p><img src="commit.png" alt="" /></p>

<p>If you don’t recall just how long of a way it has come, or you don’t even know about the game yet: Tiny Life is, as I wrote on its <a href="https://ellpeck.itch.io/tiny-life">itch page</a>:</p>

<blockquote>
  <p>Tiny Life is a fun simulation game that tries to capture the essence of games like The Sims, but in an isometric pixelart style.</p>

  <p>In the game, you control a set of people that live together in a household. You take care of their daily needs, build their skills, forge new relationships… or just mess up their entire life in whatever way you can think of!</p>
</blockquote>

<p>So, to celebrate, and because of a Twitter poll I did a while ago that made it clear that yall are interested in something like this, let’s go through Tiny Life’s current code and fish out some funny, cursed and weird code comments that just naturally come about when making a game that tries to simulate the personalities and behaviors of human people.</p>

<p>While this blog post <em>does</em> include a lot of programming-related humor, most of the comments are still funny and a bit ridiculous out of context, so you don’t have to be a programmer to laugh along by any means.</p>

<p><img src="search.png" alt="" /></p>

<p>That should do for now. <em>Oh, boy.</em> Note that I’ll just be going through them using the order they appear in these search results, so the funniest ones won’t be at the start or the end, but just… somewhere in between.</p>

<p>First up, this is one that most of you will probably find pretty relatable.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// we want people to clean dishes when they're hungry to make space for food</span>
<span class="n">Ai</span> <span class="p">=</span> <span class="p">{</span>
    <span class="n">SolvedNeeds</span> <span class="p">=</span> <span class="k">new</span><span class="p">[]</span> <span class="p">{</span><span class="n">NeedType</span><span class="p">.</span><span class="n">Hunger</span><span class="p">},</span>
<span class="p">}</span>
</code></pre></div></div>

<p>This one is for the introverts (to whom I most certainly belong) out there.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// we only want to visit someone when we're currently at home for long enough</span>
<span class="k">if</span> <span class="p">(</span><span class="n">a</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">i</span><span class="p">.</span><span class="n">Person</span><span class="p">.</span><span class="n">LotVisitCooldown</span> <span class="p">&lt;=</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</span> <span class="p">&amp;&amp;</span> <span class="n">i</span><span class="p">.</span><span class="n">Person</span><span class="p">.</span><span class="n">LastVisitedLot</span> <span class="p">==</span> <span class="n">i</span><span class="p">.</span><span class="n">Person</span><span class="p">.</span><span class="n">HomeLot</span> <span class="p">?</span> <span class="n">Valid</span> <span class="p">:</span> <span class="n">Hidden</span><span class="p">;</span>

</code></pre></div></div>

<p>Teenagers should probably remember this one. Consent is (very unironically) important, yall!</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// automatic romance interactions should only happen if we're already romantic towards each other</span>
<span class="k">return</span> <span class="n">relationship</span><span class="p">?.</span><span class="n">RomanceLevel</span> <span class="p">&gt;</span> <span class="m">0</span> <span class="p">?</span> <span class="n">Valid</span> <span class="p">:</span> <span class="n">Hidden</span><span class="p">;</span>
</code></pre></div></div>

<p>Fair enough.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// eat food if we're hungry</span>
<span class="k">if</span> <span class="p">(</span><span class="n">person</span><span class="p">.</span><span class="nf">GetNeedPercentage</span><span class="p">(</span><span class="n">NeedType</span><span class="p">.</span><span class="n">Hunger</span><span class="p">)</span> <span class="p">&lt;=</span> <span class="m">0.5F</span> <span class="p">&amp;&amp;</span> <span class="n">obj</span><span class="p">.</span><span class="n">ServingSize</span> <span class="p">&lt;=</span> <span class="m">1</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">ActionType</span><span class="p">.</span><span class="n">Eat</span><span class="p">.</span><span class="nf">Construct</span><span class="p">(</span><span class="n">person</span><span class="p">.</span><span class="nf">GetHeldActionInfo</span><span class="p">());</span>
</code></pre></div></div>

<p>Especially in the city! Don’t linger around too long, kids.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// move to the sidewalk once we're done driving</span>
<span class="kt">var</span> <span class="n">road</span> <span class="p">=</span> <span class="k">this</span><span class="p">.</span><span class="n">Map</span><span class="p">.</span><span class="nf">GetClosestRoad</span><span class="p">(</span><span class="n">car</span><span class="p">.</span><span class="n">Position</span><span class="p">.</span><span class="nf">ToPoint</span><span class="p">(),</span> <span class="n">Map</span><span class="p">.</span><span class="n">RoadRadius</span> <span class="p">+</span> <span class="m">1</span><span class="p">);</span>
</code></pre></div></div>

<p>You: Oh no, my car broke down!<br />
Me:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// if the driving fails, we always want to walk to the goal in the end</span>
<span class="k">return</span> <span class="k">base</span><span class="p">.</span><span class="nf">ShouldFail</span><span class="p">(</span><span class="n">completedAction</span><span class="p">,</span> <span class="n">completion</span><span class="p">)</span> <span class="p">&amp;&amp;</span> <span class="n">completedAction</span> <span class="k">is</span> <span class="k">not</span> <span class="n">DriveAction</span><span class="p">;</span>
</code></pre></div></div>

<p>Do yall also do this thing where you’re like “I cleaned <em>a single dish</em>, now I can take a break”?</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// should we start to take a break between actions?</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nf">OnBetweenActions</span><span class="p">(</span><span class="n">time</span><span class="p">,</span> <span class="n">passedInGame</span><span class="p">,</span> <span class="n">speed</span><span class="p">,</span> <span class="n">current</span><span class="p">,</span> <span class="n">completion</span><span class="p">))</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="n">isBetweenActions</span> <span class="p">=</span> <span class="k">true</span><span class="p">;</span>
    <span class="k">return</span> <span class="k">true</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></div>

<p>It might be sad to hear, but this is something <em>you</em> have to do as well.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// we want to prioritize going to work over sleeping automatically</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="n">StartedAutomatically</span> <span class="p">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="n">Person</span><span class="p">.</span><span class="n">Job</span> <span class="p">!=</span> <span class="k">null</span> <span class="p">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="n">Person</span><span class="p">.</span><span class="n">Job</span><span class="p">.</span><span class="n">Type</span><span class="p">.</span><span class="nf">IsTimeToWork</span><span class="p">(</span><span class="n">GameImpl</span><span class="p">.</span><span class="n">Instance</span><span class="p">.</span><span class="n">CurrentTime</span> <span class="p">+</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="nf">FromHours</span><span class="p">(</span><span class="m">1</span><span class="p">)))</span>
    <span class="k">return</span> <span class="n">CompletionType</span><span class="p">.</span><span class="n">Canceled</span><span class="p">;</span>
</code></pre></div></div>

<p>A bit creepy, don’t you think?</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// follow our partner until we reach them</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="n">IsMain</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="n">followTimer</span> <span class="p">-=</span> <span class="n">time</span><span class="p">.</span><span class="n">ElapsedGameTime</span><span class="p">;</span>
</code></pre></div></div>

<p>Jesus Christ, mom, how many more times do you want to tell me that <em>same story</em>?</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// we add the recent social to the relationship of the recipient</span>
<span class="c1">// so it represents an "I've heard this story already" list</span>
<span class="n">relationship</span><span class="p">.</span><span class="nf">AddRecentSocial</span><span class="p">(</span><span class="n">action</span><span class="p">.</span><span class="n">Type</span><span class="p">);</span>
</code></pre></div></div>

<p>Also… fair enough.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// make lots more interesting if we have friends on them</span>
<span class="n">lot</span> <span class="p">=</span> <span class="n">Random</span><span class="p">.</span><span class="nf">GetRandomWeightedEntry</span><span class="p">(</span><span class="n">lots</span><span class="p">,</span> <span class="n">l</span> <span class="p">=&gt;</span> <span class="n">l</span><span class="p">.</span><span class="n">Type</span><span class="p">.</span><span class="nf">GetVisitPriority</span><span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="n">Person</span><span class="p">));</span>
</code></pre></div></div>

<p>It really <em>is</em> based on our mood how efficiently we work.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// if we're currently working, we should increase job performance based on our mood</span>
<span class="kt">var</span> <span class="n">performance</span> <span class="p">=</span> <span class="k">this</span><span class="p">.</span><span class="n">Person</span><span class="p">.</span><span class="n">Needs</span><span class="p">.</span><span class="n">Values</span><span class="p">.</span><span class="nf">Count</span><span class="p">(</span><span class="n">n</span> <span class="p">=&gt;</span> <span class="n">n</span><span class="p">.</span><span class="n">Percentage</span> <span class="p">&gt;=</span> <span class="m">0.75F</span><span class="p">)</span> <span class="p">*</span> <span class="m">0.004F</span><span class="p">;</span>
</code></pre></div></div>

<p>Does this also apply to <em>sleepovers</em>?</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// the bed that we last slept in should be the one we try to sleep in again</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nf">HasCategory</span><span class="p">(</span><span class="n">person</span><span class="p">,</span> <span class="n">ObjectCategory</span><span class="p">.</span><span class="n">Bed</span><span class="p">)</span> <span class="p">&amp;&amp;</span> <span class="n">categories</span><span class="p">.</span><span class="nf">HasFlag</span><span class="p">(</span><span class="n">ObjectCategory</span><span class="p">.</span><span class="n">Bed</span><span class="p">)</span> <span class="p">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="n">Id</span> <span class="p">==</span> <span class="n">person</span><span class="p">.</span><span class="n">LastBedSleptIn</span><span class="p">)</span>
    <span class="k">return</span> <span class="m">10</span><span class="p">;</span>
</code></pre></div></div>

<p>Fair… enough.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// pee puddles should be more disgusting</span>
<span class="n">DecorativeRating</span> <span class="p">=</span> <span class="n">f</span> <span class="p">=&gt;</span> <span class="n">f</span><span class="p">.</span><span class="n">Colors</span><span class="p">[</span><span class="m">0</span><span class="p">]</span> <span class="p">==</span> <span class="m">1</span> <span class="p">?</span> <span class="p">-</span><span class="m">30</span> <span class="p">:</span> <span class="p">-</span><span class="m">10</span>
</code></pre></div></div>

<p>For this one, I especially like that I chose to name the variable <code class="language-plaintext highlighter-rouge">naked</code>.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// if someone isn't wearing pants and they aren't romantic with us, we should get (them) embarrassed</span>
<span class="kt">var</span> <span class="n">naked</span> <span class="p">=</span> <span class="n">room</span><span class="p">.</span><span class="n">GetObjects</span><span class="p">&lt;</span><span class="n">Person</span><span class="p">&gt;()</span>
    <span class="p">.</span><span class="nf">Where</span><span class="p">(</span><span class="n">p</span> <span class="p">=&gt;</span> <span class="n">p</span> <span class="p">!=</span> <span class="k">this</span> <span class="p">&amp;&amp;</span> <span class="n">p</span><span class="p">.</span><span class="nf">GetRelationship</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="k">false</span><span class="p">)?.</span><span class="n">RomancePercentage</span> <span class="p">&lt;</span> <span class="m">0.25F</span> <span class="p">&amp;&amp;</span> <span class="p">!</span><span class="n">p</span><span class="p">.</span><span class="n">WornLayers</span><span class="p">.</span><span class="nf">HasFlag</span><span class="p">(</span><span class="n">ClothesLayer</span><span class="p">.</span><span class="n">Pants</span><span class="p">))</span>
    <span class="p">.</span><span class="nf">ToArray</span><span class="p">();</span>
</code></pre></div></div>

<p>This comment is, of course, in the <code class="language-plaintext highlighter-rouge">Person.Die</code> method.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// make friends sad</span>
<span class="k">foreach</span> <span class="p">(</span><span class="kt">var</span> <span class="n">rel</span> <span class="k">in</span> <span class="k">this</span><span class="p">.</span><span class="n">Relationships</span><span class="p">)</span> <span class="p">{</span>
</code></pre></div></div>

<p>You: I’m bored!<br />
Me:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// if we don't have anything else to do, also try random actions</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="n">person</span><span class="p">.</span><span class="n">ActionQueue</span><span class="p">.</span><span class="n">Count</span> <span class="p">&lt;=</span> <span class="m">0</span> <span class="p">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="n">person</span><span class="p">.</span><span class="n">CurrentActions</span><span class="p">.</span><span class="n">Count</span> <span class="p">&lt;=</span> <span class="m">0</span><span class="p">)</span>
    <span class="n">avail</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="n">RandomActions</span><span class="p">);</span>
</code></pre></div></div>

<p>Drunk people, anyone?</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// don't do stuff that's inappropriate here</span>
<span class="k">if</span> <span class="p">(</span><span class="n">type</span><span class="p">.</span><span class="n">Settings</span><span class="p">.</span><span class="n">IsInappropriateElsewhere</span><span class="p">)</span> <span class="p">{</span>
</code></pre></div></div>

<p>Am I wrong? I say no.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// the front door is the closest door to the mailbox that connects outside and inside</span>
<span class="kt">var</span> <span class="n">mailbox</span> <span class="p">=</span> <span class="k">this</span><span class="p">.</span><span class="n">GetObjects</span><span class="p">&lt;</span><span class="n">Furniture</span><span class="p">&gt;().</span><span class="nf">FirstOrDefault</span><span class="p">(</span><span class="n">f</span> <span class="p">=&gt;</span> <span class="n">f</span><span class="p">.</span><span class="n">Type</span> <span class="p">==</span> <span class="n">FurnitureType</span><span class="p">.</span><span class="n">Mailbox</span><span class="p">);</span>
</code></pre></div></div>

<p>Oh no, I <em>really</em> hope it isn’t.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// is it just turning monday now?</span>
<span class="kt">var</span> <span class="n">game</span> <span class="p">=</span> <span class="n">GameImpl</span><span class="p">.</span><span class="n">Instance</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">game</span><span class="p">.</span><span class="n">Weekday</span> <span class="p">==</span> <span class="n">DayOfWeek</span><span class="p">.</span><span class="n">Sunday</span> <span class="p">&amp;&amp;</span> <span class="p">(</span><span class="n">game</span><span class="p">.</span><span class="n">CurrentTime</span> <span class="p">+</span> <span class="n">passedInGame</span><span class="p">).</span><span class="n">Days</span> <span class="p">!=</span> <span class="n">game</span><span class="p">.</span><span class="n">CurrentTime</span><span class="p">.</span><span class="n">Days</span><span class="p">)</span> <span class="p">{</span>
</code></pre></div></div>

<p>Clearly.</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// if we're not loading from disk, we want to replace the floor with concrete</span>
<span class="k">if</span> <span class="p">(</span><span class="n">initializeRooms</span><span class="p">)</span> <span class="p">{</span>
</code></pre></div></div>

<p><em>Am I wrong?</em></p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// drywall should be considered ugly</span>
<span class="k">if</span> <span class="p">(</span><span class="n">wall</span><span class="p">.</span><span class="n">Wallpapers</span><span class="p">[</span><span class="n">side</span><span class="p">].</span><span class="n">BaseName</span> <span class="p">==</span> <span class="s">"Default"</span><span class="p">)</span>
    <span class="n">rating</span><span class="p">--;</span>
</code></pre></div></div>

<p>I said it once (multiple times, actually), and I’ll say it again: <em>Am I wrong?</em></p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// energetic people should be able to stay awake longer than others</span>
<span class="k">public</span> <span class="k">static</span> <span class="k">readonly</span> <span class="n">NeedType</span> <span class="n">Energy</span> <span class="p">=</span> <span class="nf">Register</span><span class="p">(</span><span class="k">new</span> <span class="nf">NeedType</span><span class="p">(</span><span class="s">"Energy"</span><span class="p">,</span> <span class="m">0.5F</span><span class="p">,</span> <span class="n">p</span> <span class="p">=&gt;</span> <span class="n">ActionType</span><span class="p">.</span><span class="n">PassOut</span><span class="p">,</span> <span class="n">p</span> <span class="p">=&gt;</span> <span class="n">p</span><span class="p">.</span><span class="nf">HasPersonality</span><span class="p">(</span><span class="n">PersonalityType</span><span class="p">.</span><span class="n">Energetic</span><span class="p">)</span> <span class="p">?</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="nf">FromHours</span><span class="p">(</span><span class="m">1</span><span class="p">)</span> <span class="p">:</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</span><span class="p">,</span> <span class="m">10</span><span class="p">));</span>
</code></pre></div></div>

<p>There we go, that’s most of the funny human-related comments I could find with the very simple search I did. I definitely think some of these are <em>very funny</em> out of context, but what makes it even better is that some of them are also pretty funny <em>in</em> context. Humans really do act very weirdly sometimes, don’t they?</p>

<p>All of that being said, thanks so much for reading this blog post. If you haven’t already, you should definitely check out the game, as it is very much a passion project of mine, and I think it currently has enough content to be quite a bit of fun to play already.</p>

<p>You can download the game for free (or for a price of your choosing) on its <a href="https://ellpeck.itch.io/tiny-life">itch page</a>.</p>

<p>❤, everyone.</p>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><category term="Featured" /><summary type="html"><![CDATA[It's been exactly one year since I started working on my isometric Sims-style life simulation game Tiny Life, and since then, a lot has happened, especially in the realm of weird, funny and cursed comments in the code.]]></summary></entry><entry><title type="html">👫 Emily’s Fake Boyfriend</title><link href="https://ellpeck.de/blog/emilys_fake_boyfriend/" rel="alternate" type="text/html" title="👫 Emily’s Fake Boyfriend" /><published>2021-04-23T00:00:00+00:00</published><updated>2021-04-23T00:00:00+00:00</updated><id>https://ellpeck.de/blog/emilys_fake_boyfriend</id><content type="html" xml:base="https://ellpeck.de/blog/emilys_fake_boyfriend/"><![CDATA[<h2 id="chapter-1">Chapter 1</h2>
<p>For Emily, Saturdays always seemed to be the days when most things went wrong. She didn’t exactly know why, but she was almost certain that there was some pattern, some sort of spiteful spirit that hated Saturdays, hated her, or both. This Saturday would be one of the most bizarre ones so far, but she didn’t know that yet.</p>

<p>The alarm rang, its screeching noises filling Emily’s bedroom. With a huge sigh, she pulled the cover off of her body and jumped out of bed. As she picked up her phone from the nightstand, she sighed again. <em>Oh God</em>, she thought. <em>What now?</em> She tapped various locations of the device’s large screen until she ended up in a text message chain with her mom, her brother and her younger sister. Her eyes kept trying to entice her to fall back asleep while she was scanning the lines of the last ten or so messages as carefully as she could.</p>

<p><em>Damn it</em>, she thought as she got to the last message. <em>That’s today</em>? She quickly gathered her things, put on her favorite, pastel pink cardigan, messily fluffed up her hair as she ran past her large mirror and made her way downstairs.</p>

<p>“Good morning!” Her mom said with a slight smile. She was standing in the kitchen, as she usually did, preparing homemade waffles. Emily’s mother was a very good cook and baker, but waffles weren’t her strong suit, for some reason. Every time she tried (and she tried too much), they’d end up burnt or somehow taste of licorice. The thought made Emily grimace as she walked past the kitchen.</p>

<p>“Morning, mom!” she hastily said and made her way to the front door.</p>

<p>“Not so fast,” her mom shouted back from the kitchen. “Don’t forget your waffles!”</p>

<p><em>Oh, God.</em> “Of course,” Emily replied with a sigh.</p>

<hr />

<p>Ben was sitting on the side of his bed with his laptop firmly planted on his crossed legs. With the speed of a twenty-fingered person, he was typing away on an essay for school. He heard a knock on his room door and, while <em>very</em> annoyed by this, he still managed to calmly shout “Come in!”</p>

<p>“Emily’s here,” his mom said while peeking her head through the slightly opened door. “She says it’s important.”</p>

<p>Almost immediately, far too many thoughts started sprinting through his head: It’s <em>important</em>? What could that possibly mean? Was Em, his best friend since kindergarten, <em>dying</em>? No, that’s unlikely. But what if she <em>was</em>? Why wouldn’t she just <em>call</em>? Oh God, no, a call would be <em>even worse</em>. Still begging his brain to shut up, he trotted down the stairs and arrived in the house’s main hallway. A myriad of family photos plastered the walls, most of them from when Ben was still a child. His mom <em>loved</em> showing off pictures of his “little baby boy,” evidently in the most embarrassing ways possible.</p>

<p>“Ben!” Emily said hastily as he opened the door. “I need you to be my boyfriend!”</p>

<p><em>His what</em>? His mind began racing again. Not only was that a very weird way to phrase that sort of thing, but it was also an extremely unexpected request in general. Emily, while insanely beautiful and extremely charming, wasn’t really known to start relationships with anyone. Ben occasionally talked to her about it. It didn’t seem to be her favorite topic, so usually, he’d lay off after only two or three questions. They weren’t necessarily the easiest of questions for him to ask her, either, because he was <em>obsessed</em> with her, almost uncomfortably so. Not in a stalker-y, watch-her-every-night, masturbate-to-her-daily sort of way, but in an I-love-you-and-I-want-to-marry-you kind of way. Of course, Ben (being who he is) was far too self-conscious to <em>ever</em> bring it up.</p>

<p>“You need to <em>what</em>?”, he responded quickly.</p>

<p>“Well,” she said and took a deep breath. “My aunt is coming to town and I may or may not have told her that we’re, uh, together.”</p>

<p>“You did <em>what</em>?”</p>

<p>“I know, I know. It’s bad.” She tutted. “The thing is that my aunt can be really <em>annoying</em>. She always goes on and on about my love life, about how I haven’t found a boyfriend yet, even though I’m already 19, and how that is <em>absolutely unacceptable</em>. So, I decided to put a stop to it.”</p>

<p>Ben closed his eyes. <em>Fuck.</em> Of course, it wasn’t what he’d hoped it was. <em>Of course</em>, she didn’t want to be his <em>actual</em> girlfriend. Who’d want to be? Nobody. Especially not her.</p>

<p>She was standing there, her blonde locks swaying back and forth in the breeze that the open front door let in, and Ben was lost for words.</p>

<p>She tutted again. “Aren’t you going to say anything?”</p>

<p>“Well,” he started. How could he say yes to this? If anything, wouldn’t it just cause him more pain to have an entirely fake relationship than none at all? Maybe. But maybe, this could lead to something. Maybe, he thought, this could be like those cheesy romance films that he sometimes watched when he was in a <em>particular</em> mood. Maybe this could really be the start of something.</p>

<p>“What do you need me to do?” He asked.</p>

<hr />

<p>Emily breathed a huge sigh of relief. “Let’s sit down somewhere,” she said quietly.</p>

<p>As she finally entered the house, and they started making their way over to Ben’s living room, she felt a kind of unease course through her body. It wasn’t the <em>bad Saturday waffles</em> kind. She couldn’t quite put her finger on what this feeling was, but she felt her heart beating faster when they sat down on a rickety, brown sofa.</p>

<p>She knew, of course, that Ben didn’t enjoy this whole situation. She knew that he wasn’t the best liar, and she knew that he didn’t <em>enjoy</em> lying all that much either. But this was different, she thought to herself. Emily never understood what, if anything, Ben felt for her. It wasn’t that he was secretive about his feelings, it’s that she was incredibly bad at reading them. To her, it was weird that so many people automatically <em>assumed</em> that she was amazing at talking to people, making conversation, and understanding what other people want. But this wasn’t really the case. While Emily <em>did</em> love hanging out with people, the part of her brain that was meant for understanding people’s feelings was probably being repurposed to store excessive amounts of Ariana Grande quotes. And it made her feel bad, too, because her best friend Ben was absolutely <em>packed</em> with feelings.</p>

<p>While poking at a small hole in the brown fabric she was sitting on, she recalled a situation from a few months ago. She and Ben were in the park, and there was some sort of spring festival going on. She had dragged him out to it because, even though she didn’t necessarily <em>like</em> taking this role in his life, she’d often try to take him out of his shell and help him fight his anxiety. During that festival, he had a full-on <em>panic attack</em> (the kind of thing that she, as an avid Ariana Grande listener, did not understand), which caused him to run off and hide.</p>

<p>Was this really such a good idea?</p>

<p>“Okay, so,” she said and let out a big sigh. “Let’s talk relationship. What kind of boyfriend do you want to be?”</p>

<p>“I’m sorry?” He said, flustered.</p>

<p>“Well, I didn’t tell my aunt that many lies about you, so the whole thing is pretty open. You can be super caring, or, you know, the bad boy type.”</p>

<p>“The <em>bad boy type</em>?”</p>

<p>“Yea, like, uncaring and aloof, you know? Maybe wear a leather jacket.”</p>

<p>“A leather- have you <em>met me</em>?” He responded in playful disgust.</p>

<p>“Okay, super caring it is, then,” she laughed and moved her hands around in the air as if writing something down on a giant, invisible notebook.</p>

<p>Honestly, <em>super caring</em> was exactly the kind of boyfriend that she actually wanted. Of course, she would never say this out loud, but occasionally she dreamed of the perfect storybook romance. <em>Romeo and Juliet</em>, just without all the tragic stuff. Just like that one Taylor Swift song. While she’d fooled around with some of her girlfriends once or twice, she’d never actually had a relationship with anyone, especially not a guy. She didn’t really know why, either. She briefly wondered if any guys had ever been visibly into her. Maybe she’d just missed it.</p>

<p>She’d also never admit <em>this</em>, of course, but Ben seemed like a fairly good candidate for the position of the super caring boyfriend. He was innocent, sweet, and he had the mane of an extremely gentle lion.</p>

<p>Uncomfortable silence had set in between the two, as it sometimes seemed to do. It didn’t help that Emily had one of those weird thoughts again. Very occasionally, she’d have this intrusive image in her head: Ben, lion-like as he looked, not-so-gently on top of her. Sometimes he’d touch her breasts; sometimes they’d be kissing. Was she sexualizing her friendship? Maybe. Was that bad? She didn’t know. She also didn’t know if she cared yet. After all, she didn’t <em>mean to</em>. It just kind of happened every now and again. If anything, didn’t that speak to her fondness of Ben?</p>

<p>In an attempt to quickly change the subject on her mind, she started telling a story about her aunt.</p>

<p>“You’re going to <em>love</em> my aunt,” she said sarcastically. He looked at her with a sense of dread in his eyes. “Okay, one time, we were at this restaurant, the whole family all packed into this corner booth, and she would not stop pestering the poor waiter with question after question about the most ridiculous stuff! Every time she waved him back over to our table, he looked more and more tired of her shit.”</p>

<p>“That’s actually kind of horrifying,” he responded and shook his head slowly.</p>

<p>“Right?”</p>

<h2 id="chapter-2">Chapter 2</h2>
<p>In the early evening, Ben found himself sitting at a big dinner table, straight across from an overly cheerful looking lady. If he had to guess, Em’s aunt was probably around fifty-five years old, maybe a little older. She was slightly hunched over the table, resting one of her arms on it. <em>That’s not how you sit at a table, young man</em>, he heard his own aunt’s voice echoing in his head. Clearly, Emily’s aunt didn’t care, and from what he’d been told, this wasn’t surprising.</p>

<p>When Emily’s mom came into the room from the kitchen, she was carrying a large tray that held a variety of sweet pastries and cookies. Homemade, Ben assumed, waiting to bite into one of those chocolate croissants. Emily’s mom set the tray down in the center of the table and pointed at it with an open hand as if to say <em>There you go, dig in</em>. So Emily and her sister did. After they finished selecting something they liked, Ben also felt comfortable taking a croissant.</p>

<p>A chocolate cookie in her delicate fingers, Emily’s aunt turned to Emily. “So,” she began while raising her thickly overdrawn, black eyebrows. “How have you been, my love?”</p>

<p>“Well, school’s been going pretty well. I’ve only gotten good grades this semester, and my classes have been bearable.”</p>

<p>Her aunt started smiling wide. “A perfect student as always! I expected nothing less of you, dear.”</p>

<p>Emily provocatively rolled her eyes and sighed. Her aunt didn’t seem affected by that at all. Instead, she continued smiling as she bit into her cookie. “And you, love?”</p>

<p>Confused for a second, Ben realized that she was talking to him now.</p>

<p>“Me? Oh, well,” he stuttered. “School is also going great for me. Emily and I are pretty much on the same level in terms of grades and stuff.”</p>

<p>“On the same level, you say? Maybe that’s why you two get along so well! For years now, I’ve been <em>absolutely positive</em> that you two would make the cutest couple. And now it’s <em>finally</em> happened, God bless.”</p>

<p>Emily sighed, louder this time. Ben let out a stifled chuckle. <em>I wish</em>, he thought to himself.</p>

<hr />

<p>As the conversation continued over dinner, followed by coffee, Ben felt himself zoning out from time to time. As he continued to observe Em and her aunt conversing, he felt his mind wander to a different world without his control.</p>

<p>A world where him and Em really <em>were</em> a couple. A world where, against all odds, they’d happily been together for years, with their own apartment, with floor-length windows and a balcony. They’d sit outside in the evenings, eating ice cream and sipping on cocktails. They would laugh and share stories of their day while watching the sunset over the park. They’d go into town on the weekends and eat at that little Italian place he keeps wanting to go to. They’d never fight anymore, because they’d be happy. He’d never cry alone, never wonder why he was too <em>stupid</em> to tell her how he felt.</p>

<p>Emily grabbed his hand. “We’re going upstairs now,” she said and got up from her chair.</p>

<p>Even though he knew it was fake; even though he knew that her hand in his meant <em>nothing</em>, it felt good. He craved contact like this, with someone he really cared about. He’d hug Emily more if it wasn’t for his fear of being overbearing. Of being a nuisance. Why did he have to feel that way?</p>

<p>Emily dragged Ben behind her as she walked up the stairs, her palm still resting in his. When they got to the door of her room, she still hadn’t let go of his hand. Why? Was Ben just reading into things again, or did she <em>enjoy</em> holding his hand? <em>Surely not. She’d never enjoy that</em>, he told himself. Then, as he frequently did, he told himself to stop telling himself things like that.</p>

<p>Emily finally let go of his hand upon entering her room. This was one of Ben’s favorite places to be. Sometimes, he’d imagine him and Em cuddled up together on her bed, sharing a blanket, watching a movie or playing <em>GTA</em>.</p>

<p>He thought about this kind of thing a lot. Of course, he also thought a lot about the fact that he thought about this kind of thing so frequently. Was it bad to have these thoughts? Was he risking ruining his perfect friendship with Emily by making some big romance out of it in his head? Was it unfair to her to keep quiet about it? As they sat down next to each other on the bed, he tried to let these thoughts fade.</p>

<p>“Thank you <em>so damn much</em>, man,” Emily said and let out a sigh of relief. “What a nightmare.”</p>

<p>“Oh come on, it wasn’t <em>that</em> bad.”</p>

<p>“Did you hear what she <em>said</em>?” Emily put on a very bad, fake British accent. “I was <em>absolutely positive</em>,” she mocked. “<em>My dear.</em>”</p>

<p>Ben couldn’t help but laugh. “She’s not that bad! I thought she was nice.”</p>

<p>“Oh shut up, I <em>know</em> you.” Did she? “People like her drive you <em>mad</em>! You never miss out on an opportunity to hide in your room. You don’t <em>like</em> her.”</p>

<p>Maybe she did know him. And maybe it was this realization that made him unable to think about the words flying out of his mouth. He let out a quiet, but emotional sigh, and said “I like <em>you</em>, though.”</p>

<p>Emily turned and looked into his eyes. As he stared back, he could see a tiny reflection of his face in her brown irises. “I like you too, Ben. You know that,” she said.</p>

<p>Maybe she didn’t know him after all. He focused intensely on her face. What if this was the moment to be honest? What if, in the light of this fake relationship, he could finally be true to how he felt? Anxiety boiled up inside him. This was a panic attack just waiting to happen. But he had to try. Right?</p>

<p>“No,” he said and gently took her hand. “I <em>really</em> like you, Em.”</p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Emily's aunt keeps going on about her love life. To solve this problem, she pretends to be in a relationship with her best friend, Ben, who'd much rather have a real relationship with her. How will an evening with the three of them at the same table play out?]]></summary></entry><entry><title type="html">📅 Jed’s Things to Avoid in Life</title><link href="https://ellpeck.de/blog/jed_things_to_avoid_in_life/" rel="alternate" type="text/html" title="📅 Jed’s Things to Avoid in Life" /><published>2021-04-23T00:00:00+00:00</published><updated>2021-04-23T00:00:00+00:00</updated><id>https://ellpeck.de/blog/jed_things_to_avoid_in_life</id><content type="html" xml:base="https://ellpeck.de/blog/jed_things_to_avoid_in_life/"><![CDATA[<p>Jed didn’t do relationships. That was just one of his rules. Actually, it had become such an important rule to him that he added it to his very official, <em>highly</em> scientific List of Things to Avoid in Life. They were too complicated, and the touchy-feely stuff usually left him feeling inadequate about his ability to be there for someone. He also just didn’t have the time, with his fifty-hour work week and all that. So not wasting his time trying to care for another person, especially considering that they’d probably notice pretty quickly how little he was able to care for them and ultimately leave him to be on his own again. So why bother, right?</p>

<p>He was sitting on a crowded, noisy train on his way to visit his parents in his childhood hometown. He didn’t necessarily enjoy going there again, but this weekend was his mom’s birthday, and he loved her too much to skip it. Even though his grandma would also be there, who he had a particular grudge with after finding out a few years ago about her dislike of a <em>pretty important</em> part of his life. So he wasn’t particularly looking forward to talking to her about “the girls she envisions him marrying.”</p>

<p>He looked out the window, the lush, pine-plastered mountains in the distance slowly creeping by, and imagined what it would be like if he really <em>was</em> as much into girls as his grandma wished he was. It’s not like he hadn’t thought about it. Of course, it would be easier for him to be straight. In fact, maybe his rules about relationships were only so airtight because he was afraid of being bullied. He didn’t enjoy the thought of holding hands with his boyfriend, only to be attacked by some idiot in an alley. But his other reasons were good, too, right? He <em>was</em> a little emotionally unavailable at times. He <em>did</em> have that horrible work week. <em>Yes</em>, he thought to himself. <em>Those are good enough reasons to avoid the perfect, storybook romance you dreamed of as a kid, damn it.</em></p>

<p>After leaving the train, he stopped in the middle of the platform and looked around to get his bearings again. Out of the corner of his eye, he noticed something odd. He turned to face the front window of a small bakery, the glass protecting delicious looking pastries and cakes that were quietly sitting in a large vitrine. But that wasn’t the odd thing.</p>

<p>He started closely inspecting the head of the person standing behind the register, currently handing a glazed donut to an old lazy. After a few seconds, the person turned in his direction, and started looking directly at him. And there he was, standing in the middle of a train station, locking eyes with the <em>last</em> person he wanted to see in this town. He smiled and waved awkwardly, and the person behind the register did the same, before turning back to the old lady and finishing their transaction.</p>

<p>Jed, clearly having lost his mind, thought it would only be right to go inside and say hello. A little bell that was mounted behind the door rang. Now, he was standing right in front of him. His long, wavy brown hair had the same elegance as it did the last time Jed saw him, as if nothing had changed. Davy must’ve been sat in a time capsule for the last four years, because he still looked exactly as beautiful as he did all those years ago at school. No, better. Davy had broad shoulders and a wide frame. His arms were thick and muscular and Jed imagined them again, wrapped around his body, warming him. Protecting him.</p>

<p>“Jed! I didn’t know you still lived in town,” he said with a smile that penetrated all of Jed’s defenses.</p>

<p>“I don’t, actually,” he stuttered. “I’m visiting my parents.”</p>

<p>“Ah, that makes sense. Train station.” Davy laughed awkwardly and pushed the hair out of his face with his hand. His motions were smooth and soft, and Jed couldn’t help but notice the veins in his arms twitching as he moved his hands. <em>Jesus Christ</em>, he said to himself. <em>Get a grip.</em></p>

<p>“How have you been?” Davy asked and raised an eyebrow.</p>

<p>“I’ve been pretty good, actually,” Jed mumbled, still mesmerized by Davy’s movements. The grip clearly hadn’t been gotten yet. “I’m working at a pretty big software company.”</p>

<p>“That’s awesome,” Davy said with a very real, supportive air of enthusiasm.</p>

<p>“And you?”</p>

<p>“Been working here to help with uni. That shit’s really expensive, man.” Davy chuckled.</p>

<p>Jed nodded his head slightly. “Yea, I can imagine,” he said.</p>

<p>“Anyway, it’s cool that you’re here. Do you maybe want to catch up some time?”</p>

<p>Jed froze. <em>Oh my God</em>, he thought. Had Davy really just asked him on a date? Okay, well. Not a <em>proper</em> date, but…</p>

<p>“Uh, yea, that sounds great,” he mumbled. If Davy was a mirror, he’d probably see his entire face turn into a tomato right now. <em>Oh, God.</em> “I’m free the whole weekend,” he continued.</p>

<p>They exchanged phone numbers, and Jed breathed a sigh of relief when he exited the bakery. Thankfully, Davy didn’t seem to have noticed how awkwardly Jed was acting around him. Was he even acting that awkwardly? Possibly. Probably.</p>

<hr />

<p>Only a few days later, Jed arrived at a coffee shop that he used to go to with his friends after school sometimes. It was small, filled with small nooks with comfortable looking armchairs that had colorful blankets thrown over them. Taking in the romance that this place clearly emitted, he sighed to himself. <em>Oh God, this is a</em> proper <em>date, isn’t it?</em></p>

<p>He waited in the entryway of the café until Davy arrived. And <em>boy</em>, did he arrive. He walked into the room wearing a jean jacket over a black logo tee and jeans. His hair was blowing in the wind let in by the open door, and it reminded Jed of their first encounter at the train station. The whole outfit made Davy seem strong. For a second, Jed imagined what it would be like to be scooped up by his strong, muscular arms like a princess. Like a <em>prince</em>.</p>

<p><em>Get a grip</em>, he thought to himself.</p>

<p>“Hey man,” Davy said with a smile as he saw Jed. <em>Hey, ‘man’?</em>, he repeated in his head.</p>

<p>“Hey Davy,” said Jed with an awkward half-smile. He tried to wipe it off. “You look,” he started, but he didn’t know how to finish.</p>

<p>“Gay?” Davy suggested. “I know. I just love this jacket so much.”</p>

<p>“That’s not-“, Jed stuttered. “I didn’t … you look <em>good</em>.” He hesitated. Why did he <em>say</em> that?</p>

<p>“Thanks. You don’t look too bad yourself,” Davy said and started making his way towards one of the seating nooks. He brushed Jed’s arm with his own while passing him, and it made that place tingle with… with something.</p>

<p>Jed realized that he didn’t even know for sure if Davy was into guys. He wondered for a second if that comment about his jacket was confirmation that he was, in fact, gay. Was anything he’d done so far confirmation that he was?</p>

<p>A weird feeling of unease creeped up in Jed’s chest, and it immediately entered his heart. <em>What if he’s not even into guys?</em>, he thought to himself. He didn’t do relationships anyway, though, so why would it matter – right? They were too complicated, too time-consuming, and too draining of the small amount of emotions that Jed had. So it was of no value to know whether Davy was into him or not.</p>

<p>He really enjoyed the idea though. As he watched Davy sit down on a sofa in one of the nooks, he imagined what it’d be like to be on that sofa with him. Sitting next to him. Close. Kissing him. Davy’s hand moving closer to Jed’s–</p>

<p>“Are you coming?”, Davy called and waved. <em>Oh God</em>, Jed thought to himself. <em>Hopefully not.</em></p>

<p>Jed started walking towards him, and Davy started patting the spot next to him on the sofa. He wanted Jed to sit next to him. <em>Great.</em></p>

<p>Of course, being the gentleman he was, it was only right of Jed to actually go ahead and sit down next to Davy. That was the only reason, <em>of course</em>.</p>

<p>They both ordered drinks (hot chocolate) and food (cheesecake and apple pie) and started chatting about how they’d been since school. Davy talked about his university courses and the bakery job and how he’d sometimes see his old friends at the train station, and Jed was <em>fascinated</em>. It wasn’t that Davy’s stories were actually <em>fascinating</em>, but somehow, because <em>he</em> was the one telling them, they seemed more alive than Jed ever thought a story could be.</p>

<p>When Jed started talking about his job, about the long work hours and about his family, Davy turned a bit to face him. Now they were sitting closer, almost opposite one another, and Davy’s gaze seemed to be locked onto Jed’s eyes while he told his stories. He’d never met someone, Jed thought to himself, who seemed so genuinely interested in his life. Somehow, the two of them were just fascinated with each other, it seemed. But Jed’s rule was clear: <em>No relationships</em>. They were a waste of time, and that was a final, reasonable, and educated decision.</p>

<p>That was, of course, until they started talking about Jed’s homophobic grandma. As soon as he mentioned that his grandma didn’t ‘approve’ of his sexuality, Davy’s smile faded, and he rolled his eyes. The sight made Jed chuckle.</p>

<p>“Relatable?”, Jed asked with a tiny grin.</p>

<p>Davy tutted. “Oh God, don’t get me <em>started</em>.”</p>

<p>He shifted a little on the sofa, and they were sitting even closer to each other now. Was he doing this on purpose?</p>

<p>“My mom’s the same way.”</p>

<p>“Your <em>mom</em>? That’s terrible!”, Jed hissed.</p>

<p>“Eh, I’ve been getting by alright. I don’t need her, you know? It’s her loss.” Davy began smiling again. “I’ve got enough people in my life who support me.”</p>

<p>“That’s good,” Jed responded. Overwhelmed with the flood of endearing sentiments rushing through his chest – the homophobic mom, the sweet sentiment about Davy’s chosen family, and just how close to each other they were sitting right now – Jed couldn’t stop himself from saying more. “I’d support you too, you know.”</p>

<p>“You know what,” Davy began. <em>Oh God</em>, Jed thought to himself. This was it. He’d ruined it. <em>You’re getting a bit creepy</em>, that’s what Davy was about to say. Right? He’d said too much. But Davy’s smile didn’t fade. Instead, he chuckled and put his hand on Jed’s shoulder.</p>

<p>“You’re great to hang out with, Jed,” Davy continued. “But I really have to go now, sadly. I really want to see you again, though.”</p>

<p>Jed’s cheeks warmed up, and he began to smile again. “Me, too,” he said shakily.</p>

<p>Over the next few days, Jed kept daydreaming about Davy. His cute smile, his wavy hair and his muscular, strong arms. He kept picturing, over and over, how Davy grabbed his arm when they sat so close in the café. He should’ve kissed him then and there. No, it would’ve been too soon. Plus, they had another date lined up. Because he hadn’t seen town in a while, Davy came up with the idea of hiking to the top of the nearby mountain and looking down at the cityscape from there.</p>

<p>But maybe he shouldn’t get closer to Davy, he thought. He didn’t want to give him the wrong idea. His list of rules was very strict, and Jed intended to continue following it. No relationships, because they are too complicated and time-consuming. But Davy could’ve happily consumed all of his time without Jed even remembering that his list of rules <em>exists</em>.</p>

<hr />

<p>There he was. Strong as always, wearing a t-shirt that made his muscular upper arms even more pronounced than usual. Today, his long, silky hair wasn’t flowing over his shoulders, though. He had tied it up into a ponytail, presumably so it wouldn’t bother him during their hike.</p>

<p>Jed approached him on the parking lot close to the hike trail leading up the mountain, and Davy turned around slowly.</p>

<p>“Hey,” he said in a rough voice. He cleared his throat, before saying “hey” again, less raspy this time.</p>

<p>“Hi. I’m excited!” Jed blurted out with an unusual amount of confidence. <em>The rules, damn it</em>, he thought to himself. <em>Get a grip.</em></p>

<p>“Me too. I packed some snacks for us, as well,” said Davy and pointed to his backpack. He shifted his upper body and laughed, causing what sounded to be loose food items to rustle in the bag.</p>

<p>Halfway up the trail, Jed started getting exhausted. It wasn’t that he was out of shape (he’d been working out occasionally because of the part of his List of Things to Avoid in Life that read <em>getting out of shape</em>, of course), but something about this hike was different to him. Stopping on the trail, he grabbed a bottle of water out of his backpack and started gulping it down without hesitation. Davy stopped as well, and observed Jed as he almost finished the entire bottle.</p>

<p>“Want to take a break?”, he asked slyly.</p>

<p>“Shut up, I can do this!”, Jed blurted out without much thought. <em>Oops.</em> “I’m just-“</p>

<p>Davy cut him off. “Well, I know you can, but you can also relax with me for a little while.”</p>

<p>Relaxing sounded like a great idea to Jed. He wiped his mouth and chin with his forearm and looked over at Davy, who had already found a nice bit of grass to sit down on. <em>Laying down on the grass together</em>, he thought, remembering this very fantasy having been stuck in his head for the last few days. <em>Of course. Damn it.</em></p>

<p>Jed walked up to Davy and looked down questioningly. Davy looked back up at him and smiled.</p>

<p>“Come sit,” he said with a grin, pointing to the ground right next to him. Jed did as he was told.</p>

<p>And now, there they were, just like in Jed’s <em>stupid</em> fantasies. Sitting next to each other, looking out over the forest and a small part of town, with Jed feeling the cool, green grass underneath him.</p>

<p>“You know,” Davy began. “I used to think that you were kind of weird. In school, you know. I only realized afterwards that…” He hesitated. Jed turned his head to see the expression on Davy’s face, but there wasn’t much being expressed there at all. Eventually, Davy continued.</p>

<p>“I think I realized that I had the tiniest bit of a crush on you.”</p>

<p>On… <em>what</em>? Jed’s heart skipped a beat. What had Davy just said? Clearly, Davy was out of his mind. Or Jed was. Was he dreaming? Was he passed out from exhaustion somewhere, laying on the path, with Davy wondering what he’d gotten himself into? Jed shook his head. <em>No.</em> This seemed to real to be a dream.</p>

<p>“You… you did?”, Jed stuttered. Davy chuckled.</p>

<p>“I think so, yea. You were always kind of cute, and seeing you at the train station the other day… I don’t know, it felt like a sign.”</p>

<p><em>A sign</em>, Jed thought to himself. He could kind of see that. The hunky, adorable student who worked in a bakery, with his long hippy-like hair, believing in <em>signs</em> and probably <em>soulmates</em> and what have you. This made sense to Jed. But the fact that Davy was saying all of this to <em>him</em> made no sense at all.</p>

<p>“Are you serious? I–”, Jed paused, trying to formulate a coherent sentence in his mind. Davy was looking at him with a sense of desperation in his eyes. <em>Tell me that you like me too</em>, they seemed to say.</p>

<p>At this point, Jed went over the options in his mind. The rules, the meeting at the train station, the <em>coincidence</em> of it all. Maybe he believed in signs, too. Maybe he believed that, out of all the people he could’ve met that day, Davy was just the perfect one. Maybe, he thought to himself, his rules didn’t actually matter that much after all.</p>

<p>“I actually really liked you too. In school. I always saw you with all of those girls and I thought, you know. I thought I’d never have a chance. Especially since you seemed so…” Davy cut him off.</p>

<p>“So straight?”, he said and laughed.</p>

<p>“I guess, yea.”</p>

<p>“Well, I’m not. I mean, I am. I’m bi, actually,” he explained.</p>

<p>“That makes sense,” Jed responded, not really sure what else to say. They were both silent for a moment, but their gazes were still interlocked. They were sitting close enough together now for Jed to feel both of their breathing warming up the air between them.</p>

<p>“Do you want to…” Davy began, but he paused. Jed wanted a lot of things right now. He imagined moving closer to Davy, putting his hand on his thigh, maybe lower, deeper, and going through Davy’s hair with his hand. He didn’t, however, know what Davy wanted. So he didn’t do anything.</p>

<p>“Can I kiss you?”, Davy asked after an uncomfortably long silence. Jed didn’t answer with words – how could he possibly answer that question without melting into a puddle then and there – but apparently, his wide smile was enough indication to Davy that Jed <em>did</em> want to kiss him.</p>

<p>Davy moved in closer, grasping Jed’s hip with one hand, and as Davy leaned in closer with his head, Jed could see the veins in his arm twitching as he moved.</p>

<p>Jed closed his eyes, and he felt Davy’s lips touch his own. He felt him reaching around Jed’s body with his other hand, fully enclosing him in his strong embrace now. It felt good. Jed wanted to continue, forever, staying here and kissing Davy until the end of time.</p>

<p>This was good. To Jed, it was the perfect place to be.</p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Jed's rules are clear: No relationships. They interfere too much with his life, and he's not made for them anyway. But then, he sees his old crush from school in his hometown. Will he break his own rules for Davy?]]></summary></entry><entry><title type="html">❤️ Em &amp;amp; Ben</title><link href="https://ellpeck.de/blog/em_and_ben/" rel="alternate" type="text/html" title="❤️ Em &amp;amp; Ben" /><published>2021-03-24T00:00:00+00:00</published><updated>2021-03-24T00:00:00+00:00</updated><id>https://ellpeck.de/blog/em_and_ben</id><content type="html" xml:base="https://ellpeck.de/blog/em_and_ben/"><![CDATA[<h2 id="chapter-1">Chapter 1</h2>
<p>There’d never been a day quite like Tuesday, February 17. It was a warm, spring day, and the newly awakened sun was warming Ben’s freckle-ridden face. He didn’t know it just yet, but this would be the day that Ben would almost die. Well, that’s the way he’d think of it <em>afterwards</em>, anyway.</p>

<p>The park was unusually packed with people, and for a second, Ben debated whether turning back was a good idea after all. He’d had these thoughts a lot recently; wanting to just turn back and run away from things. He ran a hand through his long, silky hair and turned around. <em>Damn it</em>, he thought, before he snapped back to facing the center of the park. <em>I have to do this.</em></p>

<p>From afar, he could just about make out what was going on around the large fountain. The water was splashing out of what he’d always just assumed to be a large fish, though he didn’t have the ability to tell for sure, because the fountain was old and rugged and had probably been just-about-fixed one too many times before. Ben squinted a bit before raising his glasses in an attempt to make out the faces of the people he saw, sitting and standing around the fountain, talking. He was looking for his best friend, Emily. She was really the kind of person that would drag him to outings like this; public gatherings and any sort of parties were terrifying to Ben. It was natural then that he would find a best friend that is his absolute polar opposite: Popular, blonde and, of course, an absolute party animal. <em>Damn it, Em, where are you?</em>, he mumbled to no one in particular.</p>

<p>He started approaching the fountain and the square around it. Several small crowds of people were standing around little stalls that emitted vastly different smells. Amidst all of this mess, he was almost certain he could smell bubblegum ice cream. Hectically looking around in an attempt to find his friend, he tried to suppress any memory related to bubble gum. To ice cream. To the life that he’d had before he changed. <em>Fuck</em>, he quietly said to himself.</p>

<p>The smell of the bubblegum ice cream started getting too strong for him to handle, and memories started welling up inside of him. His brain was unfolding like a book, too heavy to close. Ben pictured a red, rickety swing set in the middle of a park much like the one he was in right now. He pictured Emily, and for a moment, he pictured the way it had felt. The way the wind blew through his hair as he threw his legs back and forth on the swings, laughing with Em about wanting to do a three hundred and sixty degree turn. Had he already called her <em>Em</em> back then?</p>

<p>He immediately snapped back into reality when he felt the tap of something on his shoulder. Immediately might have been generous, because the tap really did feel like a heavy knock. Maybe it had taken him a few seconds to come back. His eyes felt a bit watery and his knees were shaking, but he told himself that he was probably just hungry (he wasn’t) and turned around to discover the source of the heavy tapping.</p>

<p>“Ben!”, Emily exclaimed right behind him. She was a beautiful woman with curly hair and a smile that probably tasted like bubblegum ice cream. <em>Tasted?</em></p>

<p>“Hey, Emily, why’d you take so long?”, he asked in the flattest possible tone.</p>

<p>“Shut up”, she returned with a snarky grin. <em>Damn</em>, she looked extra beautiful today. Ben looked down at her flowy, blue skirt and matching light purple ballerinas. Even though his eyes were still watery, he couldn’t help but smile at the look of her, standing there right in front of him. This is exactly what she did to him.</p>

<p>“Oh man, I want some fro-yo right about now!”, Emily sighed yearningly as she grasped Ben’s upper arm and started pulling him towards one of the stalls by the fountain. “You want some too? I can pay.”</p>

<p>“Are you kidding me? You’re <em>broke</em>, I’m not letting you pay for <em>anything</em>!”</p>

<p>“<em>Broke</em>? Come on, that’s a bit harsh”, she countered and frowned. She stopped dead in her tracks, let go of his upper arm and, after a few seconds of fondling with her cardigan, produced a thirty-dollar bill out of what he could only assume to be a hidden pocket somewhere. “See?”</p>

<p>Not entirely convinced of Emily’s sudden wealth, he raised an eyebrow and tilted his head slightly in disapproval. “Fine.”</p>

<h2 id="chapter-2">Chapter 2</h2>
<p>Over the next few hours, Ben was dragged back and forth between stalls and attractions. For every single one, he was apprehensive at first but rather quickly changed his mind once Emily frowned. It was such a heart-melting frown, worse than the faces that his aunt’s dogs would make when they wanted to be taken for a long walk. Every single thing about Emily was just so beautiful that he could be happy doing anything with her. Even going to a shoddy, uncomfortable carnival in the middle of February.</p>

<p>They’d already stopped at almost every ride and stall, and so Ben decided that now was enough. He wasn’t usually the type of person to make decisions like this (he’d just leave it up to whoever else was actually in charge), but this time, he’d put his foot down. He would, absolutely.</p>

<p>“Em, I’m getting tired.”</p>

<p>“Are you serious? We haven’t even eaten any churros yet!” Emily smiled devilishly at him while tugging on his blue sweatshirt’s right sleeve. She was staring at him, as if trying to extract the information directly from his eyes. Her blonde locks were flowing over her brow and almost into her eyes, but that didn’t seem to bother her. He guessed that, after a while, you’d probably get used to it, like you do with seeing your own nose. He really liked seeing her nose, though.</p>

<p>“You <em>love</em> churros,” she pointed out with an overly exaggerated <em>o</em> in <em>love</em>.</p>

<p><em>In love</em>, he thought. This time, he was going to put his foot down, right? That’s what he’d decided. He didn’t want people to control him anymore. But was that really what Emily was doing here? No. She was his best friend, she knew what was good for him. Right? She was looking at him, in obvious anticipation of his answer. He did really like churros. But did he love them? He wasn’t sure about that. Okay, he did love them, but did he love them enough to warrant another thirty minutes at this godforsaken carnival?</p>

<p>He loved Emily, that was for certain.</p>

<p>Wait, what? Had he really just thought that? No, he couldn’t have. That was just one of those jokes his brain made up sometimes. Amusing, albeit slightly infuriating. <em>Fuck off</em>, he said to himself.</p>

<p>“What?”, Emily replied, clearly confused as to what he was saying. He wasn’t saying anything though, right? What had he said?</p>

<p>“I’m, the,” he mumbled, trying to make sense of what Emily could’ve just heard him say. Maybe she didn’t hear anything, maybe it was just the wind. What could he have said to her? Surely he didn’t say the love part out loud, right?</p>

<p>He stared at her face. Her brown eyes were intensely focusing on him, her lips slightly curled into a smile. She tugged on his sweatshirt one last time.</p>

<p>“So, churros?” Oh Thank God.</p>

<p>“<em>Fine.</em>”</p>

<hr />

<p>As they were eating their churros, Ben couldn’t help but notice how much chocolate sauce Emily had on hers with every bite. They’d ordered a little square box filled with twelve or so standing churros, along with a small tub of chocolate sauce that tasted criminally close to Nutella without actually being Nutella.</p>

<p>“You know this sauce is for dipping, right?”, he said to her with a grin before taking another huge bite. “It’s not supposed to be a full-on coating.”</p>

<p>“What do you know, huh? Where does it say that?” She tutted and shoved her churro into the tub of sauce with ostentation. While pulling out the excessively coated pastry, she got ready to put her other hand under it as to prevent any of the chocolate sauce from dripping down onto her dress.
“Try it!”, she said with an impish smile and held the dripping mess right up to Ben’s mouth.</p>

<p>“No, I don’t—” He tried to interject, but Emily had already rammed the chocolate-covered churro directly into his face. He resisted opening his mouth, so the chocolate sauce smeared all over this face and chin and then continued to drip onto his sweatshirt in big, brown globs. “Damn it, Em.”</p>

<p>“I’m sorry, but why didn’t you open your mouth?”, she asked jokingly while holding back laughter.</p>

<p>“Fuck,” he said angrily and fumbled around his pockets, trying to find a tissue or something. In the scramble, the smells of the chocolate on his face and the odor of bubblegum ice cream in the air mixed to create something awfully unpleasant in his nose. He was trying really hard to find a tissue now.</p>

<p>“Damn it, Em, why do you always have to do that?”</p>

<p>“Oh, <em>come on</em>, that isn’t fair! I was just trying to have fun!”</p>

<p>“Fun? You know I hate these kinds of things. I hate <em>people</em>!”</p>

<p>She tutted. “Lighten up a bit, Ben!”</p>

<p>“Lighten the <em>fuck</em> up?” His brain was unfolding again, this time like floodgates, unable to be stopped by the water pushing against them. “You don’t understand me at all!”</p>

<p>He was yelling now, and some people around them were beginning to notice. Fuck. He finally looked over at Emily, his face still covered in chocolate sauce, but she wasn’t smiling anymore. Instead, she had this look on her face that she’d sometimes get. When watching a sad documentary, or when her mom prepared food that she didn’t particularly enjoy. It wasn’t a frown, it was more of a neutral expression of… disapproval? Disgust?</p>

<p>“Why is everything such a big fucking deal to you, Ben?”, she yelled, tears starting to escape from her half-shut, pained eyes.</p>

<p>That was the moment a switch in his brain finally flicked. A switch that was probably in a back room, guarded by multiple doors with multiple, separate keys. Use only in emergencies, a sign somewhere close to the switch probably said. Don’t use even, maybe. Ben tried to force his eyes shut with extreme determination. No, he wouldn’t cry.</p>

<p>But he did. Tears started running down his face like waterfalls, and he tried to cover them up and wipe them away with the sleeve of his sweatshirt. He wiped his cheeks with the sleeves of his blue sweatshirt, and large amounts of chocolate sauce transferred from his face to the sleeves. God fucking damn it, he muttered to himself. The world around him was turning into a very small part of his vision, the rest filled with blurry streams of tears. He tried to get up from the bench they were sitting on and stumbled around the square where the festival was happening. He was sure he’d bumped into a few people on the way, but couldn’t tell for absolute certain. After what felt like an hour and a half, he finally arrived at a tree a few meters away from the fountain square.</p>

<p>He rested one hand against the bark and tried to catch his breath. The thought of bubblegum ice cream was fresh in his mind again, the thought of the red, rickety swing set was morphing and mixing with the thought of churros, the thought of chocolate sauce in his face. The thought of Emily’s smile, the thought of her frown, the thought of her sad movie face. Fuck.</p>

<p>He tried telling himself to breathe. <em>Five in, six hold, seven out.</em> That’s what his therapist had told him. <em>One, two, three.</em> What’s the worst that could realistically happen?, that’s what he was supposed to ask himself. <em>Four, five.</em> Well. <em>One, two, three.</em> Emily might never talk to him again. <em>Four, five, six.</em> She might hate him, now that she’d just tried to be cute by shoving a churro into his face, and now that he’d reacted like a total fucking asshole. <em>One, two.</em> Was he already breathing in again? <em>Fuck.</em> He kept telling his body to calm down, his mind to stop racing. His heart to stop racing. He started leaning against the bark and then slowly slid down the tree trunk, sitting down on the ground with his knees close to his chest. He observed the rickety swing set in the middle of the field, and saw himself and Emily swinging back and forth again, talking about three hundred and sixty degree swings. He saw himself, laughing and giggling and occasionally licking a cone of
bubble gum soft serve he had in his left hand. He saw Emily doing the same. He saw himself wobbling a bit on the swing, trying to hold himself steady with just his right hand. He tried to breathe again. <em>One, two, three.</em> He saw himself, still holding the cone, sliding out of the swing’s seat and yelling something. He saw himself landing in the rough, wet sand, the cone having left his hand and landing face-down in the sand next to him. <em>Four, five.</em> Tears were still running down his face. He saw himself turning around as Emily jumped off of her swing and came to his rescue.</p>

<p>“Are you alright?”, he heard her say in her beautiful, melodic voice. <em>One, two, three.</em></p>

<p>“I would’ve been, if you hadn’t forced me to get this stupid ice cream!”, he heard himself shoot back aggressively.</p>

<p>He felt something tap on his shoulder again.</p>

<p>“Are you alright?”, he heard someone say. “I’m sorry, I shouldn’t have said that.”</p>

<p>It was Emily, standing next to him, bending down a bit to reach his shoulders. She slid down the tree trunk next to him. “I’m really sorry.”</p>

<p>Ben tried to catch his breath, but with Emily here, it felt much easier all of a sudden. It’s like a tension had been lifted from him, like someone had come to push on the floodgates from the other side. “It’s alright. I’m sorry I yelled, too.”</p>

<p>Emily tutted.</p>

<p>“You know, sometimes I think of that day on the swings.”</p>

<p>“What day?”</p>

<p>“The day we had our first fight. Don’t you remember?”</p>

<p>Emily tutted again. She placed her hand back on his shoulder, which he liked, because it was Emily’s hand. That’s all that mattered to him.</p>

<p>He wiped the remaining tears and chocolate sauce off of his face, his sweatshirt’s sleeves now completely covered in both. “I keep remembering that day, being scared that I’ll re-live it. That we’ll have another fight. That you’ll leave.”</p>

<p>“<em>Leave</em>? Come on.”</p>

<p>“I’m serious.”</p>

<p>“I am, too. I’m not leaving.”</p>

<p>She scooched closer and rested her head on his shoulder. “You know, I think about stuff too.”</p>

<p>“Like what?”, he asked while also resting his head on her head, which made him feel really close to her. Intertwined, even.</p>

<p>“You”, she said quietly and grunted. “I really like hanging out with you, you know?”</p>

<p>“I do too,” he said almost immediately. Did this mean what he thought it meant?</p>

<p>“Do you want to go home? I’m sure my mom has cookies.”</p>

<p>He nodded. Maybe it did.</p>]]></content><author><name>Ellpeck</name></author><category term="Short Stories" /><summary type="html"><![CDATA[Ben hates public gatherings because he suffers from anxiety. He's also in love with his best friend Emily, who frequently tries to drag him out of his shell. At the spring festival, he has a panic attack. Will Emily manage to support him?]]></summary></entry><entry><title type="html">💻 Your Minecraft Modding Questions, Answered</title><link href="https://ellpeck.de/blog/modding_ama/" rel="alternate" type="text/html" title="💻 Your Minecraft Modding Questions, Answered" /><published>2021-03-21T00:00:00+00:00</published><updated>2021-03-21T00:00:00+00:00</updated><id>https://ellpeck.de/blog/modding_ama</id><content type="html" xml:base="https://ellpeck.de/blog/modding_ama/"><![CDATA[<p>Hi, I’m Ellpeck. I’m the creator of a bunch of Minecraft mods, including Actually Additions, Nature’s Aura and Pretty Pipes. A while ago, I also started taking <a href="https://ellpeck.de/commissions">commissions</a>, so the list of Minecraft mods I’ve created is slowly, but surely, growing.</p>

<p>I asked all of you on Twitter and in <a href="https://link.ellpeck.de/discordweb">my Discord server</a> if there are any modding and programming-related questions you’d like me to answer. Since most of the questions yall ended up asking were related to Minecraft modding, I thought I’d make the post exclusively about that after all. It also means that you might find this post interesting even if you don’t program or make Minecraft mods yourself, because the questions ended up being pretty general.</p>

<p>Here goes.</p>

<h2 id="how-do-you-keep-yourself-interested">How do you keep yourself interested</h2>
<blockquote>
  <p>…in an idea or project, so you won’t abandon it after two days of enjoying it? (canitzp)</p>
</blockquote>

<p>Hahaaa. I really wish I had an answer for that. I have <em>countless</em> abandoned projects, as do most people that work in creative fields in some capacity. I recently made most of them public on my <a href="https://github.com/ellpeck">GitHub</a>, so if you go there and scroll back far enough, you’ll find some old games and unfinished mods.</p>

<p>So how <em>do</em> I keep myself interested? After all, I’ve made and finished a bunch of stuff. Since I suffer pretty massively from depression and anxiety, it’s especially hard for me to commit and pull through on anything, really. However, there’s a huge thing I’ve learned: If you start losing motivation for something, <em>don’t</em> try to fight it. If you do, you’ll just force yourself to work on the project without actually being interested, causing you to burn out with it even more. Instead, accept that you’re losing interest and move on to something else. While the first strategy has lead me to abandon projects entirely several times, the latter only caused me to take fairly long breaks, but so far, I’ve always returned to projects that I didn’t try to push myself to work on.</p>

<h2 id="good-tips-before-diving-into-modded-minecraft">Good tips before diving into modded Minecraft?</h2>
<blockquote>
  <p>(Afkman57)</p>
</blockquote>

<p>I’m not sure if you mean <em>playing</em> modded Minecraft or <em>creating</em> mods, so I’ll just answer the question for both!</p>

<p>Before diving into <em>playing</em>, I think it’s really important to know what you’re getting yourself into, because expectations can pretty drastically change your experience of things. (Most) Minecraft mods are <em>not</em> commercial products, and they <em>don’t</em> have quality control. Authors don’t get paid for creating mods, and they don’t <em>owe</em> you anything just because you downloaded their mods. I think this is very important to realize because I’ve interacted with so many people before that think if you download a mod, it’s like you’re buying a product with the promise of life-long support. If something breaks in a certain way, or something works in a way that you dislike, but the mod’s author doesn’t agree with what you see as a problem, they have <em>no</em> obligation to change it for you. On the other hand, modded Minecraft can be <em>incredibly</em> fun. With well-made mods, there is so much new stuff to discover and create that it feels like you got yourself an entirely different, new game.</p>

<p>Before diving into <em>creating mods</em>… well. The most important piece of advice I personally have for you is: <strong>Learn the language first</strong>. If you’re creating mods for Java Edition, <em>please</em> have at least a basic understanding of Java first. The first time I tried my hand at programming was for a Minecraft mod (Actually Additions’ sort of roots, actually) and it went horribly, because I didn’t understand what was part of the language I was using and what was part of the rather complex Minecraft and Forge API. For example, because Minecraft makes heavy use of method chaining<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>, when I first started out, I used to think that that was just an inherent property of the language (which obviously makes very little sense). I don’t know if that was just me being a bit slow, or if that’s the kind of misunderstanding that comes from not really learning a language before diving head-first into a project that uses it.</p>

<h2 id="maybe-some-good-guidelines">Maybe some good guidelines</h2>
<blockquote>
  <p>…on code-format or even conventions for forge-modding. (Afkman57)</p>
</blockquote>

<p>Oh boy. Talking about conventions is always a tough one, because people disagree so fundamentally on what is good code and what isn’t. A great example was when I learned that, in professional software engineering, early returns<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup> are apparently considered “bad practice” because they “decrease readability.” How decreasing the amount of nesting (and thus, the amount you have to scroll to the right by) also decreases <em>readability</em>, when I think it massively <em>increases</em> readability, I’m not sure. Maybe that was just my software engineering professor having a field day, though. I really hope it’s that.</p>

<p>When it comes to programming in languages that don’t <em>rely</em> on formatting for their syntax (like Python), the actual formatting you use doesn’t matter, even though some people might have you believe that it’s <em>extremely important</em> to put opening braces on a new line. For me, the only important thing is that <strong>you keep it consistent</strong>. If you use an IDE, your best bet is to configure its auto-formatter exactly the way you like, and then using the format button every now and again (or even turning on format on save!) to make sure that, no matter how horrible your formatting is, at least it’s consistently so.</p>

<h2 id="any-useful-tools-resources-utilities-etc">Any useful tools, resources, utilities etc.</h2>
<blockquote>
  <p>…for modding would be good too. (Afkman57)</p>
</blockquote>

<p>I think the best, and most important tool, for modding, and any kind of programming, is a git server, be it GitHub, Bitbucket or whatever else. Source control is amazing, because not only does it allow you to see exactly what you (and your colleagues) changed an when, but it also allows you to revert any of your changes or merge them together.</p>

<p>The other very useful thing about git websites like GitHub is that you can <em>look at other people’s code</em> and take it as an implicit sort of tutorial. There are countless times where I looked at the code of other, bigger mods in an attempt to find useful information on how to realize certain things in my own mods. In the very first version of Actually Additions that had <a href="https://ellpeck.de/actaddmanual/#laserRelays">Laser Relays</a>, they were pretty much an exact copy of <a href="https://www.curseforge.com/minecraft/mc-mods/immersive-engineering">Immersive Engineering</a>’s wire system, in terms of their inner workings. When you look at and especially copy other people’s code, though, make sure of two things:</p>
<ul>
  <li><em>Understand</em> the code you’re copying. If you don’t understand it, you might as well just be mindlessly copying random code from random places.</li>
  <li>Keep the code’s <em>license</em> in mind. Some licenses allow you to copy code freely, some require you to give credit and some don’t allow you to copy any code at all. Even if a project allows you to copy code without giving credit, it’s always good practice to do so anyway.</li>
</ul>

<h2 id="how-much-work-did-it-take-to-make-actually-additions">How much work did it take to make Actually Additions</h2>
<blockquote>
  <p>…from start to finish? Also how long did it take you to go from an idea to a first “prototype”? (Spo0ok)</p>
</blockquote>

<p>This is an incredibly tough question, because of course I didn’t record an exact measurement of how many hours I sunk into creating Actually Additions. What I do know, however, is this: It look <em>a long time</em>. Actually Additions was one of my first mods, and as previously discussed, I was not very good at any kind of programming when I started out, so I made al ot of mistakes, and I copied a lot of code without understanding it. That being said, I can give a rough estimate based on data that I already discussed in my <a href="https://ellpeck.de/blog/actually_additions">post about its features</a>.</p>

<p>The first file I uploaded to CurseForge was <a href="https://www.curseforge.com/minecraft/mc-mods/actually-additions/files/2229705">this one</a>, on <em>March 15, 2015</em>. I know that, before I started uploading the mod to CurseForge, I had a Minecraft Forum page (it was still that time in 2015), and I would release early versions of the mod on Mediafire or some other site. That wouldn’t have lasted that long, though, and looking at the commit history for the mod, the first time I referred to it as Actually Additions wasn’t long after the repository was first created, <a href="https://github.com/Ellpeck/ActuallyAdditions/commit/2a2308c0ce35fe8a5ac9dcea100b9aeb941c495a">in March 2015</a>. I made my last real contribution <a href="https://github.com/Ellpeck/ActuallyAdditions/commits/main?after=896a082d747a3e19755ded1973544d59fa992787+244">in June 2017</a>.</p>

<p>That means, to create all of the features that the mod currently has, it took me about two years. I know that measurement is pretty reasonable, because I took almost no breaks when I first created the mod. This information also means that I have now <em>not</em> worked on the mod for longer than I originally <em>did</em> work on it. It’s been like that for a long while actually, because 2017 is surprisingly far in the past. That’s honestly kind of scary. I’m getting old, aren’t I?</p>

<hr />

<p>So yea, that’s about it in terms of modding-related questions. I hope you found this post enjoyable. If you did, and if you have more questions for me to answer, you can always reply to the discussion tweet linked right at the end of this post, and if there are enough additional questions, I might make a second one.</p>

<p>Anyway, thanks for reading! ❤</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Method chaining is a concept that is used in a few languages, but especially Java. The idea is that, when you create non-static methods that change certain properties about an object, you make the method return <em>the object itself</em>. This allows for multiple method calls to be done in one line, which is especially useful when creating a system where you apply a bunch of settings to an object. <code class="language-plaintext highlighter-rouge">new Block().setHardness(3).setLightLevel(15);</code> <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Short-circuiting out of methods using <code class="language-plaintext highlighter-rouge">return</code> instead of having a bunch of nested checks <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Minecraft" /><category term="Featured" /><summary type="html"><![CDATA[I asked yall to send me your modding and programming questions on Twitter and Discord, and in this post, I try to answer all of those.]]></summary></entry><entry><title type="html">🔮 The Future of Actually Additions</title><link href="https://ellpeck.de/blog/future_actually_additions/" rel="alternate" type="text/html" title="🔮 The Future of Actually Additions" /><published>2020-11-23T00:00:00+00:00</published><updated>2020-11-23T00:00:00+00:00</updated><id>https://ellpeck.de/blog/future_actually_additions</id><content type="html" xml:base="https://ellpeck.de/blog/future_actually_additions/"><![CDATA[<h2 id="updates-to-this-post">Updates to This Post</h2>
<h3 id="june-2024">June 2024</h3>
<p><strong>The initial version of the 1.20.4 port has been released!</strong> You can find it on <a href="https://modrinth.com/mod/actually-additions/version/1.2.13+mc1.20.4">Modrinth</a> or <a href="https://www.curseforge.com/minecraft/mc-mods/actually-additions/files/5416363">CurseForge</a>. It still has a few features missing and some things are incomplete, but it’s a very good foundation for the future of the mod.</p>

<p>I’d like to once again thank <a href="https://github.com/Flanks255">Flanks</a>, who was essentially the lead developer of the port for the last few months, as well as <a href="https://github.com/Mrbysco">Mrbysco</a> and <a href="https://github.com/MichaelHillcox">MiKeY</a>, who did some amazing porting work, and of course <a href="https://github.com/Ridanisaurus">Ridanisaurus</a>, who made the amazing new artwork for the mod. Yall made this possible. ❤️</p>

<h3 id="march-2024">March 2024</h3>
<p>Development is <a href="https://github.com/Ellpeck/ActuallyAdditions/commits/1.20.4/">happening again</a>! The, frankly, truly mad <a href="https://github.com/Mrbysco">Mrbysco</a> has taken it upon himself to take porting matters into his own hands. <a href="https://github.com/Flanks255">Flanks</a> is also helping. It’s a whole thing. But yay!</p>

<h3 id="november-2023">November 2023</h3>
<p>Honestly, I don’t know anymore. Progress has slowed to a halt, and with all the old-mod-renaissance stuff going on in 1.20, I’m semi-considering getting back into Actually Additions myself. I dunno. Let me know if you’re interested in helping out or whatever.</p>

<h3 id="february-2023">February 2023</h3>
<p>Yes, the port is still being worked on. As pointed out numerous times, you can stay up to date with the port through <a href="https://github.com/Ellpeck/ActuallyAdditions/tree/1.16">the <code class="language-plaintext highlighter-rouge">1.16</code> branch</a>. Do not ask when the port will be finished. We don’t know yet. It’s a big task and the people working on it do so in their free time.</p>

<h3 id="november-2021">November 2021</h3>
<p>The port is still being actively worked on. You can stay up to date with the progress through <a href="https://github.com/Ellpeck/ActuallyAdditions/tree/1.16">the <code class="language-plaintext highlighter-rouge">1.16</code> branch</a> on the GitHub repository.</p>

<h2 id="why">Why?</h2>
<p>Before I start this post, I want to re-iterate that I haven’t had a direct programming-related connection to Actually Additions in <a href="https://github.com/Ellpeck/ActuallyAdditions/commits/main?after=896a082d747a3e19755ded1973544d59fa992787+244">over three years</a>. I don’t plan on changing this. This means that, if you have <em>anything</em> to say about the mod, be it issue reports or feature requests, <strong>do not talk to me about that</strong>. Go to <a href="https://github.com/Ellpeck/ActuallyAdditions/issues">the issue tracker</a> or <a href="https://link.ellpeck.de/discordweb">my Discord</a>’s <code class="language-plaintext highlighter-rouge">#minecraft</code> channel.</p>

<p>Okay, now that that’s out of the way… let’s talk about the future of Actually Additions. In <a href="https://ellpeck.de/blog-actually_additions">my last post</a>, I talked about the things I disliked about the mod and, in that same vein, the reasons that I don’t want it to be updated beyond Minecraft 1.12. What I didn’t necessarily make clear in that post is that this isn’t really my decision, because I haven’t touched Actually Additions in <em>a long time</em>. For the last few years, <strong>Shadows-of-Fire</strong> has been maintaining the mod (that is, fixing issues and publishing updates), which is also the reason that there haven’t been any new features during that time. So what about now?</p>

<h2 id="who">Who?</h2>
<p>A few months ago, Direwolf sent me a message on Discord along the lines of</p>

<blockquote>
  <p>Hey, do you want someone to port Actually Additions? Because I know this really great guy called <a href="https://github.com/MichaelHillcox">MiKeY</a> who really loves porting mods for some reason.</p>
</blockquote>

<p>So, as a result of that, <strong>MiKeY</strong> is basically the new, official maintainer of Actually Additions.</p>

<p>A little while later, another person approached me: <a href="https://github.com/Ridanisaurus">Ridanisaurus</a>, who apparently really likes making beautiful art for mods. He asked me if I want new art for Actually Additions, and since I have some <em>opinions</em> about the current state of Actually Additions’ graphics and visual consistency, I naturally said yes immediately. So yea, <strong>Ridanisaurus</strong> is basically the new, official artist of Actually Additions.</p>

<h2 id="what">What?</h2>
<p>MiKeY and Rid are going to port Actually Additions to <strong>Forge</strong> for <strong>Minecraft 1.16.4</strong>. They are re-doing all of the art for the mod and they will also modify some of the features that I dislike, based on my personal feedback and the information outlined in <a href="https://ellpeck.de/blog-actually_additions">my diss track</a>.</p>

<p>The art overhaul has already started (and even been finished, I believe), and because it is <em>gorgeous</em>, I’m going to show you some of the preview pictures that Rid has sent me right now. Enjoy.</p>

<p><img src="faa_1.png" alt="" /></p>

<p><img src="faa_2.png" alt="" /></p>

<p><img src="faa_3.png" alt="" /></p>

<p>Don’t they look <em>so good</em>?</p>

<h2 id="what-not">What Not?</h2>
<p>Since I know a lot of people will ask questions about this, here is a list of some of the things that you will <strong>not</strong> be getting, no matter how frequently you ask.</p>
<ul>
  <li>We will <em>not</em> be releasing a Fabric version of the mod.</li>
  <li>We will <em>not</em> be releasing 1.13, 1.14 or 1.15 versions of the mod.</li>
  <li>We will <em>not</em> be keeping all of the features in the mod the same, especially not the Storage Crate, which will be getting a major overhaul.</li>
  <li>There will be <em>no</em> entirely new features, only changes to existing ones. Since this has been the case for the last few years as well, I don’t think it’s very surprising.</li>
</ul>

<p>MiKeY has expressed great interest in helping me overhaul the features that I dislike and, as a result, making Actually Additions a better and more refined mod than it used to be.</p>

<h2 id="when">When?</h2>
<p>We don’t know yet. <em>Please</em> don’t ask.</p>

<h2 id="thank-you">Thank You</h2>
<p>So yea, that’s about it for the news. I hope all of you are as excited about the port and the upcoming changes as I am. If you want to be kept up to date with the changes, you can check the <a href="https://github.com/Ellpeck/ActuallyAdditions">GitHub repository</a> every once in a while (specifically <a href="https://github.com/Ellpeck/ActuallyAdditions/tree/1.16">its <code class="language-plaintext highlighter-rouge">1.16</code> branch</a>) and join <a href="https://link.ellpeck.de/discordweb">my Discord server</a>, where we might post some updates from time to time.</p>

<p>As an additional note, I would like to thank all of you for the continued support of not only Actually Additions, but all of my mods and even my non-Minecraft-related projects. Of course, there have also been some rude people, but all in all, yall have been an amazing community and I am so grateful that you enjoy the things I create. I love yall. ❤️</p>]]></content><author><name>Ellpeck</name></author><category term="Minecraft" /><summary type="html"><![CDATA[Not wanting to accept the fate of Actually Additions, someone has come to its rescue. 1.16, here we come?]]></summary></entry><entry><title type="html">🤷 But Do You Really Care?</title><link href="https://ellpeck.de/blog/but_do_you_really_care/" rel="alternate" type="text/html" title="🤷 But Do You Really Care?" /><published>2020-06-05T00:00:00+00:00</published><updated>2020-06-05T00:00:00+00:00</updated><id>https://ellpeck.de/blog/but_do_you_really_care</id><content type="html" xml:base="https://ellpeck.de/blog/but_do_you_really_care/"><![CDATA[<p>Over the years, my views on social media and its purpose have changed many times. When I first started out using the internet, playing Minecraft and watching YouTube videos about it, I didn’t really care about social media in general. Eventually, I created a Twitter account, just to be able to follow people and see their tweets, to see what the people I cared about were… caring about. Eventually, as Discord rolled around, I first just used it to talk to my friends, but I eventually decided that a server would probably be a good idea. So I created the “Ellpeck and Friends” server, which eventually evolved into the server <a href="https://link.ellpeck.de/discordweb">that it is today</a>.</p>

<p>So, the more I used Discord and Twitter, the more… <em>obsessive</em> I became about them. Every time I’d write a tweet, I’d sit there, staring at my screen for the better part of half an hour, seeing if anyone would reply, if anyone would like the tweet, if anyone would retweet, if anyone had an opinion on what I was saying. <em>If anyone approved</em>. Every time I’d say something in my Discord server, I’d actively wait for people to respond. To answer my question, to react to my joke. I wanted to know <em>if anyone approved</em>. Every time I saw that little red dot appear next to the Discord icon in the taskbar, I’d instantly stop whatever I was doing and figuratively <em>run</em> into my server to see what was going on. Did someone need my help? Did someone <em>finally</em> reply to that one message I posted two hours ago? No, it was just a new server member who joined, triggering one of those weird “a new user joined” messages.</p>

<p>But… why? Why would I care so much about who liked my tweet, or who replied to it? Even if my close friends liked it, I would go “AHA, someone approves!”, despite the fact that I <em>know</em> that my friends approve of most of the things I do - that’s kind of what friends just do. Why did I care so much about a stupid message in my stupid Discord server? Why did I <em>desperately</em> want the person that just posted “when will you update Actually Additions to 1.15?” to reply to what I answered? They were just a stranger. It’s not like their opinion actually matters when it comes to me and my life. But somehow, it still mattered <em>to me</em>.</p>

<p>So the other day, I just decided… no. This wasn’t what I was going to do anymore. I wasn’t going to let some dumb, scream-into-the-void social media platforms control my life anymore. So, before bed that night, I quickly deleted Discord and Twitter off of my computer, and off of my phone. Ever since, my phone’s homescreen has had two blatantly visible empty spaces.</p>

<p>It’s been about two weeks since I did that, and… I’ve honestly been feeling really good about it. I started occasionally checking Twitter again, but never just to see notifications or to see if someone replied to any of my tweets. I only ever look at it if I want to tweet, or if I’m curious about what someone else has been tweeting about recently. Last night, I opened Discord from the browser to check if any of my friends have been messaging me there. There were a couple of notifications, which I replied to. I also checked my server, and <em>oh my God</em>, did I feel good about taking a break from that. There were a bunch of messages from people asking about my mods, and how to do certain things. There weren’t any important messages, anything that, if I missed it, would change my life in some way. I didn’t <em>need</em> to be there.</p>

<p>I realized that I shouldn’t care that much what other people think about me; neither on social media, nor in real life. It’s an unnecessary hassle to make sure that everyone loves you, that you don’t make any mistakes, that you only have opinions that other people approve of. The important part is that you approve of <em>yourself</em>, and that the people you care about also care about you.</p>

<p>So… if you’re feeling like there’s a lot of pressure on you whenever you tweet, or send a message in a Discord server, or write a Facebook post, then maybe you should try just not doing that for a little while. It might make you feel a bit better.</p>

<p><em>This post won’t have a discussion link, for obvious reasons.</em></p>]]></content><author><name>Ellpeck</name></author><category term="Miscellaneous" /><summary type="html"><![CDATA[On taking a break from social media]]></summary></entry><entry><title type="html">⛔ Oh God, Please Don’t Port Actually Additions</title><link href="https://ellpeck.de/blog/actually_additions/" rel="alternate" type="text/html" title="⛔ Oh God, Please Don’t Port Actually Additions" /><published>2020-05-10T00:00:00+00:00</published><updated>2020-05-10T00:00:00+00:00</updated><id>https://ellpeck.de/blog/actually_additions</id><content type="html" xml:base="https://ellpeck.de/blog/actually_additions/"><![CDATA[<p>On March 7 of this year, my overwhelmingly popular Minecraft mod Actually Additions <a href="https://www.curseforge.com/minecraft/mc-mods/actually-additions/files/2229705">celebrated its fifth birthday</a>. I personally made my last real contribution to the project <a href="https://github.com/Ellpeck/ActuallyAdditions/commits/main?after=896a082d747a3e19755ded1973544d59fa992787+244">around mid-June 2017</a>, so basically three years ago. Every now and again, though (and by that, I mean almost constantly), I still get asked about the project. The main question I get is: “Will you port Actually Additions to Minecraft 1.15?”</p>

<p>Here’s the short answer: No, I won’t. I haven’t worked on the project in <em>three years</em>. But this post isn’t about that. It’s about why <em>you</em> probably shouldn’t port it either.</p>

<p>I’ve grown a lot in the last five years. Yes, I’ve literally grown in the last five years - I’m 20 years old now. But I’ve also grown as a programmer, and more importantly, as a game designer. In this post, I’m going to reminisce about some features of Actually Additions, tell you why I added them, how I added them and what I’d do differently if I made the mod today. Since I can’t be bothered opening a modpack instance, I’m just going to go off of the information from the <a href="https://ellpeck.de/actaddmanual/">online manual</a> for this list.</p>

<h2 id="actually-additions">“Actually Additions”</h2>
<p>When first starting out with the mod, it was called something like “Some Pretty Techy Stuff”. I realized that was a <em>terrible</em> name choice though, so I changed it to “Some Pretty <em>Random</em> Stuff” pretty quickly. That wasn’t much better, so after some (evidently not very much) consideration, I apparently settled on <em>the worst possible mod name</em>, “Actually Additions”. It makes no grammatical sense unless you add a comma, and it’s annoying to say for me because, as any non-native English speaker knows, saying “Actually” is very hard.</p>

<h2 id="overpowered-items">Overpowered Items</h2>
<p>A lot of items in Actually Additions suffer the exact same problem: They’re <em>balanced because they take effort</em>. What that means is that they’re overpowered beyond belief, because they usually take a somewhat large amount of resources to create (though that isn’t even true for some of them) and then do something crazy at (basically) no cost. All of these items are ones I’d either implement completely differently today, or scrap entirely:</p>
<ul>
  <li>The Fishing Net</li>
  <li>Greenhouse Glass</li>
  <li>The Item Repairer</li>
  <li>The Ring of Growth</li>
</ul>

<h3 id="oh-god-storage-crates">Oh God, Storage Crates</h3>
<p>Why do people love them so much? They make every other mod’s storage options <em>completely worthless</em>. Why they’re not disabled in more modpacks is a complete mystery to me.</p>

<p>I don’t think there’s any code I’ve written in my life that I regret as much as Storage Crates. God, they’re awful.</p>

<h3 id="solar-panels">Solar Panels</h3>
<p>When I first implemented them, I thought passive power generation was perfectly fine. That opinion changed pretty quickly the more I got used to working with RF-based mods and the struggle of trying to balance them against each other. So… I changed solar panels to be ridiculously expensive and only generate 8 RF per tick, which is a rather small amount.</p>

<p>Still, a lot of people kept on using them. <em>Creative</em>.</p>

<p>If you really, <em>really</em> want to port Actually Additions to 1.15, at least remove all of these unbalanced features first. Or at least try to make them less horrible somehow.</p>

<h2 id="phantomfaces">Phantomfaces</h2>
<p>I still, to this day, <em>adore</em> the way I implemented Phantomfaces. They look good, they work well, they have unique functionality, but… <strong>everyone uses them wrong</strong>. They’re not supposed to be a means of item transportation. How could I make them be more restricted to their intended use case? I don’t really know, honestly.</p>

<h2 id="the-coffee-maker">The Coffee Maker</h2>
<p>Etho is my favorite YouTuber of all time, and always has been. When he first used the Coffee Maker in his HermitCraft modded series, I legitimately cried of happiness. Following that point, he made and used it in every modded series that it was available in.</p>

<p>I still think it’s a great block with awesomely unique functionality, and I have been considering implementing something similar in functionality into my newer mod Nature’s Aura.</p>

<h2 id="canola-and-oil">Canola and Oil</h2>
<p>There’s not much to say about the entire canola power generation system other than… I love it. I think it’s a great way to generate power in almost every modpack. It’s easy to set up, it scales well to higher tiers of power generation and it’s a fun thing to automate. It makes me happy to see that a lot of people seem to still agree nowadays.</p>

<h2 id="wings-of-the-bats">Wings of the Bats</h2>
<p>I’m not the <em>biggest</em> fan of creative flight in survival mode anymore in general, but I do like how I implemented the Wings of the Bats. For those of you who don’t know: They have a charge that runs out when you fly with them. If you land on the ground, the charge slowly fills back up again. <em>But</em> if you fly up to the ceiling and hover there for a while, the charge fills up a lot faster than if you were to stand on the ground. Because you’re a bat.</p>

<h2 id="aiots">AIOTS</h2>
<p>…were a huge mistake. “All-In-One-Tools”, originally called something ridiculous like “Paxelordoe” (Pickaxe, Shovel, Sword and Hoe), were pretty much intended to be a better version of Mekanism’s paxels. I like the idea of all-in-one tools in general, but I think they should be later game. I also think they should <em>not</em> have <strong>eight times</strong> the durability of the tools they were made from.</p>

<h2 id="laser-relays">Laser Relays</h2>
<p>Laser Relays were my sorry attempt at copying Immersive Engineering’s awesome wires. Did I succeed in that? No. But did I still make something hella awesome? Yes. As with all of the other things on this list that I actually do like, they scale well and they look good.</p>

<p>I personally especially love the item laser relays, because they can do almost as much as logistics pipes can, minus the request terminal. Do people that use them realize that? Most of the time, no. Is there a way to fix that? Probably, but I don’t know what it is.</p>

<h2 id="the-atomic-reconstructor">The Atomic Reconstructor</h2>
<p>…is awesome, plain and simple. This is one of the features I added surprisingly late in development, probably a year or so after the mod originally came out, if I had to guess. The reason I like it so much is that I’m a huge fan of in-world crafting. It’s less boring than sitting in front of some UI-heavy machine, and it’s more fun to automate too. If I made Actually Additions again today, the Atomic Reconstructor would still be the mod’s centerpiece. Also, the lenses are cool.</p>

<p>The crystals, though… I don’t think I’d want them to work the same nowadays. The names were ridiculous, the textures were weird and the materials used to make them were generic and boring. Actually, I originally picked the ridiculous anagram-ish names specifically because I <em>knew</em> YouTubers would have trouble saying them, and the thought of that was hilarious to me.</p>

<h2 id="lush-caves">Lush Caves</h2>
<p>They don’t fit the mod (because it’s not a biome/world gen mod), so most modpacks disable them. I don’t really understand why, though, because they add so much to the world!</p>

<p>This game desperately needs a cave update.</p>

<h2 id="the-textures">The Textures</h2>
<p>The textures for Actually Additions were created by three separate artists, as well as <em>me</em>, the latter of which is very far from an artist.</p>

<p>That’s why the visual style of the mod is inconsistent and honestly pretty gross. The textures of blocks don’t fit together, most of them are flat and uninspired. The mod doesn’t use that many nice particles and other visual effects to enhance the look and feel of mechanics.</p>

<p>Altogether, when playing the mod now, the texture and overall visual style of the mod make me feel like I’m playing some bizarre combination of old ruins, a tech mod and a confused magic mod.</p>

<h2 id="honorable-ish-mentions">Honorable-ish Mentions</h2>
<p><strong>Black Quartz</strong>. Why didn’t I make it drop the item directly instead of the ore? I don’t know. Weird choice, though.</p>

<p><strong>Smiley Clouds</strong>. God, they’re creepy. Yes, they were just supposed to be a clone of Botania’s Tiny Potato. Were they as well designed? No. Were they as cool? No. Would I ever want them in my life ever again? Definitely not.</p>

<p><strong>Treasure Chests</strong>. I like the feature, but… does anyone even know they exist?</p>

<p><strong>ESDs</strong> were actually one of the first features in the mod. I still like them, though their UI is clunky and hard to understand. If I made Actually Additions today, I’d definitely include them, but with a different name and a cleaner UI.</p>

<p><strong>Experience Solidifiers</strong> are great. I like the solidified experience too, though I know that a lot of modpack makers seem to disagree, as it’s disabled in almost every pack. I’d still want them today, though.</p>

<p><strong>The Feeder</strong> is an almost exact copy of the Railcraft Feeding Station thing, because back in the day, I was so unoriginal that I just stole other people’s content. Yea.</p>

<p><strong>Drills</strong>. Love ‘em. The upgrade system is neat and scales well, they use a good amount of power and they just look <em>so cool</em>.</p>

<p><strong>Balls of Fur</strong> are actually called “hairy balls.” I don’t know if the fact that I <em>didn’t</em> realize that that wasn’t the best name when implementing them makes this whole situation less embarrassing or more embarrassing.</p>

<p><strong>The Empowerer</strong> is still pretty cool in my opinion. I’d probably use it as a crafting mechanic again.</p>

<h2 id="what-do-we-learn-from-this">What Do We Learn From This?</h2>
<p>Well, I don’t know if you learn anything from this, but there’s one thing I learned for sure: I’m a lot better of a programmer and a lot better of a game designer now.</p>

<p>Sure, I’d still consider Actually Additions to be a pretty good mod, and it’s definitely a nice project to be known for. But I don’t think I’d do almost anything in the mod the same way nowadays.</p>

<p>Also, I kind of think that Actually Additions has run its course in some way; it’s lived its life. It’s important to remember that there is a huge amount of new, unexplored mod ideas still out there, and that there are already some great mods that implement unique, new ideas. Shouldn’t we let those mods step into the spotlight now?</p>]]></content><author><name>Ellpeck</name></author><category term="Minecraft" /><summary type="html"><![CDATA[As Actually Additions celebrates its fifth birthday, I break down what I like and dislike about it.]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 7: Overriding Methods</title><link href="https://ellpeck.de/blog/java_7/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 7: Overriding Methods" /><published>2019-11-26T00:00:00+00:00</published><updated>2019-11-26T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_7</id><content type="html" xml:base="https://ellpeck.de/blog/java_7/"><![CDATA[<p>So it’s been a hot minute since the last tutorial, and I apologize for that. However, it seems like there are some people that actually use these tutorials to properly learn Java, and so I didn’t want to leave you all hanging.</p>

<p>Today’s tutorial is going to cover method overrides, which are another awesome object orientation concept that will help you out greatly when programming.</p>

<p>Let’s imagine that we want our different vehicle types (<code class="language-plaintext highlighter-rouge">Car</code> and <code class="language-plaintext highlighter-rouge">Truck</code>) from the last tutorial to be able to print out some information about themselves to the console. To do so, we could simply add a <code class="language-plaintext highlighter-rouge">printInformation()</code> method to each of the classes. However, that would end up being problematic if we wanted to print out information about <em>the entirety of our stock</em>, which, as you might recall, is stored in our <code class="language-plaintext highlighter-rouge">ArrayList&lt;Vehicle&gt; stock</code>, as we would have to create <code class="language-plaintext highlighter-rouge">instanceof</code> checks for both <code class="language-plaintext highlighter-rouge">Car</code> and <code class="language-plaintext highlighter-rouge">Truck</code> to be able to access their <code class="language-plaintext highlighter-rouge">printInformation()</code> methods.</p>

<p>An easy fix for that would be to create a basic <code class="language-plaintext highlighter-rouge">printInformation()</code> method in our base class (<code class="language-plaintext highlighter-rouge">Vehicle</code>) and then <em>override</em> that method in our subclasses, allowing us to change their behavior. Let’s see what that would look like:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Vehicle.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Vehicle</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printInformation</span><span class="o">()</span> <span class="o">{</span>
        <span class="c1">// Does nothing for now</span>
    <span class="o">}</span>
<span class="o">}</span>

<span class="c1">// Car.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Car</span> <span class="kd">extends</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="nf">Car</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">(</span><span class="n">amountOfWheels</span><span class="o">);</span>
    <span class="o">}</span>

    <span class="nd">@Override</span>
    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printInformation</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This car has "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">+</span> <span class="s">" wheels"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, I’ve added a simple <code class="language-plaintext highlighter-rouge">printInformation()</code> method to the <code class="language-plaintext highlighter-rouge">Vehicle</code> class (which does absolutely nothing for now). However, I have then <em>overridden</em> that method in the <code class="language-plaintext highlighter-rouge">Car</code> class. The way I’ve done that is by adding a method that has the exact same name, return type and accepted parameters as the base class’s method. Technically, that would already be enough to override a method, however, to make it a little clearer to read, people usually like to add the <code class="language-plaintext highlighter-rouge">@Override</code> annotation<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> above the method.</p>

<p>So what does this mean, exactly? Basically, when calling the <code class="language-plaintext highlighter-rouge">printInformation()</code> method on an instance of the <code class="language-plaintext highlighter-rouge">Vehicle</code> class, nothing will happen, because the <code class="language-plaintext highlighter-rouge">Vehicle</code>’s method is empty. However, when calling the method on an instance of the <code class="language-plaintext highlighter-rouge">Car</code> class, the print statement above will be executed, printing information about the car’s wheel amount.</p>

<p>The important thing to understand is this: Which class’s method is called isn’t determined by the <em>variable type</em>, but by the type that the object itself has. Let’s check out this example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// This is in our Main class from last time</span>
<span class="kd">private</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">getTrucks</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">stock</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
        <span class="nc">Vehicle</span> <span class="n">vehicle</span> <span class="o">=</span> <span class="n">stock</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">);</span>
        <span class="n">vehicle</span><span class="o">.</span><span class="na">printInformation</span><span class="o">();</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Now, each vehicle that isn’t a car (so each truck in ou example) will not print out any information, but each of our cars will print out the information we specified above, despite the fact that we’re not doing any <code class="language-plaintext highlighter-rouge">instanceof</code> checks or anything else. Cool.</p>

<h2 id="calling-super-methods">Calling <code class="language-plaintext highlighter-rouge">super</code> methods</h2>
<p>Now, if we wanted to also add an override of the <code class="language-plaintext highlighter-rouge">printInformation()</code> method to our <code class="language-plaintext highlighter-rouge">Truck</code> class, we will come across a minor annoyance: To print out the truck’s amount of wheels, we’d basically have to copy the print statement from our <code class="language-plaintext highlighter-rouge">Car</code> class, which is a bit ugly.</p>

<p>Well, that’s where <code class="language-plaintext highlighter-rouge">super</code> calls come to the rescue! We’ve already briefly touched on super calls when talking about the super constructor for extending other classes, and super calls are very similar to that. Let’s change our code up a bit, and then I’ll explain what it all means.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Vehicle.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Vehicle</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printInformation</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Vehicle info:"</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Wheel amount: "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>

<span class="c1">// Car.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Car</span> <span class="kd">extends</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="nf">Car</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">(</span><span class="n">amountOfWheels</span><span class="o">);</span>
    <span class="o">}</span>

    <span class="nd">@Override</span>
    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printInformation</span><span class="o">()</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">.</span><span class="na">printInformation</span><span class="o">();</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, I’ve modified the <code class="language-plaintext highlighter-rouge">Vehicle</code>’s method to print out the wheel amount by default, and I’ve changed the <code class="language-plaintext highlighter-rouge">Car</code>’s method to call <code class="language-plaintext highlighter-rouge">super.printInformation()</code>. What this call does is simply execute its parent class’s <code class="language-plaintext highlighter-rouge">printInformation()</code> method, so a car will also have its wheel amount printed out just the same as any other vehicle.</p>

<p>It should be noted that simply calling the <code class="language-plaintext highlighter-rouge">super</code> method in an override and doing absolutely nothing else is <em>the default behavior</em>, meaning that, in the example above, we could leave out the <code class="language-plaintext highlighter-rouge">printInformation()</code> override in our <code class="language-plaintext highlighter-rouge">Car</code> class completely and still get the same effect.</p>

<p>Now let’s add a <code class="language-plaintext highlighter-rouge">printInformation()</code> override to our <code class="language-plaintext highlighter-rouge">Truck</code> class as well, but this time, let’s extend the behavior a bit:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Truck</span> <span class="kd">extends</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">storageArea</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Truck</span><span class="o">(</span><span class="kt">int</span> <span class="n">storageArea</span><span class="o">)</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span>
        <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span> <span class="o">=</span> <span class="n">storageArea</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="nd">@Override</span>
    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printInformation</span><span class="o">()</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">.</span><span class="na">printInformation</span><span class="o">();</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Storage area: "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Now, calling a truck’s <code class="language-plaintext highlighter-rouge">printInformation()</code> method will <em>first</em> print out “Vehicle information:”, then the wheel amount, and then the storage area. If we wanted this behavior to occur in a different order, we could simply swap the two lines as follows:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nd">@Override</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">printInformation</span><span class="o">()</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Storage area: "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span><span class="o">);</span>
    <span class="kd">super</span><span class="o">.</span><span class="na">printInformation</span><span class="o">();</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Now, the storage area will be printed out <em>first</em>, followed by “Vehicle information:” and the wheel amount.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<h2 id="object-methods"><code class="language-plaintext highlighter-rouge">Object</code> methods</h2>
<p>As I briefly mentioned in the last tutorial, <em>all</em> classes implicitly extend Java’s <code class="language-plaintext highlighter-rouge">Object</code> class without you having to specify that information. This is finally going to be useful now, as this class provides some useful methods that we can override in our implementations.</p>

<h3 id="tostring"><code class="language-plaintext highlighter-rouge">toString()</code></h3>
<p>This method is probably the most versatile one of the bunch: It gets called whenever an object’s information needs to be converted into a string in some circumstance. For example, if you simply write</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Car</span> <span class="n">car</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Car</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">car</span><span class="o">);</span>
</code></pre></div></div>
<p>then the car’s <code class="language-plaintext highlighter-rouge">toString()</code> method will be called inside of <code class="language-plaintext highlighter-rouge">println</code> in order to convert the car’s information into a string.</p>

<p>However, by default, the <code class="language-plaintext highlighter-rouge">toString()</code> method simply prints out some not-so-useful information about the object’s internal identifier. If we override this method, however, we can make it display some more useful information. Let’s do so in our <code class="language-plaintext highlighter-rouge">Vehicle</code> and <code class="language-plaintext highlighter-rouge">Car</code> class as an example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Vehicle.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Vehicle</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="nd">@Override</span>
    <span class="kd">public</span> <span class="nc">String</span> <span class="nf">toString</span><span class="o">()</span> <span class="o">{</span>
        <span class="k">return</span> <span class="s">"Vehicle with "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">+</span> <span class="s">" wheels"</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>

<span class="c1">// Truck.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Truck</span> <span class="kd">extends</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">storageArea</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Truck</span><span class="o">(</span><span class="kt">int</span> <span class="n">storageArea</span><span class="o">)</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span>
        <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span> <span class="o">=</span> <span class="n">storageArea</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="nd">@Override</span>
    <span class="kd">public</span> <span class="nc">String</span> <span class="nf">toString</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">String</span> <span class="n">vehicleInfo</span> <span class="o">=</span> <span class="kd">super</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span>
        <span class="k">return</span> <span class="n">vehicleInfo</span> <span class="o">+</span> <span class="s">" and "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span> <span class="o">+</span> <span class="s">" storage area"</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, <code class="language-plaintext highlighter-rouge">Truck</code> additionally calls the <code class="language-plaintext highlighter-rouge">toString()</code> super method and then appends some more information to the string created in <code class="language-plaintext highlighter-rouge">Vehicle</code>. Pretty nice.</p>

<h3 id="equals"><code class="language-plaintext highlighter-rouge">equals()</code></h3>
<p>Remember how I told you that you should always use <code class="language-plaintext highlighter-rouge">equals()</code> to compare two strings instead of the double equals sign <code class="language-plaintext highlighter-rouge">==</code>?</p>

<p>Well, here’s why: Java’s <code class="language-plaintext highlighter-rouge">String</code> class overrides the <code class="language-plaintext highlighter-rouge">equals()</code> method from <code class="language-plaintext highlighter-rouge">Object</code> and changes its behavior so that two strings are considered equal if their contents are identical.</p>

<p>As an example, let’s first override the <code class="language-plaintext highlighter-rouge">equals()</code> method in our <code class="language-plaintext highlighter-rouge">Vehicle</code> class with the default behavior that it would have if you didn’t override it at all:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nd">@Override</span>
<span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">equals</span><span class="o">(</span><span class="nc">Object</span> <span class="n">other</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="k">this</span> <span class="o">==</span> <span class="n">other</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, the default behavior is simply the double equals sign <code class="language-plaintext highlighter-rouge">==</code>, which compares if two variable pointers point to the exact same object, as previously explained. That’s not what we might want in our example, though.</p>

<p>Let’s expand our <code class="language-plaintext highlighter-rouge">Vehicle</code> class to also have a unique identifier: The license plate’s text. Let’s say that we want to identify each vehicle by its plate, and so we make it the key factor in determining whether two vehicles are the same or not:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="kd">public</span> <span class="nc">String</span> <span class="n">licensePlate</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Vehicle</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">,</span> <span class="nc">String</span> <span class="n">licensePlate</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="na">licensePlate</span> <span class="o">=</span> <span class="n">licensePlate</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="nd">@Override</span>
    <span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">equals</span><span class="o">(</span><span class="nc">Object</span> <span class="n">other</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(</span><span class="n">other</span> <span class="k">instanceof</span> <span class="nc">Vehicle</span><span class="o">)</span> <span class="o">{</span>
            <span class="nc">Vehicle</span> <span class="n">v</span> <span class="o">=</span> <span class="o">(</span><span class="nc">Vehicle</span><span class="o">)</span> <span class="n">other</span><span class="o">;</span>
            <span class="k">return</span> <span class="n">v</span><span class="o">.</span><span class="na">licensePlate</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="na">licensePlate</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, each <code class="language-plaintext highlighter-rouge">Vehicle</code> now accepts a license plate in the constructor, and the <code class="language-plaintext highlighter-rouge">equals()</code> method is overridden in a way that makes two vehicles be considered equal if their license plates match exactly.</p>

<p>Now, a great example of how this could be useful is with lists. The <code class="language-plaintext highlighter-rouge">ArrayList</code> class contains the <code class="language-plaintext highlighter-rouge">contains()</code> method, which determines if a certain element is already present in the list. Now, the cool thing is that this method uses the <code class="language-plaintext highlighter-rouge">equals()</code> method on each element to determine whether or not an element is present. We can use this behavior to check if a vehicle with a certain license plate is already in our stock pretty easily:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">java.util.ArrayList</span><span class="o">;</span>

<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">private</span> <span class="kd">static</span> <span class="nc">ArrayList</span><span class="o">&lt;</span><span class="nc">Vehicle</span><span class="o">&gt;</span> <span class="n">stock</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ArrayList</span><span class="o">&lt;&gt;();</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="n">stock</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="nc">Car</span><span class="o">(</span><span class="mi">4</span><span class="o">,</span> <span class="s">"AC JS 1999"</span><span class="o">));</span>
        <span class="n">stock</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="nc">Truck</span><span class="o">(</span><span class="mi">10</span><span class="o">,</span> <span class="s">"AC NS 1998"</span><span class="o">));</span>

        <span class="nc">Car</span> <span class="n">carToCheck</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Car</span><span class="o">(</span><span class="mi">4</span><span class="o">,</span> <span class="s">"AC HI 1234"</span><span class="o">);</span>
        <span class="k">if</span> <span class="o">(</span><span class="n">stock</span><span class="o">.</span><span class="na">contains</span><span class="o">(</span><span class="n">carToCheck</span><span class="o">))</span> <span class="o">{</span>
            <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"The queried car is already in our stock :)"</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Obviously, in this specific example, the text won’t be printed because there isn’t a car with that license plate in the <code class="language-plaintext highlighter-rouge">stock</code> list.</p>

<h2 id="conclusion">Conclusion</h2>
<p>So yea, today you learned about the second key concept of object orientation in Java. To put this knowledge to the test, I’m going to give you an exercise all about extending classes and overriding methods that you can try to solve if you want.</p>

<blockquote>
  <p>Let’s imagine you’re trying to create a program that allows you to draw manage different shapes, namely rectangles, right angle triangles and circles. Obviously, these shapes all have different properties, like the rectangle’s and triangle’s side lengths and the circle’s radius. All of the shapes you currently have are stored in a list. For each of the shapes, you want to be able to calculate its circumference as well as its area. To test this program, you add a couple of shapes to your list and calculate the average of all of their areas and circumferences.</p>
</blockquote>

<p>Note that you can find some methods and constants you might need in Java’s default <code class="language-plaintext highlighter-rouge">Math</code> class, namely <code class="language-plaintext highlighter-rouge">Math.PI</code> and <code class="language-plaintext highlighter-rouge">Math.sqrt()</code>, the latter of which is used to calculate a square root. If you’re stuck, you can <a href="https://gist.github.com/Ellpeck/8cf63c747313e070b7475d99e2bed5a1">check my solution</a>.</p>

<p>As always, happy coding!</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Annotations are another rather advanced topic that almost never comes up when using Java. They can be useful sometimes, but you’ll hardly ever have a use for them. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Which, in this case, would obviously be a bit of a nonsensical order to display this information in. But you get the idea. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[In this Java tutorial for beginners, we cover overriding methods, calling superclass methods and toString().]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 6: Inheritance</title><link href="https://ellpeck.de/blog/java_6/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 6: Inheritance" /><published>2019-10-31T00:00:00+00:00</published><updated>2019-10-31T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_6</id><content type="html" xml:base="https://ellpeck.de/blog/java_6/"><![CDATA[<p>For this tutorial, let’s expand on the car dealership example from the end of the last tutorial: You have a car dealership, and you want to expand it to sell various other types of motor vehicles; let’s say… motorbikes and trucks as well. Obviously, these different kinds of vehicles all have different properties: A motorbike requires the use of a helmet, and an important piece of information about a truck might be how big its storage area is.</p>

<p>Now, this is where object-oriented languages like Java shine.</p>

<h2 id="extending-other-classes">Extending Other Classes</h2>
<p>The concept of extending other classes is probably best explained with an example, so to start out with, let’s create a class that represents a car with a certain amount of wheels:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Car</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Car</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, this is just a simple class with a variable that can store how many wheels a vehicle has.</p>

<p>Now, let’s imagine we want to create a class that represents a truck, and we would want any truck to store information on how many wheels it has, as well as how many cubic meters of storage it has available:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Truck</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">storageArea</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Truck</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">,</span> <span class="kt">int</span> <span class="n">storageArea</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
        <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span> <span class="o">=</span> <span class="n">storageArea</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, just creating the class like usual isn’t really that pretty, because now both our <code class="language-plaintext highlighter-rouge">Car</code> class and our <code class="language-plaintext highlighter-rouge">Truck</code> class have separate <code class="language-plaintext highlighter-rouge">amountOfWheels</code> fields, despite the fact that they really refer to the same thing: The amount of wheels of a vehicle.</p>

<p>What we’d like to be able to do instead is to have the amount of wheels stored in a different location that both our <code class="language-plaintext highlighter-rouge">Truck</code> and our <code class="language-plaintext highlighter-rouge">Car</code> class can access. The first step of achieving this is creating another class that only stores information both of our vehicles should have:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Vehicle</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">amountOfWheels</span> <span class="o">=</span> <span class="n">amountOfWheels</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Now, we can use the <code class="language-plaintext highlighter-rouge">extends</code> keyword that Java provides to cause both of our other classes to also have access to this information. Let’s modify our <code class="language-plaintext highlighter-rouge">Car</code> class first and I’ll explain afterwards what exactly our modification will do.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Car</span> <span class="kd">extends</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="nf">Car</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">)</span> <span class="o">{</span>
        <span class="c1">// Note that the line below will be explained in a bit</span>
        <span class="kd">super</span><span class="o">(</span><span class="n">amountOfWheels</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, our <code class="language-plaintext highlighter-rouge">Car</code> class now <code class="language-plaintext highlighter-rouge">extends Vehicle</code>. This means that the <code class="language-plaintext highlighter-rouge">Car</code> class is basically just an <em>upgraded</em> version of the <code class="language-plaintext highlighter-rouge">Vehicle</code> class: It contains all of the information that the <code class="language-plaintext highlighter-rouge">Vehicle</code> class provides (including fields and methods), but it can also provide its own additional information. From the perspective of <code class="language-plaintext highlighter-rouge">Car</code>, <code class="language-plaintext highlighter-rouge">Vehicle</code> is the <em>superclass</em>, and from the perspective of <code class="language-plaintext highlighter-rouge">Vehicle</code>, <code class="language-plaintext highlighter-rouge">Car</code> is a <em>child class</em>.</p>

<p>It should be noted that any class can only extend <em>one</em> other class, so <code class="language-plaintext highlighter-rouge">Car</code> couldn’t extend both <code class="language-plaintext highlighter-rouge">Vehicle</code> and, let’s say, <code class="language-plaintext highlighter-rouge">FueledDevice</code>. However, the other way around is possible: <code class="language-plaintext highlighter-rouge">Vehicle</code> can be extended by multiple classes, meaning that we can modify our <code class="language-plaintext highlighter-rouge">Truck</code> class to also be a child class like this:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Truck</span> <span class="kd">extends</span> <span class="nc">Vehicle</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">storageArea</span><span class="o">;</span>

    <span class="kd">public</span> <span class="nf">Truck</span><span class="o">(</span><span class="kt">int</span> <span class="n">amountOfWheels</span><span class="o">,</span> <span class="kt">int</span> <span class="n">storageArea</span><span class="o">)</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">(</span><span class="n">amountOfWheels</span><span class="o">);</span>
        <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span> <span class="o">=</span> <span class="n">storageArea</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, the <code class="language-plaintext highlighter-rouge">Truck</code> class now uses the <code class="language-plaintext highlighter-rouge">amountOfWheels</code> field from its superclass, but it defines its own <code class="language-plaintext highlighter-rouge">storageArea</code> field that only trucks have.</p>

<h3 id="super"><code class="language-plaintext highlighter-rouge">super</code></h3>
<p>Now, you’ve probably been wondering what line 5 means: <code class="language-plaintext highlighter-rouge">super(amountOfWheels)</code>. As we defined earlier, our <code class="language-plaintext highlighter-rouge">Vehicle</code> class takes one argument in its constructor: The amount of wheels that it has. As we also previously discussed, a constructor <em>has to be called</em> when a new object is created. So, when creating a <code class="language-plaintext highlighter-rouge">Truck</code> object, the <code class="language-plaintext highlighter-rouge">Truck</code> constructor is called, but, in turn, it needs to also implicitly call the <code class="language-plaintext highlighter-rouge">Vehicle</code> constructor.</p>

<p>When placing a <code class="language-plaintext highlighter-rouge">super()</code> call at the start of the constructor of a class, the constructor of the class that is being extended will be called. If that class takes a set of arguments in its constructor, we have to pass it those arguments, similarly to if we were creating an object of that class.</p>

<p>That’s what our <code class="language-plaintext highlighter-rouge">super(amountOfWheels)</code> is doing here: It’s calling the constructor of <code class="language-plaintext highlighter-rouge">Vehicle</code> with the <code class="language-plaintext highlighter-rouge">amountOfWheels</code> argument.</p>

<p>It should be noted that we don’t <em>necessarily</em> have to pass a variable into the super constructor. For instance, we know for a fact that a truck will always have four wheels, so we can modify our <code class="language-plaintext highlighter-rouge">Truck</code> constructor to always specify 4 as the wheel amount given to the superclass:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="nf">Truck</span><span class="o">(</span><span class="kt">int</span> <span class="n">storageArea</span><span class="o">)</span> <span class="o">{</span>
    <span class="kd">super</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span>
    <span class="k">this</span><span class="o">.</span><span class="na">storageArea</span> <span class="o">=</span> <span class="n">storageArea</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>

<h3 id="the-object-class">The <code class="language-plaintext highlighter-rouge">Object</code> class</h3>
<p>It should be noted at this point that <em>all classes</em> extend the <code class="language-plaintext highlighter-rouge">Object</code> class implicitly (meaning you never have to write <code class="language-plaintext highlighter-rouge">extends Object</code> anywhere and it will still hold true). This will be useful pretty soon.</p>

<h3 id="about-variable-types">About Variable Types</h3>
<p>Let’s imagine we want to store the stock that we sell at our dealership, without specifying separate lists for the different kinds of vehicles we’re selling. What we can do is have that variable be of type <code class="language-plaintext highlighter-rouge">Vehicle</code>, which will automatically allow instances of child classes to be stored in the variable (or list) like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">ArrayList</span><span class="o">&lt;</span><span class="nc">Vehicle</span><span class="o">&gt;</span> <span class="n">stock</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ArrayList</span><span class="o">&lt;&gt;();</span>
<span class="n">stock</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="nc">Car</span><span class="o">(</span><span class="mi">4</span><span class="o">));</span>
<span class="n">stock</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="nc">Truck</span><span class="o">(</span><span class="mi">10</span><span class="o">));</span>

<span class="c1">// or in the case of variables</span>
<span class="nc">Vehicle</span> <span class="n">car</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Car</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span>
<span class="nc">Vehicle</span> <span class="n">truck</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Truck</span><span class="o">(</span><span class="mi">10</span><span class="o">);</span>
</code></pre></div></div>

<h2 id="instanceof-and-type-casting"><code class="language-plaintext highlighter-rouge">instanceof</code> and Type Casting</h2>
<p>Staying with our list of the stock we have, let’s imagine we want to find all of the <em>trucks</em> that we have in stock, disregarding any other kinds of vehicles that we might have.</p>

<p>This is what the <code class="language-plaintext highlighter-rouge">instanceof</code> keyword can be used for: Using it, you can ask any object if it derives of a certain class; that is, if any object is an instance of the specified class.</p>

<p>Let’s create a method to return a list of all of the cars we have in stock:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">java.util.ArrayList</span><span class="o">;</span>

<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">private</span> <span class="kd">static</span> <span class="nc">ArrayList</span><span class="o">&lt;</span><span class="nc">Vehicle</span><span class="o">&gt;</span> <span class="n">stock</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ArrayList</span><span class="o">&lt;&gt;();</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="n">stock</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="nc">Car</span><span class="o">(</span><span class="mi">4</span><span class="o">));</span>
        <span class="n">stock</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="nc">Truck</span><span class="o">(</span><span class="mi">10</span><span class="o">));</span>
        <span class="n">getTrucks</span><span class="o">();</span>
    <span class="o">}</span>

    <span class="kd">private</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">getTrucks</span><span class="o">()</span> <span class="o">{</span>
        <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">stock</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
            <span class="nc">Vehicle</span> <span class="n">vehicle</span> <span class="o">=</span> <span class="n">stock</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">);</span>
            <span class="k">if</span> <span class="o">(</span><span class="n">vehicle</span> <span class="k">instanceof</span> <span class="nc">Truck</span><span class="o">)</span> <span class="o">{</span>
                <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Vehicle "</span> <span class="o">+</span> <span class="n">i</span> <span class="o">+</span> <span class="s">" is a truck!"</span><span class="o">);</span>
            <span class="o">}</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, I’ve expanded the code from before to have a <code class="language-plaintext highlighter-rouge">getTrucks</code> method, which iterates through every vehicle we have in stock and if it finds a vehicle that is an instance of the <code class="language-plaintext highlighter-rouge">Truck</code> class, it will print out a message.</p>

<p>Another way to think about the <code class="language-plaintext highlighter-rouge">instanceof</code> keyword is as a weird, clunky synonym to the word “is”: When asking <code class="language-plaintext highlighter-rouge">vehicle instanceof Truck</code>, we’re really asking “Is this vehicle a truck?”</p>

<p>Now that we know which of the vehicles we have in stock are trucks, it might also be useful to know the storage capabilities of all of those trucks. However, as you can see, the <code class="language-plaintext highlighter-rouge">i</code>th vehicle we’re currently inspecting is always of typ <code class="language-plaintext highlighter-rouge">Vehicle</code>, as that’s what we store in the <code class="language-plaintext highlighter-rouge">stock</code> list. That means that we won’t be able to access any <code class="language-plaintext highlighter-rouge">Truck</code>’s <code class="language-plaintext highlighter-rouge">storageArea</code> variable. That’s what the concept of <em>type casting</em> can be used for.</p>

<p>If you have a variable of a certain type, but you know for a fact that it’s actually an instance of a <em>child class</em> of that type, then you can change that variable to be of the child class’ type instead like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Vehicle</span> <span class="n">vehicle</span> <span class="o">=</span> <span class="n">stock</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="n">vehicle</span> <span class="k">instanceof</span> <span class="nc">Truck</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">Truck</span> <span class="n">truck</span> <span class="o">=</span> <span class="o">(</span><span class="nc">Truck</span><span class="o">)</span> <span class="n">vehicle</span><span class="o">;</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"The "</span> <span class="o">+</span> <span class="n">i</span> <span class="o">+</span> <span class="s">"th truck can store "</span> <span class="o">+</span> <span class="n">truck</span><span class="o">.</span><span class="na">storageArea</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, to type cast a variable into a different type, all you have to do is write that type in parentheses <code class="language-plaintext highlighter-rouge">()</code> in front of the variable.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> Cool.</p>

<h2 id="conclusion">Conclusion</h2>
<p>So today, you learned one of the important aspects of object oriented programming, which is very useful in a heap of different scenarios, as you will be able to see throughout the next tutorials. Next time, we’ll be covering overriding methods from superclasses, which will allow you to do even more cool stuff with inheritance.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<p>I’m sorry that I’ve been taking such a long break from the tutorials, but after asking on Twitter if you people actually learn from them, a lot of you said that you do, and so that gave me the motivation to continue working on these.</p>

<p>So thanks a lot, and happy coding! &lt;3</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>As you might be able to see now, this concept is called type <em>casting</em> because it’s like we’re putting the vehicle into a mold (or a <em>cast</em>) to reshape it into a different type. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>I was originally planning on including that in this tutorial already, but I noticed that that might be a bit too much after all, so I’ll be doing it next time instead. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[In this Java tutorial for beginners, we cover classes extending other classes and the instanceof keyword.]]></summary></entry><entry><title type="html">😢 Lows</title><link href="https://ellpeck.de/blog/lows/" rel="alternate" type="text/html" title="😢 Lows" /><published>2019-10-20T00:00:00+00:00</published><updated>2019-10-20T00:00:00+00:00</updated><id>https://ellpeck.de/blog/lows</id><content type="html" xml:base="https://ellpeck.de/blog/lows/"><![CDATA[<p>So some of you might be disappointed that this <em>isn’t</em> the next Java tutorial. Well, today and the last couple of days, I haven’t been feeling like working on those, because.. I’ve been depressed again. I never know how to describe it, or how to say it without seeming like it’s just.. something I say when I’m too lazy to work on things.</p>

<p>This post will probably be a little all over the place, because that’s also the mood that my head is currently in, but I’ll try to explain to you what it feels like to me to have a low low follow a high high, mood-wise.</p>

<h2 id="highs">Highs</h2>
<p>When I say that I’m depressed, it means something different than when I say that I’m suffering from depression. Because, for me, depression isn’t a constant state. Before depression hits, I have long periods of highs, long periods of what non-depressed people would probably just call.. normal moods.</p>

<p>I get up in the mornings, I enjoy breakfast, I go to University, I do my daily chores, I sit down at my computer, I code, I play some games, and then I go to bed. Normal days, really.</p>

<p>And if you don’t suffer from depression, then you might think “Well, what’s so special about that?”, and the annoying thing is: That’s <em>exactly</em> what I also think when I’m experiencing a high. I take it for granted, and I never even stop to think about how great it is that I’m currently feeling normal about my life.</p>

<h2 id="lows">Lows</h2>
<p>And then a low hits. And the longer the high has been going on for, the longer I was happy for, the harder it hits. Right now, I’ve been feeling low for two days, after a high that lasted almost <em>a month</em>. When I’m going through a low phase like now, my day works a lot differently.</p>

<p>I wake up at noon. I stay in bed. I check my phone. Hours pass. I think to myself “What am I doing?” I check my phone. After a while, I force myself to get up; I might even take a shower. I find some cookies in the back of my fridge; those’ll be good enough for breakfast, I think to myself. I sit down at my computer. I watch some videos. “What am I doing?” Maybe some more videos. “What am I doing? I don’t know what to do.” I start Minecraft. “This sounds like fun!” I play for five minutes. I close the game again. “What am I doing?” I watch some videos. I start The Sims 4. I play for half an hour, and then I close the game again. “What am I doing?” I watch some more YouTube videos. I listen to some music. Should I do my coursework now? Not in the mood. I open IntelliJ. Let’s work on some code. I glance at a couple of files, and then I close it again. “What am I doing?”</p>

<p>Take that whole description, and slow it down by about 200%. That’s what a low day feels like to me. I feel like every single hour; every single <em>minute</em> even, is filled with doubt and emptiness and just… nothing.</p>

<p>This is so hard to explain for me because I also don’t.. see myself in these low phases. I don’t look at myself. I don’t observe what I’m doing. It’s like I’m not even there; it’s like I’m not inside my own body, doing these activities with it. It’s like it’s just doing everything on some sort of weird auto-pilot mode.</p>

<p>So until that passes, I probably won’t be working on any tutorials, or anything, really. Let’s hope it passes fairly soon, because I’m honestly sick of forcing myself to eat cookies for breakfast. It might sound great, but eating something when you have absolutely no desire to eat things is… quite unpleasant, really.</p>]]></content><author><name>Ellpeck</name></author><category term="Miscellaneous" /><summary type="html"><![CDATA[About depression and what it feels like when I don't know what to do with myself]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 5: Things I Left Out So Far</title><link href="https://ellpeck.de/blog/java_5/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 5: Things I Left Out So Far" /><published>2019-10-17T00:00:00+00:00</published><updated>2019-10-17T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_5</id><content type="html" xml:base="https://ellpeck.de/blog/java_5/"><![CDATA[<p>After that complicated stuff we did in the last tutorial, how about we take it down a notch in this one and talk about some additional things that I haven’t mentioned this far, but that will still be very useful to you as a programmer. Most of these things won’t really have much connection to each other, but I’ll give you an example at the end of this tutorial that combines some of them into a single use case.</p>

<h2 id="shorthands">Shorthands</h2>
<p>Java has some shorthands to make addition and other mathematical operations faster. As there isn’t really that much to explain (they’re really just vocabulary), here’s a list of them:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// These two statements are equivalent</span>
<span class="c1">// (This also works with all other math operators)</span>
<span class="n">i</span> <span class="o">=</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">2</span><span class="o">;</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">2</span><span class="o">;</span> 

<span class="c1">// When adding or subtracting 1, you can just do this:</span>
<span class="n">i</span><span class="o">++;</span>
<span class="n">i</span><span class="o">--;</span>
</code></pre></div></div>

<h2 id="primitive-types">Primitive Types</h2>
<p>Primitive types (also called <em>native types</em>) are variable types in a language that are baked into the very foundation of the language. That means they don’t derive from a class, but they just exist as part of the language itself. The two primitive types you already know are <code class="language-plaintext highlighter-rouge">int</code> (32 bit integers) and <code class="language-plaintext highlighter-rouge">boolean</code> (<code class="language-plaintext highlighter-rouge">true</code> and <code class="language-plaintext highlighter-rouge">false</code>). In Java, primitive types always start with a lowercase letter (instead of an uppercase letter for classes).</p>

<p>Along with <code class="language-plaintext highlighter-rouge">int</code> and <code class="language-plaintext highlighter-rouge">boolean</code>, there are some more primitive types that could come in useful when programming. Here are the ones I haven’t mentioned yet, quickly summed up:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// "char" represents a single character.</span>
<span class="c1">// Characters use single quotes ' rather than double quotes " (which are reserved for strings).</span>
<span class="kt">char</span> <span class="n">character</span> <span class="o">=</span> <span class="sc">'A'</span><span class="o">;</span>
<span class="kt">char</span> <span class="n">fourthChar</span> <span class="o">=</span> <span class="s">"Hello World"</span><span class="o">.</span><span class="na">charAt</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span> <span class="c1">// o</span>

<span class="c1">// "double" represents a 64bit floating point number</span>
<span class="c1">// which is a number with a decimal point</span>
<span class="c1">// It's called a double because it has double the precision of float (see below)</span>
<span class="kt">double</span> <span class="n">d</span> <span class="o">=</span> <span class="mf">3.14</span><span class="o">;</span>

<span class="c1">// "float" represents a 32bit floating point number (less precise than double).</span>
<span class="c1">// To differentiate floats from doubles and ints, you have to append an "F".</span>
<span class="kt">float</span> <span class="n">f</span> <span class="o">=</span> <span class="mf">12.5</span><span class="no">F</span><span class="o">;</span>

<span class="c1">// "long" represents a 64bit integer (which can store a lot higher numbers than int)</span>
<span class="c1">// To differentiate longs from ints, you have to append an "L".</span>
<span class="kt">long</span> <span class="n">l</span> <span class="o">=</span> <span class="mi">9223372036854775807L</span><span class="o">;</span>

<span class="c1">// "short" represents a 16bit integer</span>
<span class="kt">short</span> <span class="n">s</span> <span class="o">=</span> <span class="mi">32767</span><span class="o">;</span>

<span class="c1">// "byte" represents an 8bit integer</span>
<span class="kt">byte</span> <span class="n">b</span> <span class="o">=</span> <span class="mi">127</span><span class="o">;</span>
</code></pre></div></div>

<h3 id="what-about-string">What about <code class="language-plaintext highlighter-rouge">String</code>?</h3>
<p>Oh boy. Strings are quite a mess in Java, because they <em>behave</em> like primitive types (more on that later), but they really <em>are</em> classes. Also, you can just initialize a string using quotes <code class="language-plaintext highlighter-rouge">""</code> instead of having to call <code class="language-plaintext highlighter-rouge">new String()</code>, which makes them behave differently than <em>any other class</em> in the language. This complication is also the reason that you can’t just compare two strings using <code class="language-plaintext highlighter-rouge">==</code>, but you have to use <code class="language-plaintext highlighter-rouge">.equals()</code> instead. Meh.</p>

<h3 id="pass-by-reference-vs-pass-by-value">Pass-by-reference vs. pass-by-value</h3>
<p>An important thing to know about primitive types compared to objects is the behavior they show when being passed into a method that accepts parameters. Let’s look at the following code as an example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">10</span><span class="o">;</span>
        <span class="n">addOne</span><span class="o">(</span><span class="n">i</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">i</span><span class="o">);</span> <span class="c1">// still 10, what gives?</span>
    <span class="o">}</span>
    
    <span class="kd">private</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">addOne</span><span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">){</span>
        <span class="n">i</span><span class="o">++;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, the <code class="language-plaintext highlighter-rouge">addOne</code> method adds one to the parameter passed into it. But despite that, the code in our <code class="language-plaintext highlighter-rouge">main</code> method still prints out the number 10. This happens because primitive types (and <code class="language-plaintext highlighter-rouge">String</code>, hurr durr) use what is called <em>pass-by-value</em>: When calling <code class="language-plaintext highlighter-rouge">addOne</code>, its <code class="language-plaintext highlighter-rouge">i</code> variable is just set to the <em>value</em> of the <code class="language-plaintext highlighter-rouge">i</code> variable from our <code class="language-plaintext highlighter-rouge">main</code> method. It doesn’t know about the actual <em>variable</em> we pass in, just its <em>value</em>.</p>

<p>This behavior, however, is different when using Objects. Let’s rewrite the code above to use a custom class that contains an <code class="language-plaintext highlighter-rouge">int</code> field:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Thing.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Thing</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">i</span><span class="o">;</span>
    <span class="kd">public</span> <span class="nf">Thing</span><span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">i</span> <span class="o">=</span> <span class="n">i</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>

<span class="c1">// Main.java</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">Thing</span> <span class="n">thing</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Thing</span><span class="o">(</span><span class="mi">10</span><span class="o">);</span>
        <span class="n">addOne</span><span class="o">(</span><span class="n">thing</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">thing</span><span class="o">.</span><span class="na">i</span><span class="o">);</span> <span class="c1">// 11</span>
    <span class="o">}</span>

    <span class="kd">private</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">addOne</span><span class="o">(</span><span class="nc">Thing</span> <span class="n">thing</span><span class="o">)</span> <span class="o">{</span>
        <span class="n">thing</span><span class="o">.</span><span class="na">i</span><span class="o">++;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, the program now prints out 11 instead of 10. That’s because of something Java uses called <em>pointers</em><sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>. Our <code class="language-plaintext highlighter-rouge">thing</code> variable in the <code class="language-plaintext highlighter-rouge">main</code> method doesn’t really store the actual <em>instance</em>, but instead, it stores the location of that instance in memory. So when passing that variable into the <code class="language-plaintext highlighter-rouge">addOne</code> method, all we pass is the information “The thing we’re trying to modify sits in this part of memory, so modify the data there, please.” That’s why, when we then change the <code class="language-plaintext highlighter-rouge">Thing</code>’s <code class="language-plaintext highlighter-rouge">i</code> variable, it’s also modified outside of the method.</p>

<h2 id="null"><code class="language-plaintext highlighter-rouge">null</code></h2>
<p>Any variables that can store objects rather than primitive types (our <code class="language-plaintext highlighter-rouge">thing</code> variable from before, for example) can have a state where they don’t point to an object, but instead, point to nothing. This “nothing” is called <code class="language-plaintext highlighter-rouge">null</code>.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Thing</span> <span class="n">noThing</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
</code></pre></div></div>
<p>Using <code class="language-plaintext highlighter-rouge">null</code> can be useful in a lot of cases; however, it can also be quite dangerous: Trying to call a method or interact with a field of a variable that is <code class="language-plaintext highlighter-rouge">null</code> causes the program to crash:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Thing</span> <span class="n">noThing</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">noThing</span><span class="o">.</span><span class="na">i</span><span class="o">);</span> <span class="c1">// crashes</span>
</code></pre></div></div>
<p>Just like any other objects, you can use <code class="language-plaintext highlighter-rouge">null</code> in comparisons:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="o">(</span><span class="n">noThing</span> <span class="o">==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"I don't have a thing!"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>

<h2 id="arrays-and-lists">Arrays and Lists</h2>
<p>Arrays and Lists are two data types that you’ll be using a lot of, because they’re super useful. Their names kind of already give away what they do, but in case they don’t mean anything to you: Arrays and lists are two ways to store multiple pieces of data easily without having to manage each piece on its own. This can be useful for stuff like <em>students in a classroom</em>, where you won’t really know for certain beforehand how many students will be there at any given day. The difference between Arrays and Lists is that the former has a <em>fixed size</em>, while the latter has a <em>dynamic size</em>.</p>

<h3 id="arrays">Arrays</h3>
<p>Let’s take a look at arrays first. An array has a fixed type, meaning that the objects in it can only be of the type you specify when creating the array. The variable type of an array of strings, for example, is written as <code class="language-plaintext highlighter-rouge">String[]</code>. To initialize an array, you have two options: Either you create an empty array based on a fixed size (where every slot will contain <code class="language-plaintext highlighter-rouge">null</code> to start with), or you create an array that already has stuff in it:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span><span class="o">[]</span> <span class="n">numbers</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">int</span><span class="o">[</span><span class="mi">10</span><span class="o">];</span> <span class="c1">// empty array with 10 slots</span>
<span class="nc">String</span><span class="o">[]</span> <span class="n">names</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">String</span><span class="o">[]{</span><span class="s">"Justus"</span><span class="o">,</span> <span class="s">"Peter"</span><span class="o">,</span> <span class="s">"Bob"</span><span class="o">};</span>
</code></pre></div></div>
<p>You can query and modify the data in an array using array brackets <code class="language-plaintext highlighter-rouge">[]</code> like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">String</span> <span class="n">justus</span> <span class="o">=</span> <span class="n">names</span><span class="o">[</span><span class="mi">0</span><span class="o">];</span> <span class="c1">// get the 0th entry</span>
<span class="n">names</span><span class="o">[</span><span class="mi">1</span><span class="o">]</span> <span class="o">=</span> <span class="s">"Peter Shaw"</span><span class="o">;</span> <span class="c1">// modify the 1st entry</span>
</code></pre></div></div>
<p>Note that, in Java, the first slot in an array has an index of 0, which means that the last slot of an array always has the index <code class="language-plaintext highlighter-rouge">length-1</code>. Every array has a <code class="language-plaintext highlighter-rouge">length</code> field which stores the amount of slots an array has, meaning you can query the length of <code class="language-plaintext highlighter-rouge">numbers</code> by writing <code class="language-plaintext highlighter-rouge">numbers.length</code>.</p>

<h3 id="lists">Lists</h3>
<p>Lists<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup> work much in the same way, with the main difference being the way you identify them. Lists use something called <em>generic types</em><sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup> to allow you to also give them a fixed type. The variable type of a list of strings, for example, is written as <code class="language-plaintext highlighter-rouge">ArrayList&lt;String&gt;</code>, using angle brackets <code class="language-plaintext highlighter-rouge">&lt;&gt;</code> (which are really just “greater than” and “less than” signs). To create a list, simply call its constructor using <code class="language-plaintext highlighter-rouge">new</code>:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">ArrayList</span><span class="o">&lt;</span><span class="nc">Integer</span><span class="o">&gt;</span> <span class="n">numbers</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ArrayList</span><span class="o">&lt;&gt;();</span>
<span class="nc">ArrayList</span><span class="o">&lt;</span><span class="nc">String</span><span class="o">&gt;</span> <span class="n">names</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">ArrayList</span><span class="o">&lt;&gt;();</span>
</code></pre></div></div>
<p>Note that, to create a list containing a primitive type, you need to specify its <em>wrapper class</em> instead of the native type itself<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup>. The wrapper class for <code class="language-plaintext highlighter-rouge">int</code> is <code class="language-plaintext highlighter-rouge">Integer</code>, and the wrapper classes for the other types are just their names with an uppercase first letter (<code class="language-plaintext highlighter-rouge">Boolean</code>, for example).</p>

<p>Also note that, when copying or writing this code in your IDE, it will automatically add <code class="language-plaintext highlighter-rouge">import</code> statements to the top of the class. All they do is make classes from other locations available to the current class, but you don’t have to worry about them too much.</p>

<p>You can query and modify the data in a list using the methods from the <code class="language-plaintext highlighter-rouge">ArrayList</code> class:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">names</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">"Justus"</span><span class="o">);</span> <span class="c1">// add entries</span>
<span class="n">names</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">"Peter"</span><span class="o">);</span>
<span class="n">names</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">"Bob"</span><span class="o">);</span>

<span class="nc">String</span> <span class="n">justus</span> <span class="o">=</span> <span class="n">names</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">);</span> <span class="c1">// get the 0th entry</span>
<span class="n">names</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">1</span><span class="o">,</span> <span class="s">"Peter Shaw"</span><span class="o">);</span> <span class="c1">// modify the 1st entry</span>

<span class="c1">// the length of a list can be read using the size() method</span>
<span class="kt">int</span> <span class="n">length</span> <span class="o">=</span> <span class="n">names</span><span class="o">.</span><span class="na">size</span><span class="o">();</span>
</code></pre></div></div>

<p>Note that, when trying to access an index of a list or an array that is either less than 0 or greater than or equal to its length, your program will crash, so be careful.</p>

<h2 id="conclusion">Conclusion</h2>
<p>So today, you learned some additional useful things about Java that I didn’t really get a chance to mention at an earlier point. So let’s write some code that makes use of them! If you want, you can try to solve the following problem, which is an extension of the problem from the previous tutorial:</p>

<blockquote>
  <p>Let’s imagine you’re managing a small car dealership. You want to have a way of managing all of the cars you have in stock. This includes keeping track of their brand names, their horsepower, their license plate texts and their mileage. Currently, you have 15 parking spots for cars you can sell, 4 of which are already occupied with cars. Additionally, you keep track of a list of all the customers you have had so far (namely, you store their first and last names as well as the city they live in). At the current time, you’ve already had 3 customers. Additionally, you want to have a way of adding a new car to the first available parking spot, as well as a way to store the data of a new customer easily.</p>
</blockquote>

<p>If you’re stuck, you can <a href="https://gist.github.com/Ellpeck/3bdc69845d0d4c0e9511511dd06cfdc1">get some hints</a> or <a href="https://gist.github.com/Ellpeck/595b929ce666fca6fb0ed792ca98d71e">look at my solution</a>.</p>

<p>Happy coding!</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Java’s pointers work a lot differently from pointers in lower-level languages like C, because they’re implicit: You don’t create or manage them yourself. They’re still called pointers though, so yea. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Java has multiple types of lists (including, but not limited to <code class="language-plaintext highlighter-rouge">ArrayList</code> and <code class="language-plaintext highlighter-rouge">LinkedList</code>), but for the purpose of this tutorial, we’ll only be looking at <code class="language-plaintext highlighter-rouge">ArrayList</code> since it’s the most commonly used one and it also goes hand in hand with arrays. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>More on those in a later tutorial, probably. They’re pretty useful. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:4" role="doc-endnote">
      <p>Which is also just another annoying property of Java that could’ve been implemented a lot better (like in C#), but oh well, it is what it is. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[In this Java tutorial for beginners, we cover some shorthands, some more data types, the difference between pass-by-reference and pass-by-value, null, as well as arrays and lists.]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 4: Classes and Objects</title><link href="https://ellpeck.de/blog/java_4/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 4: Classes and Objects" /><published>2019-10-14T00:00:00+00:00</published><updated>2019-10-14T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_4</id><content type="html" xml:base="https://ellpeck.de/blog/java_4/"><![CDATA[<p>So you’ve gotten far enough into Java now that you’ll finally be able to learn about what this “object orientation” jazz is that everyone keeps talking about. I feel like this is a somewhat complicated topic to explain, so bear with me.</p>

<h2 id="classes">Classes</h2>
<p>So far in the tutorial, we’ve only ever used classes as basic storage containers for variables and methods. Let’s stick with that for another moment while we create a simple <code class="language-plaintext highlighter-rouge">Utility</code> class that has a method we might want to use throughout our program. We’ll create it in a new file (Right-Click on <code class="language-plaintext highlighter-rouge">src</code>, <code class="language-plaintext highlighter-rouge">New</code>, <code class="language-plaintext highlighter-rouge">Java Class</code> in IntelliJ) like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Utility</span> <span class="o">{</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, this structure is similar to that of our <code class="language-plaintext highlighter-rouge">Main</code> class: The word <code class="language-plaintext highlighter-rouge">public</code>, followed by the word <code class="language-plaintext highlighter-rouge">class</code>, followed by the name of the class (which, in 99% of cases, should match the file name), followed by curly braces <code class="language-plaintext highlighter-rouge">{}</code>, which, as you might expect by now, contain the content of our class.</p>

<p>So let’s add a method to it that, I don’t know, returns the absolute value of an integer passed to it. We’ll call this one <code class="language-plaintext highlighter-rouge">abs</code>, for “absolute”.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup></p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Utility</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">int</span> <span class="nf">abs</span><span class="o">(</span><span class="kt">int</span> <span class="n">num</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(</span><span class="n">num</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="o">-</span><span class="n">num</span><span class="o">;</span>
        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
            <span class="k">return</span> <span class="n">num</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>By now, this code should be pretty easy for you to understand: We’ve added a method called <code class="language-plaintext highlighter-rouge">abs</code> that takes in an integer parameter called <code class="language-plaintext highlighter-rouge">num</code>, and if <code class="language-plaintext highlighter-rouge">num</code> is negative, then we return the negated value of num (<code class="language-plaintext highlighter-rouge">-num</code>).</p>

<p>Now, because this method is in a different class to the one we might want to use the method in (<code class="language-plaintext highlighter-rouge">Main</code> in our case), we have to explicitly mention the class the method is in by prefixing the class’ name followed by a dot <code class="language-plaintext highlighter-rouge">.</code> when calling it, like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="c1">// This is our usual main method</span>

        <span class="kt">int</span> <span class="n">abs</span> <span class="o">=</span> <span class="nc">Utility</span><span class="o">.</span><span class="na">abs</span><span class="o">(-</span><span class="mi">17</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">abs</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<h2 id="objects">Objects</h2>
<p>Let’s finally move away from <code class="language-plaintext highlighter-rouge">static</code> methods and into object orientation.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup> I’ll give you a quick, made-by-me outline of what object orientation even <em>means</em>, based on an example that might be a bit easier for you to understand.</p>

<p>Let’s imagine we’re not talking about objects, but <em>tables</em>. When you say something like “A table has four legs”, you’re not talking about a <em>specific</em> table, but rather, you’re talking about the <em>concept</em> of what a table is. In Java, this is what a class is. Now, when you say something like “This table has four legs” while pointing to the table on the other side of the room, then you’re talking about a very specific table, not just a concept anymore. In Java, this is what an object is. When we now say “object oriented”, we merely mean “code that makes use of objects.”</p>

<p>Another way to think of it is that classes are <em>blueprints</em> for certain things, and objects are the actual constructions that were created by following those blueprints.</p>

<h3 id="creating-objects">Creating Objects</h3>
<p>So let’s stick with this table example for now. First, we’ll create a class called <code class="language-plaintext highlighter-rouge">Table</code> like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Table</span> <span class="o">{</span>
<span class="o">}</span>
</code></pre></div></div>
<p>So now, we have a very basic blueprint of a table.</p>

<p>Now, let’s go back into our main class and actually create a <em>specific</em> table like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="c1">// This is our usual main method</span>

        <span class="nc">Table</span> <span class="n">myTable</span><span class="o">;</span>
        <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, the structure of line 5 is the same as how we usually declare variables: <code class="language-plaintext highlighter-rouge">Table</code> is the variable type (this is where we usually put <code class="language-plaintext highlighter-rouge">int</code> or <code class="language-plaintext highlighter-rouge">String</code>), and <code class="language-plaintext highlighter-rouge">myTable</code> is the name of the variable. Line 6 is where the new stuff happens, however: We set the variable’s <em>value</em> to a newly created <em>instance</em> of the <code class="language-plaintext highlighter-rouge">Table</code> class. This is us creating a specific table following the blueprint that is the <code class="language-plaintext highlighter-rouge">Table</code> class: We write <code class="language-plaintext highlighter-rouge">new</code>, then the class’ name, and then opening and closing parentheses <code class="language-plaintext highlighter-rouge">()</code>.</p>

<h2 id="fields">Fields</h2>
<p>What we have so far isn’t really that interesting yet - our table doesn’t really have any properties yet. But now, we can actually add <em>fields</em> to our class: Certain variables that each object will share, but whose values can also be <em>different</em> for each object. Fields are declared like normal variables, but are placed at the top of a class, prefixed with the <code class="language-plaintext highlighter-rouge">public</code> keyword like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Table</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kt">int</span> <span class="n">legAmount</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Now, each table <em>instance</em> can have its amount of legs modified as well as displayed like so:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Table</span> <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>
<span class="n">myTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">4</span><span class="o">;</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"My table has "</span> <span class="o">+</span> <span class="n">myTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">+</span> <span class="s">" legs"</span><span class="o">);</span>
</code></pre></div></div>
<p>As you can see, to access an object’s fields, all you have to do is write the variable name, followed by a dot <code class="language-plaintext highlighter-rouge">.</code>, followed by the field’s name.</p>

<p>The important thing to know here is that this variable is now unique for <em>every table instance you create</em>, meaning the following code…</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Table</span> <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>
<span class="nc">Table</span> <span class="n">myOtherTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>

<span class="n">myTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">4</span><span class="o">;</span>
<span class="n">myOtherTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">25</span><span class="o">;</span>

<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"My table has "</span> <span class="o">+</span> <span class="n">myTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">+</span> <span class="s">" legs"</span><span class="o">);</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"My other table has "</span> <span class="o">+</span> <span class="n">myOtherTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">+</span> <span class="s">" legs"</span><span class="o">);</span>
</code></pre></div></div>
<p>…will print out <code class="language-plaintext highlighter-rouge">My table has 4 legs</code>, followed by <code class="language-plaintext highlighter-rouge">My other table has 25 legs</code>.</p>

<h2 id="methods">Methods</h2>
<p>Obviously, you already know what methods are, but we can finally get rid of the <code class="language-plaintext highlighter-rouge">static</code> keyword for those as well. Similarly to what we can do with fields, we can also add methods to classes that can do unique things based on the object they’re being called for. Let’s take a look at the following code:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Table</span> <span class="o">{</span>

    <span class="kd">public</span> <span class="kt">int</span> <span class="n">legAmount</span><span class="o">;</span>

    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printLegAmount</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"I have a certain amount of legs"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, I’ve added a (non-static) method to this class called <code class="language-plaintext highlighter-rouge">printLegAmount</code>. Now we can change the code in our <code class="language-plaintext highlighter-rouge">Main</code> class to just call that method instead:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Table</span> <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>
<span class="n">myTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">4</span><span class="o">;</span>
<span class="n">myTable</span><span class="o">.</span><span class="na">printLegAmount</span><span class="o">();</span>
</code></pre></div></div>

<h3 id="the-this-keyword">The <code class="language-plaintext highlighter-rouge">this</code> keyword</h3>
<p>Now that specific example isn’t really that useful yet, because every single table we create will print out <code class="language-plaintext highlighter-rouge">I have a certain amount of legs</code>, when it would really be nicer if the table printed out its amount of legs stored in the <code class="language-plaintext highlighter-rouge">legAmount</code> variable.</p>

<p>That’s exactly what the <code class="language-plaintext highlighter-rouge">this</code> keyword is for.<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup> Let’s modify our method from before:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Table</span> <span class="o">{</span>

    <span class="kd">public</span> <span class="kt">int</span> <span class="n">legAmount</span><span class="o">;</span>

    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printLegAmount</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"I have "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">+</span> <span class="s">" legs"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, <code class="language-plaintext highlighter-rouge">this</code> is being used here similarly to how we were using <code class="language-plaintext highlighter-rouge">myTable.legAmount</code> earlier. That has a good reason: <code class="language-plaintext highlighter-rouge">this</code> also refers to an object. However, the object that <code class="language-plaintext highlighter-rouge">this</code> refers to is <em>the current one</em>. When calling a method like <code class="language-plaintext highlighter-rouge">printLegAmount</code> for a specific object (<code class="language-plaintext highlighter-rouge">myTable</code> in our case), the <code class="language-plaintext highlighter-rouge">this</code> keyword will always refer to that object.</p>

<p>So if we have code like this…</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Table</span> <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>
<span class="nc">Table</span> <span class="n">myOtherTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>

<span class="n">myTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">4</span><span class="o">;</span>
<span class="n">myOtherTable</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">25</span><span class="o">;</span>

<span class="n">myTable</span><span class="o">.</span><span class="na">printLegAmount</span><span class="o">();</span>
<span class="n">myOtherTable</span><span class="o">.</span><span class="na">printLegAmount</span><span class="o">();</span>
</code></pre></div></div>
<p>…then the result will be the same as before: <code class="language-plaintext highlighter-rouge">My table has 4 legs</code>, followed by <code class="language-plaintext highlighter-rouge">My other table has 25 legs</code>, because in <code class="language-plaintext highlighter-rouge">myTable.printLegAmount()</code>, <code class="language-plaintext highlighter-rouge">this</code> will be <code class="language-plaintext highlighter-rouge">myTable</code>, and in <code class="language-plaintext highlighter-rouge">myOtherTable.printLegAmount()</code>, <code class="language-plaintext highlighter-rouge">this</code> will be <code class="language-plaintext highlighter-rouge">myOtherTable</code>.</p>

<h2 id="constructors">Constructors</h2>
<p>Constructors are a special kind of method in Java. You can’t really execute them manually, but instead, they’re automatically called every time a new instance is created (so every time you use the <code class="language-plaintext highlighter-rouge">new</code> keyword).</p>

<p>Let’s look at the following example, which adds a constructor to our <code class="language-plaintext highlighter-rouge">Table</code> class that automatically sets the <code class="language-plaintext highlighter-rouge">legAmount</code> variable to 4.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Table</span> <span class="o">{</span>

    <span class="kd">public</span> <span class="kt">int</span> <span class="n">legAmount</span><span class="o">;</span>
    
    <span class="c1">// The constructor</span>
    <span class="kd">public</span> <span class="nf">Table</span><span class="o">()</span> <span class="o">{</span>
        <span class="k">this</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="mi">4</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">printLegAmount</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"I have "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">+</span> <span class="s">" legs"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, a constructor is different from other methods in that it <em>doesn’t have a name</em>, and that its return type is <em>the same as the class it is in</em>.</p>

<p>So now, any instance of <code class="language-plaintext highlighter-rouge">Table</code> that we create will automatically have a leg amount of 4:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Table</span> <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">();</span>
<span class="n">myTable</span><span class="o">.</span><span class="na">printLegAmount</span><span class="o">();</span> <span class="c1">// "I have 4 legs"</span>
</code></pre></div></div>

<h3 id="constructor-parameters">Constructor parameters</h3>
<p>Just like in any other method, we can add a set of variables that the constructor accepts (parameters). In our case, we could make a table request a <code class="language-plaintext highlighter-rouge">legAmount</code> when it’s initialized as follows:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// The constructor</span>
<span class="kd">public</span> <span class="nf">Table</span><span class="o">(</span><span class="kt">int</span> <span class="n">legs</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="na">legAmount</span> <span class="o">=</span> <span class="n">legs</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Now, when creating a new instance of <code class="language-plaintext highlighter-rouge">Table</code>, we have to actually give it a leg amount that it should start with:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">Table</span> <span class="n">myTable</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Table</span><span class="o">(</span><span class="mi">4</span><span class="o">);</span>
</code></pre></div></div>

<h2 id="so-what-about-static">So what about <code class="language-plaintext highlighter-rouge">static</code>?</h2>
<p>As you have learned throughout this tutorial, non-static methods and variables inside of classes have a key property: They’re unique for every object that is created of that class. So why have we been using <code class="language-plaintext highlighter-rouge">static</code> throughout both our <code class="language-plaintext highlighter-rouge">Main</code> and our <code class="language-plaintext highlighter-rouge">Utility</code> classes?</p>

<p>The <code class="language-plaintext highlighter-rouge">static</code> keyword tells any field or method that it should <em>not</em> be unique for every object that is created. Even if we created an instance of our <code class="language-plaintext highlighter-rouge">Main</code> class (<code class="language-plaintext highlighter-rouge">new Main()</code>), for example, the <code class="language-plaintext highlighter-rouge">main</code> method would not be unique for that instance, because it is marked with the <code class="language-plaintext highlighter-rouge">static</code> keyword. This also means that using the <code class="language-plaintext highlighter-rouge">this</code> keyword would make no sense in a static method (which object would it reference?), which is why doing so doesn’t work.</p>

<p>Similarly, if we made the <code class="language-plaintext highlighter-rouge">abs</code> method in our <code class="language-plaintext highlighter-rouge">Utility</code> class non-static, then we could <em>not</em> access it simply by typing <code class="language-plaintext highlighter-rouge">Utility.abs()</code>, because the method would be unique for every object that is created of the class. We <em>could</em> then use the <code class="language-plaintext highlighter-rouge">abs</code> method if we first created an instance of the <code class="language-plaintext highlighter-rouge">Utility</code> class (<code class="language-plaintext highlighter-rouge">new Utility()</code>).</p>

<h2 id="conclusion">Conclusion</h2>
<p>So yea, that’s quite a lot of information for you to process. The introduction to objects is a pretty big step, but it also allows for a lot of cool new stuff that you can learn. In the next couple tutorials, we’ll expand on the concept of objects and learn some more stuff that you can do with them to make them even more useful.</p>

<p>For now, though, I’ll leave you with this little exercise you can do to facilitate what you learned about objects and to get a better understanding of how useful they are:<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup></p>

<blockquote>
  <p>Let’s imagine you’re managing a small car dealership. You want to have a way of managing all of the cars you have in stock. This includes keeping track of their brand names, their horsepower, their license plate texts and their mileage. Currently, you have four different cars in stock, and you want your program to print out all of the information about all of the cars.</p>
</blockquote>

<p>If you’re stuck, you can <a href="https://gist.github.com/Ellpeck/462022597659f554fdd75663359480d3">get some hints</a> or <a href="https://gist.github.com/Ellpeck/7a0f31306d05473c10e8bca1685510a4">look at my solution</a>.</p>

<p>Next time, we’ll be talking about arrays and lists.<sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">5</a></sup> Happy coding!</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Java’s default <code class="language-plaintext highlighter-rouge">Math</code> class already has an <code class="language-plaintext highlighter-rouge">abs</code> method that does this same thing, but for the sake of this tutorial, we’ll ignore it (because I can’t think of any other utility method to add, in all honesty). <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Note that I explain why we’re omitting the <code class="language-plaintext highlighter-rouge">static</code> keyword from now on a bit later in this tutorial. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>In a lot of cases, using the <code class="language-plaintext highlighter-rouge">this</code> keyword is actually optional and it can just be left out altogether. However, I personally think that it increases code readability quite a bit and that it helps a lot with understanding how objects work, so I advise you to use it. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:4" role="doc-endnote">
      <p>This example is one that almost every instructor uses. It might be a bit boring and ridiculous, but it’s simple and helps understanding the concept, so I also like using it when teaching people how to code. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:5" role="doc-endnote">
      <p>Note that there is also another huge topic to talk about when it comes to object orientation, which is <em>pointers</em> and how Java manages objects and their assignment to variables (including pass-by-reference and the like). I’ll cover that soon. I promise. &lt;3 <a href="#fnref:5" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[In this Java tutorial for beginners, we cover the basics of creating classes with a constructor, some fields and some methods and creating objects of them.]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 3: (Static) Methods</title><link href="https://ellpeck.de/blog/java_3/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 3: (Static) Methods" /><published>2019-10-11T00:00:00+00:00</published><updated>2019-10-11T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_3</id><content type="html" xml:base="https://ellpeck.de/blog/java_3/"><![CDATA[<p>I’ve been thinking about how to structure this tutorial a lot, and I decided to teach you all about methods <em>before</em> I get into object orientation, so you’ll have to wait a little while longer before we get into the real nitty-gritty. To understand this one, you should’ve already read and understood tutorials 1 and 2. If you haven’t, you can get to them by clicking the “Previous Post” button in the navigation bar.</p>

<p>So, here goes!</p>

<h2 id="methods">Methods</h2>
<p>Methods are a way, in programming, to move certain code into a different location where it’s more organized and, more importantly, where it can be called multiple times from multiple locations, possibly with different data. You’ll see what exactly that means in a minute.</p>

<p>Let’s create a simple method in our main class:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="c1">// I've omitted the code from the previous tutorials for readability</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">printInfo</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This is some important information!"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Let’s take a look at the <code class="language-plaintext highlighter-rouge">printInfo</code> method I created. In this tutorial, we’ll only be talking about <code class="language-plaintext highlighter-rouge">public</code> and <code class="language-plaintext highlighter-rouge">static</code> methods, so you’ll just have to take that part for granted for now. Following that, you write <code class="language-plaintext highlighter-rouge">void</code> and then the name of your method (which can be anything you want), followed by parentheses <code class="language-plaintext highlighter-rouge">()</code> and then braces <code class="language-plaintext highlighter-rouge">{}</code>. Similarly to the <code class="language-plaintext highlighter-rouge">if</code> statement and the <code class="language-plaintext highlighter-rouge">for</code> loop, the method’s content goes between those two curly braces, as I have done in this example with the print statement.</p>

<p>As you can see, all a method is is pretty much a collection of code. At this point, you might’ve already noticed that that is exactly what the <code class="language-plaintext highlighter-rouge">main</code> structure we’ve previously been writing all of our code into is: <code class="language-plaintext highlighter-rouge">main</code> is just another method.</p>

<p>To <em>call</em> a method, that is to have the code inside of it be executed, all you have to do is write the following:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="c1">// I've omitted the code from the previous tutorials for readability</span>

        <span class="n">printInfo</span><span class="o">();</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">printInfo</span><span class="o">()</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This is some important information!"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>There you go.</p>

<h3 id="variables">Variables</h3>
<p>It should be noted at this point that variables which are declared <em>inside</em> of a method, like the ones we’ve been using in the first two tutorials, are known as <code class="language-plaintext highlighter-rouge">local variables</code>. What this means is that they only exist <em>inside</em> of the method they are declared in. Check out this example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// This method declares a variable i that is set to 0</span>
<span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">methodOne</span><span class="o">()</span> <span class="o">{</span>
    <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
<span class="o">}</span>

<span class="c1">// This method declares a *different* variable i that is set to 1</span>
<span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">methodTwo</span><span class="o">()</span> <span class="o">{</span>
    <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="o">;</span>
<span class="o">}</span>

<span class="c1">// This method will cause an error if you paste it into your IDE:</span>
<span class="c1">// You cannot declare two variables with the same name in one method.</span>
<span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">erroringMethod</span><span class="o">()</span> <span class="o">{</span>
    <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
    <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>This same behavior also counts for <code class="language-plaintext highlighter-rouge">if</code>, <code class="language-plaintext highlighter-rouge">for</code> and any other curly braces <code class="language-plaintext highlighter-rouge">{}</code> that you see: They close off any variables which are created inside of them and make them available to only that location.</p>

<h2 id="parameters">Parameters</h2>
<p>Now you might be wondering what the point of methods is if all they do is execute a predefined list of code. Well… you can actually make a method <em>accept</em> a set of data that they can use to do their processing. The data given to a method is called <em>parameters</em>, and these parameters are simply variables that you declare between the method’s parentheses <code class="language-plaintext highlighter-rouge">()</code> right after its name.</p>

<p>Let’s take the following example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">printInfo</span><span class="o">(</span><span class="nc">String</span> <span class="n">strg</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This is some important information about "</span> <span class="o">+</span> <span class="n">strg</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>I modified the method by adding the parameter <code class="language-plaintext highlighter-rouge">strg</code> to it, which is of the type <code class="language-plaintext highlighter-rouge">String</code>. What this means is that now, when calling the method, it expects you to give it a string that it can use to do stuff with (in this case, print it out).</p>

<p>If you add that parameter to the code we previously wrote, you might notice that your IDE is now displaying an error to you. You can’t just do this anymore:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
    <span class="n">printInfo</span><span class="o">();</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As we just said, <code class="language-plaintext highlighter-rouge">printInfo</code> now wants us to give it a string whenever we call it. To give it that string, simply put it between the parentheses <code class="language-plaintext highlighter-rouge">()</code> of your method call like this:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">String</span> <span class="n">someString</span> <span class="o">=</span> <span class="s">"Some String"</span><span class="o">;</span>
<span class="n">printInfo</span><span class="o">(</span><span class="n">someString</span><span class="o">);</span>

<span class="c1">// or, optionally, the shorter form:</span>
<span class="n">printInfo</span><span class="o">(</span><span class="s">"Some String"</span><span class="o">);</span>
</code></pre></div></div>
<p>Running your code now should cause <code class="language-plaintext highlighter-rouge">This is some important information about Some String</code> to be displayed in your console.</p>

<p>In case you’re thinking “I’ve seen that somewhere before”, then you would be correct: This is exactly the same thing you do when you try to print something out to the console: You call the <code class="language-plaintext highlighter-rouge">println</code> method and give it the text you want to print out as the parameter.</p>

<p>The cool thing is that a method can also accept <em>multiple</em> parameters, so multiple bits of data can be passed into it when calling it. Let’s look at this example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="n">printInfo</span><span class="o">(</span><span class="s">"Some String"</span><span class="o">,</span> <span class="mi">5</span><span class="o">);</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">printInfo</span><span class="o">(</span><span class="nc">String</span> <span class="n">strg</span><span class="o">,</span> <span class="kt">int</span> <span class="n">amount</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">amount</span><span class="o">;</span> <span class="n">i</span> <span class="o">=</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This is some important information about "</span> <span class="o">+</span> <span class="n">strg</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, the <code class="language-plaintext highlighter-rouge">printInfo</code> method now takes two parameters, separated by a comma <code class="language-plaintext highlighter-rouge">,</code>. The code inside of the method should already be familiar to you: It’s a simple for loop that prints the same message <code class="language-plaintext highlighter-rouge">amount</code> times.</p>

<p>So now, we have something that also demonstrates pretty well the versatility of methods: We can now call <code class="language-plaintext highlighter-rouge">printInfo</code> with any information that will be printed any amount of times:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">printInfo</span><span class="o">(</span><span class="s">"Some String"</span><span class="o">,</span> <span class="mi">5</span><span class="o">);</span>
<span class="n">printInfo</span><span class="o">(</span><span class="s">"Some other String"</span><span class="o">,</span> <span class="mi">10</span><span class="o">);</span>
</code></pre></div></div>

<h2 id="returning">Returning</h2>
<p>Another thing that methods can do that is really useful is the ability to <em>return</em> certain data. What this means is that they can, after their execution finishes, take the data they created or modified and give it back to the caller:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="kt">int</span> <span class="n">tenSquared</span> <span class="o">=</span> <span class="n">square</span><span class="o">(</span><span class="mi">10</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">tenSquared</span><span class="o">);</span> <span class="c1">// prints 100</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">square</span><span class="o">(</span><span class="mi">5</span><span class="o">));</span> <span class="c1">// prints 25</span>
    <span class="o">}</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">int</span> <span class="nf">square</span><span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="n">i</span> <span class="o">*</span> <span class="n">i</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, I created a method <code class="language-plaintext highlighter-rouge">square</code> that returns its parameter <code class="language-plaintext highlighter-rouge">i</code>, but squared. To make a method return a value, two things have to be done:</p>
<ul>
  <li>The method’s <em>return type</em> has to be declared. For methods that don’t return anything, the return type is <code class="language-plaintext highlighter-rouge">void</code>. For methods that return something, just replace <code class="language-plaintext highlighter-rouge">void</code> with the <em>type of variable</em> that it returns.</li>
  <li>To actually return a specific value after it has been calculated, just type <code class="language-plaintext highlighter-rouge">return</code>, followed by the value and a semicolon <code class="language-plaintext highlighter-rouge">;</code>.</li>
</ul>

<p>Now, this method can be used as if it were just another number: We can set variables to it and print it out. But instead of it being just another number, it actually executes the code inside it every time.</p>

<h3 id="stopping-execution">Stopping execution</h3>
<p>A thing that should be noted about returning is that any code that comes after a return statement will <em>not</em> be executed. In other words: After returning a value, a method will stop its execution, no matter what comes next.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kt">int</span> <span class="nf">square</span><span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="n">i</span> <span class="o">*</span> <span class="n">i</span><span class="o">;</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This will never be called"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>In this specific case, that isn’t really useful - why write code that can never be executed? But take this other example:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kt">boolean</span> <span class="nf">isIGreaterThanJ</span><span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">,</span> <span class="kt">int</span> <span class="n">j</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&gt;</span> <span class="n">j</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
    <span class="o">}</span>
    
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is NOT greater than j!"</span><span class="o">);</span>
    <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>    
</code></pre></div></div>
<p>In this example, the print statement will not be executed if <code class="language-plaintext highlighter-rouge">i</code> is greater than <code class="language-plaintext highlighter-rouge">j</code> despite the fact that it’s not wrapped in an <code class="language-plaintext highlighter-rouge">else</code>, because the method gets returned out of before it can be called.</p>

<h3 id="requirements">Requirements</h3>
<p>If you create a method that has a return type other than <code class="language-plaintext highlighter-rouge">void</code> (which, again, means “this method doesn’t return anything”), then every possible path that the execution can take inside the method <em>needs</em> to return <em>something</em>.</p>

<p>What this means is that you can’t have something like this:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kt">boolean</span> <span class="nf">isIGreaterThanJ</span><span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">,</span> <span class="kt">int</span> <span class="n">j</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&gt;</span> <span class="n">j</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
    <span class="o">}</span>

    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is NOT greater than j!"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>Because when <code class="language-plaintext highlighter-rouge">i</code> is <em>not</em> greater than <code class="language-plaintext highlighter-rouge">j</code>, the print statement will be executed but then, the method doesn’t know what value to return, so this code will give out an error before it even tries to execute.</p>

<h2 id="conclusion">Conclusion</h2>
<p>So yea, that’s pretty much everything important there is to know about (static) methods. In one of the next tutorials, we’ll finally get into actual object orientation and we’ll soon be taking a look at non-static methods, which are even more useful than static methods.</p>

<p>As a little exercise, you might want to create some methods with different return types and different parameters and call them. Have some fun!</p>

<p>I hope you enjoyed reading, and of course: Happy coding!</p>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[In this Java tutorial for beginners, we cover what (static) methods, parameters and return types are.]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 1: Hello World</title><link href="https://ellpeck.de/blog/java_1/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 1: Hello World" /><published>2019-10-10T00:00:00+00:00</published><updated>2019-10-10T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_1</id><content type="html" xml:base="https://ellpeck.de/blog/java_1/"><![CDATA[<p>So you want to learn to code. In my opinion, a good language for beginners is Java, because it’s a rather easy to understand language, and it’s cross-platform, meaning it can run on any operating system without the need for the programmer (you!) to change anything based on the platform. Also, Java is object-oriented (more on that later), meaning it’s pretty good for writing any sort of simple or complex program.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup></p>

<p>So let’s start!</p>

<h2 id="setting-it-up">Setting it up</h2>
<p>To actually be able to compile<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup> any Java code, you first need to download the <a href="https://jdk.java.net/">Java Development Kit</a>, or JDK for short. If you’re a Linux or Mac user, you can just follow <a href="https://openjdk.java.net/install/">their installation tutorial</a>, and if you’re on Windows, you can follow <a href="https://stackoverflow.com/a/52531093">this tutorial from Stack Overflow</a>. To check if the installation worked, you can just type <code class="language-plaintext highlighter-rouge">java -version</code> into a command prompt (which you can open on Windows by just typing <code class="language-plaintext highlighter-rouge">cmd</code> into your search).</p>

<p>Some people might disagree with me on this, but I recommend using an Integrated Development Environment (IDE) for development <em>especially</em> when you’re just starting out. An IDE is a program that helps you with coding by suggesting changes, notifying you of errors in your code and also allows you to easily run and debug your application. My personal suggestion would be to install <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a>, but you could also use other IDEs like <a href="https://www.eclipse.org/downloads/">Eclipse</a>.</p>

<p>The next thing you’ll have to do is create a new project inside your IDE. For IntelliJ, all you have to do is click <code class="language-plaintext highlighter-rouge">New Project</code>, select <code class="language-plaintext highlighter-rouge">Java</code>, click <code class="language-plaintext highlighter-rouge">Next</code> twice and then type your project’s name. I’m going to go with <code class="language-plaintext highlighter-rouge">JavaTutorial</code> for mine.</p>

<h2 id="hello-world">Hello World</h2>
<p>Once that’s done, we can finally start programming. At first, you’ll find that a lot of the stuff we’re doing isn’t explained directly, but I’ll come back to some of the things I’m showing you now at a later point. Things like classes, methods and parameters probably won’t make sense to you yet, but using them is required for even the most basic of running programs.</p>

<p>The first thing we want to do is create a simple program that outputs something back to the user inside of the program’s console. To start, simply right click your <code class="language-plaintext highlighter-rouge">src</code> folder and select <code class="language-plaintext highlighter-rouge">New</code> and <code class="language-plaintext highlighter-rouge">Java Class</code> and give it a name like <code class="language-plaintext highlighter-rouge">Main</code>. I’ll show you the code for it first and then give you a quick rundown of the important parts you need to know about it for now.</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Hello Tutorial World!"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>That’s it! If you now run your program (for IntelliJ, there should be a small green arrow to the left that you can click on), it’ll print out the message to the console and then stop the program.</p>

<p>A lot of the code you see above doesn’t <em>really</em> matter to you right now. The important stuff is this:</p>
<ul>
  <li>Each instruction, each thing that the program should do, ends with a semicolon <code class="language-plaintext highlighter-rouge">;</code> and usually a new line, though that is optional.</li>
  <li>Any instruction you write between the inner curly braces <code class="language-plaintext highlighter-rouge">{}</code> will be executed in order of how it’s written.</li>
  <li><code class="language-plaintext highlighter-rouge">System.out.println("&lt;enter anything here&gt;")</code> is an instruction that causes a line of text to be written to the console.</li>
</ul>

<p>As a little exercise, you can make your program output another line of text:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Hello Tutorial World!"</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This is another line of text!"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<h2 id="variables">Variables</h2>
<p>Now the first thing you’ll probably want to do is learn what variables are and how to use them. A variable, simply put, is any kind of value (a number, a string of text etc.) that can be changed and that has a name. In Java, each variable also has to have a fixed type: While a variable’s <em>value</em> can be changed (say, from <code class="language-plaintext highlighter-rouge">some text</code> to <code class="language-plaintext highlighter-rouge">some other text</code>), its <em>type</em> cannot be changed (so a variable representing text cannot be changed into a variable representing a number). Variables are created as follows:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Hello Tutorial World!"</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"This is another line of text!"</span><span class="o">);</span>

        <span class="nc">String</span> <span class="n">someText</span><span class="o">;</span>
        <span class="kt">int</span> <span class="n">someNumber</span><span class="o">;</span>

        <span class="n">someText</span> <span class="o">=</span> <span class="s">"Some Text"</span><span class="o">;</span>
        <span class="n">someNumber</span> <span class="o">=</span> <span class="mi">10</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see from line 6 and 7, to declare a variable, you need to put the variable’s type first (<code class="language-plaintext highlighter-rouge">String</code> meaning text, <code class="language-plaintext highlighter-rouge">int</code> meaning an integer; a number without a decimal point), followed by the variable’s name, which you can choose yourself.</p>

<p>For now, these variables don’t have a value assigned to them yet. That’s done in line 9 and 10. To assign a value to a variable, you first put the variable’s name, followed by an equals sign <code class="language-plaintext highlighter-rouge">=</code>, followed by your desired value. For numbers, you can simply put them down, but text has to be wrapped in quotes <code class="language-plaintext highlighter-rouge">""</code> (which is also why the text in lines 3 and 4 is wrapped in quotes).</p>

<p>To actually do something with the variables, let’s have them be printed out to the console. <em>I’ve omitted the rest of the code here because it’s getting quite long, but I’m just adding the following lines inside the inner braces <code class="language-plaintext highlighter-rouge">{}</code> below the already written code.</em></p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">someText</span><span class="o">);</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">someNumber</span><span class="o">);</span>
</code></pre></div></div>
<p>As you can see, to print a variable’s value to the console, all you have to do is put its name where you would usually put a piece of text directly.</p>

<h2 id="variable-manipulation">Variable Manipulation</h2>
<p>Obviously, this isn’t really that exciting yet: Our program isn’t really doing anything so far. Let’s manipulate our variables. I’ve added the following code:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">someNumber</span> <span class="o">=</span> <span class="n">someNumber</span> <span class="o">+</span> <span class="mi">5</span><span class="o">;</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">someNumber</span><span class="o">);</span>
</code></pre></div></div>
<p>As you can see, you can use a plus sign <code class="language-plaintext highlighter-rouge">+</code> (as well as other mathematical operators) to do math with numbers. The first statement changes <code class="language-plaintext highlighter-rouge">someNumber</code>’s value to a new value: <code class="language-plaintext highlighter-rouge">someNumber + 5</code>. Running the program will show you that the result is pretty obvious: 15 is printed, because 10 + 5 = 15.</p>

<p>The same kind of manipulation can be done with text, which is especially useful for printing variables to the console. The plus sign <code class="language-plaintext highlighter-rouge">+</code> chains two strings of text together.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">String</span> <span class="n">chainedText</span> <span class="o">=</span> <span class="s">"The resulting value is "</span> <span class="o">+</span> <span class="n">someNumber</span><span class="o">;</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">chainedText</span><span class="o">);</span>
</code></pre></div></div>
<p>Here, a new variable is created (<code class="language-plaintext highlighter-rouge">String chainedText</code>) and its value is set (<code class="language-plaintext highlighter-rouge">=</code>) to the shown string plus the value of the <code class="language-plaintext highlighter-rouge">someNumber</code> variable. When added to the rest of the code, running this code should display <code class="language-plaintext highlighter-rouge">The resulting value is 15</code>.</p>

<h2 id="conclusion">Conclusion</h2>
<p>Now obviously, this is just the beginning of what you can learn and do with Java. I feel like this is a good point to finish the first part of this tutorial. I know it’s probably not super interesting yet, but bear with me for a little while and you’ll pretty quickly be able to do some pretty cool stuff.</p>

<p>Before you click away, I’d like to ask you some questions that you can answer by clicking on the discussion link below this post:</p>
<ul>
  <li>Could you follow this tutorial?</li>
  <li>What do you think about the pacing? Is it too fast or too slow, are there too many examples or too few?</li>
  <li>Do you want me to actually continue this tutorial series?</li>
</ul>

<p>Anyway, thanks a lot for reading and happy coding! &lt;3</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Also, it’s what Minecraft mods are written in, which is probably the reason most of you are here. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Compiling is what occurs when code written by you is converted into something that the computer can actually understand. More on that later, probably. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[The first part of my post series for programming beginners where I explain how to write code in Java.]]></summary></entry><entry><title type="html">☕ Java Tutorial, Part 2: Intro to Conditions and Loops</title><link href="https://ellpeck.de/blog/java_2/" rel="alternate" type="text/html" title="☕ Java Tutorial, Part 2: Intro to Conditions and Loops" /><published>2019-10-10T00:00:00+00:00</published><updated>2019-10-10T00:00:00+00:00</updated><id>https://ellpeck.de/blog/java_2</id><content type="html" xml:base="https://ellpeck.de/blog/java_2/"><![CDATA[<p>If you’re reading this, then I assume you have already read the first part of this tutorial series, in which we covered setting up a program, making it print “Hello World” to the console, as well as how to declare and set the values of variables.</p>

<p>Today, we’ll be talking about conditions and loops.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> As with the last tutorial, I’ll be writing most of the code snippets first and then explaining what exactly they mean and do right after.</p>

<h2 id="the-if-condition">The <code class="language-plaintext highlighter-rouge">if</code> condition</h2>
<p>Let’s say you want to create a program that checks if a given number <code class="language-plaintext highlighter-rouge">i</code> is greater than or equal to 27. Well, you do it like this:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="c1">// This is where the code from the first tutorial would be</span>
        <span class="c1">// if I hadn't deleted it for visual clarity</span>

        <span class="c1">// Also, side note: You can use "//" to create comments:</span>
        <span class="c1">// lines that aren't interpreted as code.</span>

        <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">15</span><span class="o">;</span>
        <span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&gt;=</span> <span class="mi">27</span><span class="o">)</span> <span class="o">{</span>
            <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is greater than or equal to 27!"</span><span class="o">);</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>So what we see here is called the <code class="language-plaintext highlighter-rouge">if</code> condition. It’s structured as follows: You write the word <code class="language-plaintext highlighter-rouge">if</code>, followed by <em>the condition</em>, which is wrapped in parentheses <code class="language-plaintext highlighter-rouge">()</code>. You can then open curly braces <code class="language-plaintext highlighter-rouge">{}</code>, and any instructions that are written between them will only be executed if your supplied condition holds true.</p>

<p>The condition can be any statement that can either be <code class="language-plaintext highlighter-rouge">true</code> (correct) or <code class="language-plaintext highlighter-rouge">false</code> (incorrect). In this case, we’re comparing two numbers with each other; there are several other ways to compare two numbers: <code class="language-plaintext highlighter-rouge">&gt;</code>, <code class="language-plaintext highlighter-rouge">&lt;</code>, <code class="language-plaintext highlighter-rouge">&gt;=</code>, <code class="language-plaintext highlighter-rouge">&lt;=</code>, <code class="language-plaintext highlighter-rouge">!=</code> and <code class="language-plaintext highlighter-rouge">==</code>, where the last two mean “not equal” and “exactly equal”.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<p>An important thing to note at this point is that this behavior is <em>different</em> with <code class="language-plaintext highlighter-rouge">String</code> variables.<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup> Comparing if two strings are equal by using <code class="language-plaintext highlighter-rouge">==</code> will not result in the behavior you might expect. Instead, you should compare two strings using <code class="language-plaintext highlighter-rouge">equals()</code> as follows:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nc">String</span> <span class="n">s1</span> <span class="o">=</span> <span class="s">"This is some text"</span><span class="o">;</span>
<span class="nc">String</span> <span class="n">s2</span> <span class="o">=</span> <span class="s">"This is also some text"</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="n">s1</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">s2</span><span class="o">))</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"s1 and s2 are equal!"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>

<h3 id="the-boolean-type">The <code class="language-plaintext highlighter-rouge">boolean</code> type</h3>
<p>A condition like this (which can either be <code class="language-plaintext highlighter-rouge">true</code> or <code class="language-plaintext highlighter-rouge">false</code>) can also be stored in a <code class="language-plaintext highlighter-rouge">boolean</code> variable<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup> whose state can then be checked using a similar <code class="language-plaintext highlighter-rouge">if</code> statement:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">15</span><span class="o">;</span>
<span class="kt">boolean</span> <span class="n">i27</span> <span class="o">=</span> <span class="n">i</span> <span class="o">&gt;=</span> <span class="mi">27</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="n">i27</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is greater than or equal to 27!"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>The above code has the same effect as the code we looked at before. The cool thing about this method is that you can easily check if a condition <em>doesn’t</em> hold true by simply adding an exclamation point <code class="language-plaintext highlighter-rouge">!</code> in front of any boolean variable:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="o">(!</span><span class="n">i27</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is NOT greater than or equal to 27!"</span><span class="o">);</span>
<span class="o">}</span>

<span class="c1">// As you can see, this is especially useful when comparing strings</span>
<span class="nc">String</span> <span class="n">s1</span> <span class="o">=</span> <span class="s">"This is some text"</span><span class="o">;</span>
<span class="nc">String</span> <span class="n">s2</span> <span class="o">=</span> <span class="s">"This is also some text"</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(!</span><span class="n">s1</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">s2</span><span class="o">))</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"s1 and s2 are NOT equal!"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Additionally, two boolean variables (or simply two conditions) can be chained together in two ways:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">15</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">==</span> <span class="mi">12</span> <span class="o">||</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">13</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is either 12 or 13!"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&gt;=</span> <span class="mi">10</span> <span class="o">&amp;&amp;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">20</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is somewhere between 10 and 20"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see in lines 2 to 4, two pipes <code class="language-plaintext highlighter-rouge">||</code> represent the <code class="language-plaintext highlighter-rouge">OR</code> operator: A combined condition using it holds true if the left side is true, or the right side is true, or both sides are true.<br />
As you can see in lines 5 to 7, two ampersands <code class="language-plaintext highlighter-rouge">&amp;&amp;</code> represent the <code class="language-plaintext highlighter-rouge">AND</code> operator: A combined condition using it holds true if <em>both</em> sides are also true.</p>

<p>You can also wrap your checks in parentheses <code class="language-plaintext highlighter-rouge">()</code> to create a more complex condition, similarly to how you would use them in a mathematical expression:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">10</span><span class="o">;</span>
<span class="kt">int</span> <span class="n">k</span> <span class="o">=</span> <span class="mi">15</span><span class="o">;</span>
<span class="kt">boolean</span> <span class="n">combination</span> <span class="o">=</span> <span class="o">(</span><span class="n">j</span> <span class="o">==</span> <span class="mi">12</span> <span class="o">&amp;&amp;</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">13</span><span class="o">)</span> <span class="o">||</span> <span class="o">(</span><span class="n">j</span> <span class="o">==</span> <span class="mi">10</span> <span class="o">&amp;&amp;</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">25</span><span class="o">);</span>
<span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">combination</span><span class="o">);</span>
</code></pre></div></div>
<p>The above code will cause <code class="language-plaintext highlighter-rouge">true</code> to be printed if <code class="language-plaintext highlighter-rouge">j</code> equals 12 and <code class="language-plaintext highlighter-rouge">k</code> equals 13 <em>or</em> if <code class="language-plaintext highlighter-rouge">j</code> equals 10 and <code class="language-plaintext highlighter-rouge">k</code> equals 25. Otherwise, <code class="language-plaintext highlighter-rouge">false</code> will be printed.</p>

<h3 id="else"><code class="language-plaintext highlighter-rouge">else</code></h3>
<p>If you want something <em>else</em> to happen if a certain condition doesn’t hold true, then you can do something like the following:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">15</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&gt;=</span> <span class="mi">27</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is greater than or equal to 27!"</span><span class="o">);</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is less than 27 :("</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>As you can see, writing <code class="language-plaintext highlighter-rouge">else</code> after any <code class="language-plaintext highlighter-rouge">if</code> statement causes the code contained in the following curly braces <code class="language-plaintext highlighter-rouge">{}</code> to only be executed if the <code class="language-plaintext highlighter-rouge">if</code> statement’s condition <em>isn’t</em> true.</p>

<p>Optionally, you can also combine the <code class="language-plaintext highlighter-rouge">else</code> with another <code class="language-plaintext highlighter-rouge">if</code> statement to check for a different condition. You can do this as many times as you want:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">15</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&gt;=</span> <span class="mi">27</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is greater than or equal to 27!"</span><span class="o">);</span>
<span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">i</span> <span class="o">&lt;=</span> <span class="mi">10</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is less than 27, but also less than or equal to 10"</span><span class="o">);</span>
<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"i is somewhere between 11 and 26"</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>

<h2 id="the-for-loop">The <code class="language-plaintext highlighter-rouge">for</code> loop</h2>
<p>The <code class="language-plaintext highlighter-rouge">if</code> condition is already pretty powerful, because you can execute different code based on different situations. Another useful thing is the <code class="language-plaintext highlighter-rouge">for</code> loop. How it’s written and what it does can be a bit complicated to understand at first, but I’ll try to break the following example down for you:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="o">;</span> <span class="n">index</span> <span class="o">=</span> <span class="n">index</span> <span class="o">+</span> <span class="mi">1</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"The current index is "</span> <span class="o">+</span> <span class="n">index</span><span class="o">);</span>
<span class="o">}</span>
</code></pre></div></div>
<p>This specific <code class="language-plaintext highlighter-rouge">for</code> loop causes the following to be printed to the console:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>The current index is 0
The current index is 1
The current index is 2
</code></pre></div></div>
<p>As you might be able to tell from that, a <code class="language-plaintext highlighter-rouge">for</code> loop causes any number of instructions in it to be executed a certain amount of times.</p>

<p>Its structure is pretty similar to the <code class="language-plaintext highlighter-rouge">if</code> statement’s: First, you write the word <code class="language-plaintext highlighter-rouge">for</code>, followed by some loop instructions inside parentheses <code class="language-plaintext highlighter-rouge">()</code>, and then you open curly braces <code class="language-plaintext highlighter-rouge">{}</code> which contain the instructions that should be executed multiple times. The loop instructions contain three parts, which are separated by semicolons <code class="language-plaintext highlighter-rouge">;</code>:</p>
<ul>
  <li><code class="language-plaintext highlighter-rouge">int index = 0;</code> is the declaration of the <em>loop variable</em>: This is the instruction that will be executed <em>before</em> the loop starts running.</li>
  <li><code class="language-plaintext highlighter-rouge">index &lt; 3;</code> is the <em>loop’s condition</em>: Before every time the loop’s content is run, a check is done to make sure that this condition is still true. If it’s not true anymore, the loop stops running.</li>
  <li><code class="language-plaintext highlighter-rouge">index = index + 1</code> is the instruction that is executed <em>after</em> every time the loop’s content has finished running.</li>
</ul>

<p>So in the case of our loop, the following things happen:</p>
<ul>
  <li>The <code class="language-plaintext highlighter-rouge">index</code> variable is declared and set to 0.</li>
  <li><code class="language-plaintext highlighter-rouge">index &lt; 3</code> is checked, which is obviously true.</li>
  <li>The loop’s content is run, which causes the print to the console.</li>
  <li><code class="language-plaintext highlighter-rouge">index = index + 1</code> is executed, which sets <code class="language-plaintext highlighter-rouge">index</code> to 1.</li>
  <li><code class="language-plaintext highlighter-rouge">index &lt; 3</code> is checked, which is still true.</li>
  <li>The loop’s content is run again, and so on.</li>
</ul>

<h3 id="break"><code class="language-plaintext highlighter-rouge">break</code></h3>
<p>If you want to exit a <code class="language-plaintext highlighter-rouge">for</code> loop before its condition turns to <code class="language-plaintext highlighter-rouge">false</code>, you can use the <code class="language-plaintext highlighter-rouge">break;</code> statement as follows:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="mi">10000</span><span class="o">;</span> <span class="n">index</span> <span class="o">=</span> <span class="n">index</span> <span class="o">+</span> <span class="mi">1</span><span class="o">)</span> <span class="o">{</span>
    <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"The current index is "</span> <span class="o">+</span> <span class="n">index</span><span class="o">);</span>

    <span class="k">if</span> <span class="o">(</span><span class="n">index</span> <span class="o">&gt;=</span> <span class="mi">2</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">break</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p>This loop has the same effect as the one we looked at before. Despite the loop condition specifying that it should repeat 10000 times, it is only repeated three times, because the condition on line 4 is evaluated every time and the loop is forced to stop running once it is true.</p>

<h2 id="conclusion">Conclusion</h2>
<p>In this tutorial, you (hopefully) learned what the <code class="language-plaintext highlighter-rouge">if</code> and <code class="language-plaintext highlighter-rouge">for</code> statements are and how to use them. By now, you should be able to write some more complicated code. As a little exercise, you can try to solve the following problem using the things you learned in the last two tutorials:</p>

<blockquote>
  <p>Given a variable <code class="language-plaintext highlighter-rouge">i</code> and another variable <code class="language-plaintext highlighter-rouge">exp</code>, calculate if the result of <code class="language-plaintext highlighter-rouge">i</code><sup><code class="language-plaintext highlighter-rouge">exp</code></sup> (<code class="language-plaintext highlighter-rouge">i</code> to the power of <code class="language-plaintext highlighter-rouge">exp</code>) is less than or equal to the value of another variable <code class="language-plaintext highlighter-rouge">j</code> (and print the result to the console accordingly).</p>
</blockquote>

<p>If you’re stuck, you can check out my solution <a href="https://gist.github.com/Ellpeck/999bafe352f84d5e1f09750e026d5bbf">here</a>.</p>

<p>Thanks for reading this tutorial and I hope it helped you out! If you have any feedback or questions about it, you can click the discussion link below and ask me on Twitter, or join my Discord server using the widget on the main page. Happy coding!</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>I’m covering this topic <em>before</em> I cover what exactly classes and methods are. I think that conditions and loops take importance here, because they’re used broadly in every language as well as most programs, whereas object orientation is a feature specific to some languages, as well as specific to more “complex” programs. It’s also somewhat complicated, and I want to explain it right, because when I learned Java, I didn’t even remotely understand it correctly at first. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Note that, when <em>comparing</em> two numbers, two equals signs <code class="language-plaintext highlighter-rouge">==</code> are used. This is different from <em>assigning a value</em> to a variable, which only uses one equals sign <code class="language-plaintext highlighter-rouge">=</code>. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>Why exactly this is the case will be discussed later when we get into object orientation. The different behavior mentioned here is the case for any variable types which aren’t so-called <em>native types</em>. Any variable whose type starts with an uppercase letter is not a native type, because it derives from a <em>class</em>. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:4" role="doc-endnote">
      <p>Named after <a href="https://en.wikipedia.org/wiki/George_Boole">George Boole</a>, a mathematician. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[The second part of my post series for programming beginners. This one is all about conditions and loops.]]></summary></entry><entry><title type="html">⬇️ How to make a Rock Bottom mod</title><link href="https://ellpeck.de/blog/rock_bottom_mod/" rel="alternate" type="text/html" title="⬇️ How to make a Rock Bottom mod" /><published>2019-10-03T00:00:00+00:00</published><updated>2019-10-03T00:00:00+00:00</updated><id>https://ellpeck.de/blog/rock_bottom_mod</id><content type="html" xml:base="https://ellpeck.de/blog/rock_bottom_mod/"><![CDATA[<p>So it’s been a hot minute since I stopped working on my first big game project, <a href="https://rockbottomgame.com">Rock Bottom</a>. Since then, I’ve changed a lot, but the game hasn’t changed that much: For a long time, the project was vacant, until I decided to make it open source. From that point on, a couple of my friends started working on it, adding some new features and fixing some bugs, until it seemingly fell back into vacancy over the last couple of weeks.</p>

<p>So let’s port my recent Minecraft mod, <a href="https://www.curseforge.com/minecraft/mc-mods/natures-aura">Nature’s Aura</a>, to Rock Bottom!</p>

<p><strong><em>Note: This is not a tutorial.</em></strong></p>

<h2 id="setting-up-the-dev-environment">Setting up the dev environment</h2>
<p>Now I <em>somewhat</em> remember that, back when I was working on the game, I set up a pretty in-depth modding API as well as an actual Github project to easily allow people to set up a mod themselves.</p>

<p><em>Aha, here it is: <a href="https://github.com/RockBottomGame/Modding">the modding repo</a>.</em> It even has some nice documentation that I apparently made! Okay, here goes.</p>

<p>Okay, finding <a href="https://github.com/RockBottomGame/RockBottom/releases">a build of the game</a> was pretty easy. It even has an in-depth changelog! Good on you, raphy.</p>

<p>Hm. Okay.<br />
So something’s already broken.<br />
<img src="rbm_1.png" alt="" /></p>

<p>It looks like here</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dependencies {
    compile group: 'de.ellpeck.rockbottom', name: 'RockBottomAPI', version: '+'
}
</code></pre></div></div>
<p>where it says <code class="language-plaintext highlighter-rouge">+</code>, it should actally be saying a specific version. So let’s replace that with <code class="language-plaintext highlighter-rouge">0.4.6-753</code> and refresh.</p>

<p>That didn’t seem to fix it either. Huh. Taking a look at <a href="https://maven.chaosfield.at/de/ellpeck/rockbottom/RockBottomAPI/0.4.6-753/">the maven</a>, it seems to be currently down because of <code class="language-plaintext highlighter-rouge">502 bad gateway</code>. Fun.</p>

<p>Okay, it’s now the next day and it looks like the maven has been fixed, which is nice. So all the compile issues are finally resolved, I put the build into the <code class="language-plaintext highlighter-rouge">/gamedata</code> folder like explained in the tutorial, I renamed the examplemod to <code class="language-plaintext highlighter-rouge">NaturesAura</code>, and I can now finally try running the game!</p>

<p><img src="rbm_2.png" alt="" />
Ah! That worked quite well in the end.</p>

<h2 id="actually-making-something">Actually making something</h2>
<p>So I feel like the first thing I should add to the game is the golden leaves, because they’re also the first thing that you have to create when getting started with the Minecraft version of Nature’s Aura.</p>

<p>So I quickly made a new class that extends <code class="language-plaintext highlighter-rouge">TileBasic</code>, which I vaguely remember was like an extended, better version of the <code class="language-plaintext highlighter-rouge">Tile</code> class with some useful helper methods.</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">package</span> <span class="nn">de.ellpeck.naturesaura.tiles</span><span class="o">;</span>

<span class="kn">import</span> <span class="nn">de.ellpeck.rockbottom.api.tile.TileBasic</span><span class="o">;</span>
<span class="kn">import</span> <span class="nn">de.ellpeck.rockbottom.api.util.reg.ResourceName</span><span class="o">;</span>

<span class="kd">public</span> <span class="kd">class</span> <span class="nc">TileGoldenLeaves</span> <span class="kd">extends</span> <span class="nc">TileBasic</span> <span class="o">{</span>

    <span class="kd">public</span> <span class="nf">TileGoldenLeaves</span><span class="o">(</span><span class="nc">ResourceName</span> <span class="n">name</span><span class="o">)</span> <span class="o">{</span>
        <span class="kd">super</span><span class="o">(</span><span class="n">name</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>My Java is pretty rusty, but I seem to remember all of the naming conventions and, coming from C#, do find myself having trouble with the lowerCamelCase methods (because C# uses UpperCamelCase for method names, conventionally). I quickly made a <code class="language-plaintext highlighter-rouge">Tiles</code> class that’s going to house all the tiles I create and made an instance of the golden leaves tile.</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">package</span> <span class="nn">de.ellpeck.naturesaura.tiles</span><span class="o">;</span>

<span class="kn">import</span> <span class="nn">de.ellpeck.naturesaura.NaturesAura</span><span class="o">;</span>
<span class="kn">import</span> <span class="nn">de.ellpeck.rockbottom.api.tile.Tile</span><span class="o">;</span>

<span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="nc">Tiles</span> <span class="o">{</span>

    <span class="kd">public</span> <span class="kd">static</span> <span class="kd">final</span> <span class="nc">Tile</span> <span class="no">GOLDEN_LEAVES</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">TileGoldenLeaves</span><span class="o">(</span><span class="nc">NaturesAura</span><span class="o">.</span><span class="na">createRes</span><span class="o">(</span><span class="s">"golden_leaves"</span><span class="o">));</span>

<span class="o">}</span>
</code></pre></div></div>

<p>I also created a dummy instance of the Tiles class so that the static variables in it are loaded. If you’re not extremely familiar with Java, then this might appear a bit weird for you, but static variables of a class only get instantiated once the class is first used in some way (be it instance creation, method calling, stuff like that), and because I want the golden leaves to be initialized in the <code class="language-plaintext highlighter-rouge">preInit</code> phase of the game, I just do this:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nd">@Override</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">preInit</span><span class="o">(</span><span class="nc">IGameInstance</span> <span class="n">game</span><span class="o">,</span> <span class="nc">IApiHandler</span> <span class="n">apiHandler</span><span class="o">,</span> <span class="nc">IEventHandler</span> <span class="n">eventHandler</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="na">modLogger</span><span class="o">.</span><span class="na">info</span><span class="o">(</span><span class="s">"Starting Nature's Aura for RockBottom"</span><span class="o">);</span>
    <span class="k">new</span> <span class="nf">Tiles</span><span class="o">();</span>
<span class="o">}</span>
</code></pre></div></div>

<p>So far, so good. Let’s figure out how to add a texture to the thing.<br />
I somewhat remember that I made a horrible json-based asset system (instead of just loading all of the assets in the mod’s jar automatically), so I’m going to try to add my tile to the <code class="language-plaintext highlighter-rouge">assets.json</code> file the example mod provided me with and also add a texture into the actual file system.</p>

<p><img src="rbm_3.png" alt="" />
This is the folder structure I decided on. I also created a quick golden version of the game’s leaves texture by going to the <a href="https://github.com/RockBottomGame/Assets">asset repository</a>, stealing the leaves texture and recoloring it to be golden-ish.</p>

<p>Also, I put this in the assets file, but I have no idea if that’s actually the right path. We’ll find out.</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"loc."</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
        </span><span class="nl">"us_english"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/loc/us_english.json"</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="nl">"tex."</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
        </span><span class="nl">"tiles."</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
            </span><span class="nl">"golden_leaves"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/tex/tiles/golden_leaves.png"</span><span class="w">
        </span><span class="p">}</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>Okay, let’s launch and see what happens. So I started the game, opened a lan server, opened the chat, typed <code class="language-plaintext highlighter-rouge">/items</code> to get a cheat menu, and… it’s not showing up. What did I do wrong?</p>

<p>After some thinking, it turns out that I forgot to actually <em>register</em> the tile. So I went back into my <code class="language-plaintext highlighter-rouge">Tiles</code> class and appended <code class="language-plaintext highlighter-rouge">.register()</code> to the end of the whole thing, like this:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>public static final Tile GOLDEN_LEAVES = new TileGoldenLeaves(NaturesAura.createRes("golden_leaves")).register();
</code></pre></div></div>
<p><em>Crisis averted</em>.</p>

<p><img src="rbm_4.png" alt="" />
Yaaay, it… worked? <em>Somewhat?</em></p>

<p>You’re probably yelling at your screen by now, but yes, I finally noticed it as well: My assets path says <code class="language-plaintext highlighter-rouge">examplemod</code> instead of <code class="language-plaintext highlighter-rouge">naturesaura</code>. Easy fix, though.</p>

<p>While I’m at it though, I can also add a localization entry for the golden leaves. When hovering over it, the console informed me that <code class="language-plaintext highlighter-rouge">Localization with name naturesaura/item.golden_leaves is missing from locale with name us_english!</code>, so I quickly added it:</p>
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"naturesaura"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
        </span><span class="nl">"item."</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
            </span><span class="nl">"golden_leaves"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Golden Leaves"</span><span class="w">
        </span><span class="p">}</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>Let’s try again.</p>

<p><img src="rbm_5.png" alt="" />
Ta-da! Success, at last.</p>

<p>After some investigation, I realized that Rock Bottom’s normal leaves can be walked through, so let’s see how to make that happen. Typing <code class="language-plaintext highlighter-rouge">@Override</code> while in the <code class="language-plaintext highlighter-rouge">TileGoldenLeaves</code> class causes my IDE to list all of the methods I can override. Among them are two that interest me:</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nd">@Override</span>
<span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">isFullTile</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>

<span class="nd">@Override</span>
<span class="kd">public</span> <span class="nc">BoundBox</span> <span class="nf">getBoundBox</span><span class="o">(</span><span class="nc">IWorld</span> <span class="n">world</span><span class="o">,</span> <span class="nc">TileState</span> <span class="n">state</span><span class="o">,</span> <span class="kt">int</span> <span class="n">x</span><span class="o">,</span> <span class="kt">int</span> <span class="n">y</span><span class="o">,</span> <span class="nc">TileLayer</span> <span class="n">layer</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>It seems like this is what I have to do to make the tile walk-through…able. Let’s try it out.</p>

<p><img src="rbm_6.png" alt="" />
Yay, that seems to have worked. Great.</p>

<h2 id="making-an-item">Making an item</h2>
<p>Now that I have somewhat of a grip of this whole Rock Bottom stuff again, I’m quickly going to make an item. I won’t bore you with the details as it’s pretty similar to making a tile, but the gist of it is this: I made an <code class="language-plaintext highlighter-rouge">ItemGoldPowder</code> class that extends <code class="language-plaintext highlighter-rouge">ItemBasic</code>, and I initialized and registered an instance of that in my newly created <code class="language-plaintext highlighter-rouge">Items</code> class, of which I created an instance in my mod class’s <code class="language-plaintext highlighter-rouge">preInit</code> method so that it gets initialized at the right time. Also, I did all of the annoying asset mumbo jumbo.</p>

<p><img src="rbm_7.png" alt="" />
<em>Oh, C#, you’ve ruined me.</em></p>

<h2 id="making-stuff-happen">Making stuff happen</h2>
<p>Now, to actually make the gold powder turn normal leaves into golden leaves, I have to write some actual code that isn’t just boring boilerplate. When right clicking the golden powder onto a leaves tile, I want that tile to turn into the golden leaves. Eventually, they should then <em>transition</em> somehow, but… I’ll leave that for later.</p>

<p>Let’s write some code!</p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nd">@Override</span>
<span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">onInteractWith</span><span class="o">(</span><span class="nc">IWorld</span> <span class="n">world</span><span class="o">,</span> <span class="kt">int</span> <span class="n">x</span><span class="o">,</span> <span class="kt">int</span> <span class="n">y</span><span class="o">,</span> <span class="nc">TileLayer</span> <span class="n">layer</span><span class="o">,</span> <span class="kt">double</span> <span class="n">mouseX</span><span class="o">,</span> <span class="kt">double</span> <span class="n">mouseY</span><span class="o">,</span> <span class="nc">AbstractEntityPlayer</span> <span class="n">player</span><span class="o">,</span> <span class="nc">ItemInstance</span> <span class="n">instance</span><span class="o">)</span> <span class="o">{</span>
    <span class="kt">var</span> <span class="n">state</span> <span class="o">=</span> <span class="n">world</span><span class="o">.</span><span class="na">getState</span><span class="o">(</span><span class="n">layer</span><span class="o">,</span> <span class="n">x</span><span class="o">,</span> <span class="n">y</span><span class="o">);</span>
    <span class="k">if</span> <span class="o">(</span><span class="n">state</span><span class="o">.</span><span class="na">getTile</span><span class="o">()</span> <span class="o">!=</span> <span class="nc">GameContent</span><span class="o">.</span><span class="na">TILE_LEAVES</span><span class="o">)</span>
        <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
    <span class="n">world</span><span class="o">.</span><span class="na">setState</span><span class="o">(</span><span class="n">layer</span><span class="o">,</span> <span class="n">x</span><span class="o">,</span> <span class="n">y</span><span class="o">,</span> <span class="nc">Tiles</span><span class="o">.</span><span class="na">GOLDEN_LEAVES</span><span class="o">.</span><span class="na">getDefState</span><span class="o">());</span>
    <span class="n">player</span><span class="o">.</span><span class="na">getInv</span><span class="o">().</span><span class="na">remove</span><span class="o">(</span><span class="n">player</span><span class="o">.</span><span class="na">getSelectedSlot</span><span class="o">(),</span> <span class="mi">1</span><span class="o">);</span>
    <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>While writing this code, I quickly remembered that Rock Bottom has a tile state system similar to Minecraft, so I had to work with that. Before I realized, I sat there wondering why <code class="language-plaintext highlighter-rouge">IWorld</code> doesn’t have a <code class="language-plaintext highlighter-rouge">getTile</code> method anywhere. Anyway, this should check the interacted tile; see if it’s leaves; replace the leaves with golden leaves and deduct one from the item being currently held (which is obviously the gold powder, as this is in the <code class="language-plaintext highlighter-rouge">ItemGoldPowder</code> class. No need for checks there.)</p>

<p>Let’s try it out! …yea, no. The Java version that gradle uses to compile a Rock Bottom mod isn’t new enough yet: You can’t use the <code class="language-plaintext highlighter-rouge">var</code> keyword. Oh, my poor, poor C# soul. So let’s swap that <code class="language-plaintext highlighter-rouge">var</code> out for a <code class="language-plaintext highlighter-rouge">TileState</code>.</p>

<p><img src="rbm_8.gif" alt="" />
Yay, it works! <em>Except that, in the gif, the mouse position is weirdly offset for some reason. It’s correct in person, I promise!</em></p>

<h2 id="conclusion">Conclusion</h2>
<p>So yea, that was the start of my adventure back into Java, back into my old game and back into… well, modding, I guess. I hope you enjoyed reading this post and seeing my process of working out how to do stuff.</p>

<p>I think it’s important to remember that, as a developer (especially an indie developer), you don’t have to code everything perfectly or work stuff out correctly the first try. I mean, heck, this is my own game, and I completely forgot how to make a mod for it. But it was fun to figure it out again, and to get back into something I made two years ago.</p>

<p>Oh, also, if you really want, <a href="NaturesAuraRockBottom-0.1.jar">here’s a build of the mod</a> that you can try out yourself, as the game is now actually open source and available to everyone! I created this jar with the command <code class="language-plaintext highlighter-rouge">gradlew build</code>, and all you have to do to run it is <a href="https://github.com/RockBottomGame/RockBottom/releases">download the game</a>, run it once, and then stick the mod jar into its <code class="language-plaintext highlighter-rouge">mods</code> folder. It really doesn’t do that much right now, though, so I don’t know why you’d bother.</p>

<p>As always, thanks for reading!</p>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[My adventures back into a game I stopped working on about two years ago and how I start on a mod for it]]></summary></entry><entry><title type="html">⚔️ Big Projects</title><link href="https://ellpeck.de/blog/big_projects/" rel="alternate" type="text/html" title="⚔️ Big Projects" /><published>2019-09-15T00:00:00+00:00</published><updated>2019-09-15T00:00:00+00:00</updated><id>https://ellpeck.de/blog/big_projects</id><content type="html" xml:base="https://ellpeck.de/blog/big_projects/"><![CDATA[<p>So I’m releasing a game soon. In December, to be exact. Here’s some stuff I did and learned after telling myself that <a href="https://ellpeck.itch.io/FoeFrenzy">Foe Frenzy</a> would be a <a href="https://ellpeck.de/#blog-small_projects">Small Project</a> until it suddenly became the first game I’d ever release as a commercial product.</p>

<h2 id="in-discord">In Discord</h2>
<p>After deciding that I’d only be selling my game on itch.io, I quickly realized that that might not be the best of ideas in the long run, because few people actually know about the platform - despite it being pretty great.</p>

<p>So I decided to also sell the game on Discord - the Skype-Teamspeak-IRC-hybrid that recently also became a game store. As it turns out, this was <em>surprisingly</em> easy: All you have to do is pay $25, go through a really well organized checklist that is provided in Discord’s usual jokey writing style and submit. Tada! Your game’s on Discord now.<br />
By the way, in case you actually want to see what Foe Frenzy’s Discord store page currently looks like before release, you should <a href="https://link.ellpeck.de/discordweb">join my Discord</a> and check out its <code class="language-plaintext highlighter-rouge">#ff-store</code> channel (on Desktop). It looks pretty snazzy!</p>

<h3 id="oh-also">Oh, also:</h3>
<p>As it turns out, Discord has a game SDK. And Achievement support. And Lobbies, and Multiplayer, and Invites.</p>

<p>And surprisingly, integrating all of that with Foe Frenzy wasn’t necessarily the breeziest breeze ever, as I didn’t really have any example implementations or anything of the sort at hand, but it worked out in the end!</p>

<p>Foe Frenzy will have full compatibility with Discord’s Multiplayer features. What does this include, you ask?</p>

<ul>
  <li>After hosting a Multiplayer game from Foe Frenzy, you can invite your friends to play with you through the simple click of a button: &lt;blockquote class="twitter-tweet"&gt;&lt;p lang="en" dir="ltr"&gt;You'll also be able to easily invite people from inside the game! <a href="https://t.co/f3dixbwnxD">pic.twitter.com/f3dixbwnxD</a>&lt;/p&gt;— Ell (@Ellpeck) <a href="https://twitter.com/Ellpeck/status/1172990814072557573?ref_src=twsrc%5Etfw">September 14, 2019</a>&lt;/blockquote&gt; <script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></li>
  <li>When receiving an invite, you can simply click the Join button which will launch the game and instantly send you into your friend’s online lobby: &lt;blockquote class="twitter-tweet"&gt;&lt;p lang="en" dir="ltr"&gt;SOMETHING IS COMING <a href="https://t.co/ZWVUuRDhD3">pic.twitter.com/ZWVUuRDhD3</a>&lt;/p&gt;— Ell (@Ellpeck) <a href="https://twitter.com/Ellpeck/status/1172954763803136001?ref_src=twsrc%5Etfw">September 14, 2019</a>&lt;/blockquote&gt; <script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></li>
  <li>From there, you can play online without needing to expose your IP, fiddle around with your router settings or really do anything else.</li>
  <li>And have I mentioned… you’ll be able to use these features even when buying the game from itch.io, you’ll be able to combine Discord and IP-based multiplayer, and you’ll even be able to combine online multiplayer and local multiplayer! <em>So many possibilities!</em></li>
</ul>

<p>So yea. That’s pretty exciting.</p>

<h2 id="music-and-trailer">Music and Trailer</h2>
<p>So for a rather long time now, I’ve been watching a YouTuber called <a href="https://youtube.com/ThinMatrix">ThinMatrix</a> develop his own game, and simultaneously listening to the amazing music for said game, created by the lovely <a href="https://twitter.com/JamalGreenMusic">Jamal Green</a>.</p>

<p>So after some contemplating (and a lot of anxiety), I decided to send him an email, and quite quickly, he replied and said that, yes indeed, he would love to create the soundtrack for Foe Frenzy. So that’s what he’s doing now, and it’s super awesome.</p>

<p>In case you haven’t seen it yet, here’s the announcement trailer for the game which features the awesome trailer theme that he created:</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/Z7ZeuVBNuf4" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

<p>So the moral of that is basically: If you like an artist and want to cooperate with them, don’t be scared to message them - the worst that can happen is they say no, and the best that can happen is that they create an awesome soundtrack for you!</p>

<h2 id="the-whole-platform-issue">The whole platform issue</h2>
<p>If you read all of my blog posts, you’ll know about the previous one I made about me trying to figure out how to get a MonoGame project to work well cross-platform without having to upgrade to the not-yet-well-supported .NET Core.</p>

<p>As it turns out, all I had to do was actually use versions of .NET Framework and netstandard (which is another build target that can be quite confusing to people that aren’t used to the whole .NET environment and the weird state it’s currently in) that actually, you know, <em>are compatible with each other</em>. So after sorting that out, I made <a href="https://github.com/Ellpeck/MonoKickstartAutoBundle">a little tool</a> that allows you to easily pack any .NET Framework application with Mono without having to even do so much as break a sweat. So that was quite handy.</p>

<h2 id="oh-god-what-if-no-one-buys-my-game">Oh God, what if no one buys my game</h2>
<p>Obviously, I have a lot of anxiety, as my Twitter feed, the <code class="language-plaintext highlighter-rouge">#feels</code> channel on my Discord and my therapist make pretty clear.</p>

<p>So a feeling I have almost <em>constantly</em> is the fear that my game won’t go well. That no one will care, that no one will buy it, that no one will enjoy it, that it’ll be rated horribly, that YouTubers will make fun of it, that… honestly, so many more stupid fears. And obviously, the release hasn’t happened yet, and so those fears are still there. But the best advice I can give is to just power through those fears if you also have them, because, as with the e-mail, the worst thing that can happen is that they come true - but the best thing that can happen is that they won’t. So, really, the only way it can go is up.</p>

<p>But also, in case you <em>do</em> buy the game once it comes out, and in case you also like it, please tell me. It would mean the world to me. Thanks so much.</p>

<p>Also, thanks for reading. &lt;3</p>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[How a once small project I even created a post about turned into the first game I'm selling: Foe Frenzy]]></summary></entry><entry><title type="html">😔 About Cross-Platform and Motivation</title><link href="https://ellpeck.de/blog/cross_platform_trainwreck/" rel="alternate" type="text/html" title="😔 About Cross-Platform and Motivation" /><published>2019-07-06T00:00:00+00:00</published><updated>2019-07-06T00:00:00+00:00</updated><id>https://ellpeck.de/blog/cross_platform_trainwreck</id><content type="html" xml:base="https://ellpeck.de/blog/cross_platform_trainwreck/"><![CDATA[<p>As originally a java kid, I’ve never had much trouble with making any of my programs work on Windows, Linux and Mac. With Java, all you have to do is make a jar and then tell people to install Java on their machine. That’s it. But oh boy, am I getting hit in the face hard now that I’m making a game with MonoGame and .NET Framework.</p>

<h2 id="the-story-with-all-its-horrible-parts">The story, with all its horrible parts</h2>
<p>Imagine you’re me. Imagine you’re just happily making a game and eventually you decide that you want to distribute it to testers.</p>

<h3 id="the-documentation">The documentation</h3>
<p>So you check the documentation of the framework you’re using: MonoGame, in my case. It advertises itself as being amazing at cross-platform, so I look around to find a simple tutorial on what to do to get my game working on Mac and Linux.</p>

<p>Mono is where it’s at. Okay. An open source implementation of .NET (or something like that) that works on Linux and Mac. Great! Now I just need to find out how to easily package that with my game, so that people on those operating systems don’t have to install it on their own.</p>

<h3 id="mono-kickstart">Mono Kickstart</h3>
<p>So there’s a project on GitHub with a MonoGame fork (meaning they should work together flawlessly!) called Mono Kickstart. It says that you can just add the files to your project, rename a couple of them, change one or two lines in a bash script and then your game will run smoothly on Linux and Mac without having to install Mono.</p>

<p>Yea, no. Some random issue about <code class="language-plaintext highlighter-rouge">System.Runtime.dll</code> not being found, no trace of the issue online, no tutorials anywhere, the Kickstart repository doesn’t have an Issues tab for some reason. Dead end.</p>

<h3 id="mkbundle">mkbundle</h3>
<p>Searching some more online, I found a tool contained in Mono called mkbundle, that, apparently, you can use to bundle standalone applications for Windows, Linux and Mac by just running a simple command. Seems easy enough.</p>

<p>Yea, no. Installing Mono on Windows is a huge pain. mkbundle’s target downloading doesn’t work on Windows, so I have to go into some obscure folders, download some obscure zips, rename them, move them around until it finally works.</p>

<p>Hah. For some reason, mkbundle now requires me to install Visual Studio. So I install their commandline build tools that, after asking in my Discord, are apparently what mkbundle wants to use for something.</p>

<p>So then it finally works, and I have a… yea, no. Apparently now, mkbundle can’t find <code class="language-plaintext highlighter-rouge">System.Runtime.dll</code>, just like Mono Kickstart couldn’t before. So I search around in some folders and notice that that dll is in a sub-folder instead of the main folder it tries to look for it in, so I tell mkbundle that it’s in that subfolder through a long and annoying addition to the command, and now it finally works.</p>

<p>Yea, just kidding. Now it crashes because it can’t find <code class="language-plaintext highlighter-rouge">stdint.h</code>. It’s neither telling me where it’s trying to look for it, nor why it even needs it, what it is or really anything of use at all. Dead end.</p>

<h3 id="net-core">.NET Core</h3>
<p>After some more looking, I find that .NET Core is basically a better version of .NET Framework (it’s actually a lot different, but that doesn’t matter in the scope of this post) that actually runs on multiple platforms natively.</p>

<p>So I go through the process of upgrading my game project from .NET Framework to .NET Core, and everything finally works. I can really easily use my IDE (Rider) to publish packaged builds of the game for Windows, Linux and Mac that don’t even need the user to have .NET Core installed.</p>

<p>Except that it doesn’t run on my Laptop for some strange reason. It runs fine on my PC, and it runs fine on my boyfriend’s computer and his Linux VM, but my Laptop has some obscure issue about MonoGame not being able to load the shaders it requires. There are also no traces of the issue online, and after some looking around, I realize that MonoGame’s .NET Core implementation is, according to the repository, just a hack that also hasn’t been updated in over a year. Dead end.</p>

<p>(Also, I had a weird issue where, with the newest version of MonoGame for .NET Core, my game would randomly stutter, and while the MonoGame Discord was unhelpful and one person was frankly unreasonably rude in my opinion, I found out that it isn’t the fault of my code (after plenty of profiling) and that the issue is easily fixed by downgrading to an earlier version. Why? Who even knows at this point.)</p>

<h3 id="so-i-guess-ill-just-force-the-user-to-install-mono-themselves-then">So I guess I’ll just force the user to install Mono themselves then</h3>
<p>I tested around a bit after going back to .NET Framework and it turns out that installing Mono on Linux isn’t actually that bad, and after you installed it, you don’t even have to run a special command to get the game to run. All you have to do is go into a terminal and run the game’s normal exe, and apparently mono figures itself out without needing to specifically call it. So that’s great!</p>

<p>Except that, on Mac, it seems to be a whole nother story altogether. The one person I asked to try it on Mac installed Mono, but then the system didn’t seem to realize that it was actually installed, as the <code class="language-plaintext highlighter-rouge">mono</code> command didn’t work, and just running the game’s exe directly also didn’t work.</p>

<h3 id="other-stuff-i-tried">Other stuff I tried</h3>
<p>Because it’s so fun, here’s a list of other stuff that I tried to use:</p>
<ul>
  <li>Some obscure NuGet package that’s supposed to make an easy <code class="language-plaintext highlighter-rouge">msbuild</code> command to bundle the game. Also didn’t work, but at least I submitted an issue to the project’s GitHub repository. We’ll see what happens, maybe this will be the saving grace.</li>
  <li>Some obscure program from three years ago, with outdated packages and outdated dependencies, that was supposed to make it really easy to bundle projects for all operating systems. It had the same <code class="language-plaintext highlighter-rouge">System.Runtime.dll</code> issue, but because it was so outdated anyway, I didn’t even bother investigating why.</li>
</ul>

<h3 id="conclusion">Conclusion?</h3>
<p>Honestly, I don’t know what to do at this point. After finding out how horrible it is to make anything work cross-platform, I’m genuinely considering just rewriting the entire game using libgdx (which is a game framework for Java), or something.</p>

<p>There’s no real conclusion to this, other than that it took me a whole lot of my time and energy and that it made me buy and eat way too many tubs of Ben &amp; Jerry’s ice cream, which is way too expensive, by the way.</p>

<h2 id="also-the-multiplayer-debacle">Also, the Multiplayer debacle</h2>
<p>As a little side note, I recently added Online Multiplayer to the game in question, using the C# networking library Lidgren.</p>

<p>Its UPnP implementation doesn’t seem to be with my router (or my something else), so I have to manually forward ports as if it were 2003.</p>

<p>Also, one of the testers has a completely different issue about incomplete packets that I have no idea about, and frankly, my energy to work on anything is so low at this point that I might as well just not care about it.</p>

<h2 id="conclusion-1">Conclusion</h2>
<p>If you’re thinking about becoming an indie developer, you’ll have to deal with this sort of stuff. And honestly, it’s going to bring you down. Quite a lot.</p>

<p>A couple weeks ago, I picked up this project again after taking a long break from it out of lack of motivation, and after picking it back up, I was so happy and energized. I reworked the art to make it look really great, I added more sounds, I hired a music artist, I started implementing online multiplayer, I set a personal roadmap for release on itch.io later this year.</p>

<p>And then this whole thing happened, and now my motivation is back to zero. It’s just extra frustrating to me because I was so excited about finally getting back the motivation that I had previously lost.</p>

<p>So yea. Thanks for reading, I guess. &lt;3</p>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[How moving from Java to C# taught me how horrible it is to create a cross-platform application with little to no knowledge or documentation]]></summary></entry><entry><title type="html">🗡️ Small Projects</title><link href="https://ellpeck.de/blog/small_projects/" rel="alternate" type="text/html" title="🗡️ Small Projects" /><published>2019-05-01T00:00:00+00:00</published><updated>2019-05-01T00:00:00+00:00</updated><id>https://ellpeck.de/blog/small_projects</id><content type="html" xml:base="https://ellpeck.de/blog/small_projects/"><![CDATA[<p>As it turns out, I struggle a lot with maintaining interest and motivation for working on bigger projects like my <a href="https://rockbottom.ellpeck.de/">other game</a> or my Minecraft mods. However, an easy fix for that would be to just start less big projects and focus more on smaller ones, like <strong>Foe Frenzy</strong>. Foe Frenzy is a game I’ve been working on for about a month now.</p>

<p><img src="contrib.png" alt="" /></p>

<p>The basic gameplay is finished, as is enough content for my friends to have been testing it for the last week or so and saying that they enjoy it quite a bit, both visually and gameplay-wise. I thought I’d make a blog post about my process of working on it, showing what it’s about and what I did this time around to make sure that I don’t get burnt out with it.</p>

<p><img src="overview.png" alt="" /></p>

<p><em>Foe Frenzy is a fast-paced fighting game where you battle up to three of your friends with random, short-lasting items in an attempt to be the last survivor.</em></p>

<h2 id="the-artstyle">The Artstyle</h2>
<p>Not every developer has this problem, but I know a lot do: The inability to make good-looking art. Well, I have this same problem too.<br />
A lot of times, I’ll find myself getting stuck on making art for my game projects and getting burnt out through trying too hard to force myself to make good-looking art.</p>

<p>So, this time around, what I did instead of doing that all over again, I just decided to go with <em>simple art</em> instead. For example, as you can see, all the tiles in the world only have 8x8 pixels, and all of them follow a really simple pattern: The top and left side are slightly darker, giving the world a really tiled feel and making the levels seem like they were made with actual building bricks. As well as that, the character movement animations are <em>really</em> simple.</p>

<p><img src="wobble.gif" alt="" /></p>

<p><img src="water_wobble.gif" alt="" /></p>

<p>Both of those aren’t even real animations per se, because what they really are is just the player’s static texture rotating around a sin wave that is centered on the player’s feet. It looks cute, though.</p>

<h2 id="the-inner-workings">The Inner Workings</h2>
<p>Whenever I write code, I tend to try to overoptimize it a lot. What I mean by that is that I think about systems that I want to implement too intricately sometimes. For instance, if I want to make a tile-based game, I obviously set up some data structures around tiles and how they’re going to be ordered and stored on the map. But then, I’ll also go and write a bunch of utility methods, conversion functions, figure out a really in-depth coordinate system for dynamic objects, and so on. And, honestly, for projects that aren’t too big, all of that isn’t really necessary.</p>

<p>What I did for this game instead is just kind of… let the code take me where it wants to. That may sound a bit ridiculous and performance-intensive, but it honestly works pretty well if you know what you’re doing with the framework you’re using. A lot of the code in this game is put together somewhat hackily. A lot of hard references to certain items and tile types (like how bombs can only turn grass into dirt and nothing else), a lot of messy utility functions all bunched together into a single class, very little documentation and abstract methods, hub interfaces for things that do similar things, and so on. But that’s fine, because this isn’t a huge project and I don’t plan on adding complicated systems like a modding API or anything like that, so it’d be unnecessary to waste my time on doing something overly fancy.</p>

<p>For example, the map parsing system is really simple: It consists of an XML file, which stores all the important information about a map like its name and the positions that players spawn in, and a png file.</p>

<p><img src="map.png" alt="" /></p>

<p>Each pixel in the file determines which tile will be put at its location. In this instance, black is deep water, blue is shallow water, yellow is sand and green is grass. And the cool thing is that this is really easy to deal with (reading pixels is a simple thing that’s present in almost every game framework), because changing something on the map just takes an image editing program, no custom map editor needed.</p>

<h2 id="the-gameplay">The Gameplay</h2>
<p>For some of the other games I’ve worked on, I’ve always had huge plans to start with. I had this one plan to make a big Animal Crossing-style game with real time progression, tons of NPCs, a lot of complicated gameplay mechanics. I’d worked on a game for over two years that was an open world sandbox, and it was supposed to have a huge story with optional, skippable elements, and… honestly, it’s hard to actually make all that happen, at least for me. At some point, I just start looking at it from a different perspective and thinking to myself “Why did I take on such a huge project? This is impossible.” and that makes me lose motivation.</p>

<p>So for Foe Frenzy, I went with a really simple concept that consists of a small amount of clearly definable main points:</p>
<ul>
  <li>Up to four players on a local computer, controlled by keyboard and gamepads</li>
  <li>Predefined maps that the players can choose</li>
  <li>Item spawners that spawn random items to battle or protect yourself with, where each of the items only lasts for a short time, so you have to keep going back and getting new ones</li>
  <li>Kill all the other players to win</li>
</ul>

<p>Because I had this clear plan in mind before starting the game, and because it’s really not that much to do (I’ve been working on the game for a month, and all that’s left to do is add more maps and more items to battle with), it’s been easy to stay on track and stay focused rather than burning out because of responsibility overload.</p>

<h2 id="so-yea">So yea…</h2>
<p>that’s what I’ve been doing for the last month, and that’s why <a href="https://minecraft.curseforge.com/projects/natures-aura">my other projects</a> have been suffering a little bit. But it’s been really fun, and I might even have something to actually release as a real, finished game some time in the near-ish future. It’s also been making me feel accomplished, because I’ve already been able to have my friends test the game out, and they say it’s been fun which means that I already accomplished a big part of what I wanted to accomplish with this game.</p>

<p>Keep updated about the game on <a href="https://link.ellpeck.de/discordweb">my Discord</a> as well as <a href="https://twitter.com/Ellpeck">my Twitter</a>, and I hope you enjoyed reading about the game and my development process so far.</p>

<p>To finish off, here are some more pictures of the game for your enjoyment.</p>

<p><img src="cave.png" alt="" />
A cave being lit up by torches and lava. This is where a rubber hammer can spawn that you can use to knock the other players into the lava.</p>

<p><img src="map_select.png" alt="" />
The map selection screen, where each player can choose the map that they’d like to play most.</p>

<p><img src="flame_thrower.gif" alt="" />
The favorite item I’ve added so far: The flamethrower.</p>

<p><img src="win.gif" alt="" />
Killing the last person alive and winning</p>]]></content><author><name>Ellpeck</name></author><category term="Programming" /><summary type="html"><![CDATA[Why creating a small, unplanned project is sometimes good for you]]></summary></entry><entry><title type="html">✨ Blogs are Cool, I Think</title><link href="https://ellpeck.de/blog/blogs_are_cool/" rel="alternate" type="text/html" title="✨ Blogs are Cool, I Think" /><published>2019-02-17T00:00:00+00:00</published><updated>2019-02-17T00:00:00+00:00</updated><id>https://ellpeck.de/blog/blogs_are_cool</id><content type="html" xml:base="https://ellpeck.de/blog/blogs_are_cool/"><![CDATA[<p>So I’ve been wanting to make a blog for a while, but never found the motivation to do so. Especially with all of the blog softwares out there, it was hard to figure out which one to use to make it fit this website and its design nicely.<br />
I didn’t really want to make a whole different page just for the blog because it would kind of throw the design off, so I took some inspiration from <a href="https://vazkii.us/#blog">Vazkii’s blog</a> and made mine work in a similar fashion. This still made it work with the single page design.</p>

<p>Now because I’m not good with PHP at all, I actually made this entire thing using only JavaScript. It’s.. a bit of a mess, honestly, but it works.</p>

<p>So here it is. Expect me to, very occasionally, do a post about one or the other random thing. <em>Enjoy!</em></p>]]></content><author><name>Ellpeck</name></author><category term="Miscellaneous" /><summary type="html"><![CDATA[The first post and how I created it]]></summary></entry><entry><title type="html">⚙️ Why You Should Mod Minecraft</title><link href="https://ellpeck.de/blog/why_you_should_mod_minecraft/" rel="alternate" type="text/html" title="⚙️ Why You Should Mod Minecraft" /><published>2019-02-17T00:00:00+00:00</published><updated>2019-02-17T00:00:00+00:00</updated><id>https://ellpeck.de/blog/why_you_should_mod_minecraft</id><content type="html" xml:base="https://ellpeck.de/blog/why_you_should_mod_minecraft/"><![CDATA[<p>So… for the last couple of years, the main thing I’ve been doing in my free time is game development and modding Minecraft, but the latter far more often and more consistently. I’ve learned a lot while doing this, but not only when it comes to programming and game development, but also when it comes to a lot of other things.<br />
So in this post, I want to introduce you to what’s so great about Minecraft modding and, honestly, why you should try doing it as well.</p>

<h2 id="programming-experience">Programming Experience</h2>
<p>Now, first and foremost, and I think this is definitely one of the most obvious point: It improves your programming experience by quite a bit. Both in the “understanding the language” department, but also, it helps you to do a couple of things that you’ll need if you want to deal with anything that other people have made:</p>
<ul>
  <li>Understanding someone else’s codebase and learning to navigate code that someone else has made, both documented and undocumented</li>
  <li>The beauty of learning how annoying it is to see code that’s made in a way that makes it <em>so unbelievably hard</em> to expand it, to build on it, and learning that, when making your own code, you most definitely shouldn’t do it like that.</li>
  <li>Learning to make something fit well with something other people have made. I’m sure this is also a useful skill to have in a job that includes team efforts: The same way a paper should have a unified style, it’s also not very nice to have high resolution textures in a mod for a game that has a very primitive artstyle.</li>
</ul>

<h2 id="easily-creating-things">Easily Creating Things</h2>
<p>When creating your own game, I’ve personally found that it’s pretty hard to get it off the ground at the start, because all you can see for the first couple of days are missing textures, placeholders, a missing main menu, janky controls and so on. When you’re making a mod for any game, but especially for Minecraft, you can create a single, small feature and then instantly start using it together with all of the other features that the game already provides for you.</p>

<p>It’s so much easier to get excited and satisfied about something you’ve made when it doesn’t take ages for it to actually look good in its intended environment - making a mod for a game is perfect for that.</p>

<h2 id="meeting-amazing-people">Meeting Amazing People</h2>
<p>This is something that definitely comes a bit later down the line, at least it did for me, but it’s also something that’s been really, really important to me. Through modding Minecraft, and especially by making <a href="https://minecraft.curseforge.com/projects/actually-additions">Actually Additions</a>, I’ve met so many amazing people and made a huge amount of new friends.<br />
And not only that, I’ve also met a lot of people that I really look(ed) up to and respect(ed), and then noticed how down to earth and nice they actually are (because after all, they’re also just people): Direwolf20, Vazkii and so many other people became my friends because it’s easy to get along well with someone that shares the same interests as you, especially when it’s an interest as passionate as the Minecraft Modding community.</p>

<h2 id="being-validated-by-thousands">Being Validated by Thousands</h2>
<p>This is one of the most important bits for me, honestly. I have pretty low self esteem (as a lot of introverted people on the internet do, I imagine), and it’s hard for me to be proud of something that I’ve created.<br />
But through the mods I’ve made, especially Actually Additions and recently also <a href="https://minecraft.curseforge.com/projects/natures-aura">Nature’s Aura</a>, I’ve been shown by so many people, both friends and complete strangers, that the stuff I make seems to be worth quite a lot to quite a lot of people, and that they’re passionate about my work, some maybe even more passionate than I am about it myself.</p>

<p>It feels so good to make something and to see people downloading it, people playing with it, people making videos about it and saying how nice they think it is. Trying to be validated isn’t “seeking attention”, it’s good for you, because it makes you feel like you’re worth a lot. Because you are.</p>

<h2 id="learning-to-deal-with-criticism">Learning to Deal With Criticism</h2>
<p>Also a big thing for me for sure. Because of my previously mentioned low self esteem, it’s been pretty hard for me to accept and deal with people saying that they dislike something that I’ve created.</p>

<p>But in the Minecraft modding community, oh boy, it’s a <em>huge</em> thing. The first thing you’ll get to hear about any new mod you publish is how it’s “<em>totally a ripoff of Thaumcraft and Botania</em>” and “<em>this is just Extra Utilities, but worse</em>”, and so on, and so forth. And.. at first, it can be quite demotivating, to say the least, because it sucks that people compare your thing to someone else’s thing, despite the fact that you put at least an equal amount of work in it, and despite the fact that it deserves the same amount of respect as that other thing.<br />
But that’s just the way people are, and sooner or later, you have to learn to accept that. And you will. Positive people will still be there, and the stuff you’ve made will still be loved by a lot of them.</p>

<p>And it’s not all bad either, in fact, the opposite is true: There are a <em>lot</em> of people that give you constructive criticism: “<em>I enjoyed this, but I think x, y and z could be changed and it would be even better.</em>” If you’re the kind of person that says this, then you’re a winner, because this helps not only the thing you’re commenting on, but also the person that’s made the thing: Now they know what you like, what you don’t like, but most importantly: <em>How to fix it for you</em>. And the best thing is: You as the creator don’t even have to listen to them if you disagree! They’ll probably understand, because they’re nice enough not to be dicks like the people I talked about before.</p>

<p>So keep on going, no matter what people say, because you’re probably awesome.</p>

<h2 id="basically-no-obligations">Basically No Obligations</h2>
<p>When making a game, or a “real” product in general, a lot of the time, you’re bound to certain obligations: Either it’s legal ones, or maybe you’ve done a Kickstarter, maybe the thing you make actually costs you quite a bit of money because you have a whole development team, stuff like that.<br />
Well with Minecraft modding, the only thing you have to deal with is people asking you when you’ll <em>finally</em> update to the next version. But if you’re sick of that, or sick of anything else, you can just stop, take a break, and do something else entirely for a while.</p>

<p>People might judge, but the important thing is: They don’t have a right to judge, because you can do whatever you want. It’s a hobby thing, so it’s your thing.</p>

<h2 id="so-yea">So yea,</h2>
<p>this is all of the stuff I could think of that inspires me to keep going with Minecraft Modding. It’s been a really awesome journey so far and I’m excited to keep going, to create more things and to see more things that other people created.</p>

<p>Thanks for reading! &lt;3</p>]]></content><author><name>Ellpeck</name></author><category term="Minecraft" /><category term="Programming" /><summary type="html"><![CDATA[About what makes Minecraft modding great and why you should probably try it if you enjoy programming]]></summary></entry></feed>