z

Young Writers Society



Sunny and the Syntax Errors of Doom: Chapter 8.1

by Spearmint


The rest of the train ride passed by uneventfully, although Sunny could have sworn that she saw an error flying by once. Or at least, something with red scribbles. But soon enough, the skyscrapers of Method City came into view, and the train slowed to a stop.

"We're here!" a young Javalandian cheered. Sunny couldn't help but crack a smile at that.

"Let's go, Robert! We're almost to the climax of our quest!" Sunny grinned at the robot, who reluctantly floated up out of his seat.

"Oh, joy. Cities are too loud to get any decent rest," he grumbled.

Despite his complaints, however, Sunny and Robert were soon standing on the train platform, looking at a map of Method City. Sunny pointed to a cartoon depiction of a mountain range near the top of the map. "I'm assuming Spaghetti Code Mountain is there?"

Robert snorted. "No, Sunny, it's actually down there, in the middle of the ocean."

"Wow, thanks." Sunny rolled her eyes. "Well, it looks like we're not too far… My stomach is telling me that it's around lunchtime, though, so are there any good places to eat around here?"

"I don't eat."

"Noted. But in your travels as an ambassador, have you heard people talking about nice cafés or restaurants around here?" Sunny persisted.

Robert hummed. "Hmm… Perhaps the Cinnamon Synonym Café? It's on the way to Spaghetti Code mountain."

"The Cinna- Synon–" Sunny gave up. "Alright, that sounds good."

The pair left the train station and, around a twenty-minute walk later, they arrived at the café. Sunny was still bubbling with the new sights and sounds of the city.

"Did you see that person juggling numbers? And the variapet show! Plus the street performers… I had no idea so many words rhymed with array."

Robert nodded along as he entered the café. "Shall we sit there?" The place was already starting to fill up with patrons for the lunch rush, and the table Robert indicated was squeezed into the back, next to a fake plant.

"Sure. And then there were a couple of ambassadors too– Robert, how come you don't have any fancy colors on you?"

"Customization is optional." Robert took a seat at the small table.

"Okay. But– ooh, such a cute menu!" Sunny got distracted by the glossy images of food. "The ampersand sandwich looks good. But so do the carat soup, and the hashtag hashbrowns…"

Robert closed his eyes. "Let me know when you're done. I need to conserve battery if we're not going to stop for a charge before heading to Spaghetti Code Mountain."

"Oh." Sunny had kind of wanted to ask him more about the quirks of Method City, but as Robert went to sleep, she shrugged and dedicated her full attention to the menu.

Before Sunny could decide on an item, a waitress arrived at their table. "Welcome to the Cinnamon Synonym Café! What can I get for you today?" She adjusted her apron and took out a piece of paper.

"What's popular here?" Sunny asked.

"Popular… popular…" the waitress whispered, scanning the piece of paper in her hand. "Aha! listPopularItems()." She cleared her throat, then pointed to the top of Sunny's menu. "The bracket burgers paired with curly braces fries are always a good choice. And we have the soup of the day, which is carat soup today. But if you're a little more adventurous, you might like the pear and parentheses pancakes special." She winked.

"Hmm. That sounds good! I'll have the pancakes, then." Sunny beamed.

The waitress glanced at her paper again, whispered, "noteDownOrder()," then took out a notepad and jotted something down on it. "Perfect. It'll be ready in around fifteen minutes." As the waitress turned to leave, the backwash from a customer walking by whisked the paper out of her hand, and it fluttered to Sunny's side of the table.

Curious, she picked it up. The top of the paper had a main method and a while loop written on it:

public static void main(String[] args) {

    while (true) {

        if (customer hasn't decided yet) {

            System.out.println("Do you need more time?);

        } else if (customer asks for more information) {

            listPopularItems();

        } else if (customer knows that they want) {

            noteDownOrder();

            break;

        } else {

            System.out.println("Do you need help figuring out what to order?);

        }

    }

    bringOrderToKitchen();

}

Below that, there was more text about listPopularItems() and noteDownOrder() and bringOrderToKitchen():

static String[] popularItems = {"brackets burgers with curly braces fries", "soup of the day", "pear and parentheses pancakes special"};

public static void listPopularItems() {

    for (int i = 0; i < popularItems.length; i++) {

        System.out.println(popularItems[i]);

    }

}

public static void noteDownOrder() {

    listenToCustomer();

    writeOrderInNotebook();

}

public static void bringOrderToKitchen() {

    walkToKitchen();

    giveOrderToChefs();

}

Sunny stared at the paper for a moment, trying to make sense of the code. "Robert? Are these methods?"

The robot cracked open an eye, then glanced at the paper that Sunny was holding out to him. "Indeed. It looks like listPopularItems(), noteDownOrder(), and bringOrderToKitchen() are all methods. Methods are kind of like variables, but they store actions instead of data. So once you write the method listPopularItems(), you can call it as many times as you want to repeat the actions inside the method. In this case, those actions would be printing the contents of the array popularItems."

The waitress shifted nervously. "Would you mind giving me my instructions back? I'm new here, and I need them to–"

"Oh! Sorry." Sunny quickly handed the paper back. "Thank you so much."

The waitress nodded and hurried away, and Sunny turned back to Robert. "So. Methods?"

Robert let out a long-suffering sigh. "What do you want to know about them?"

"Well, the methods on the paper had all those words in front of them, like public and static and void?"

"You don't need to worry about public and static for now; those are more important when you get into objects and classes. But void means that the method doesn't return anything."

"Return? Like, return clothing that doesn't fit?"

"I'm afraid not. A return value is something that the method sends back to wherever it was called. Here's an example." Robert flipped open the computer screen in his head.

public static void addAndPrint(int a, int b) {

    System.out.println(a + b);

}

public static int addAndReturn(int a, int b) {

    return a + b;

}

"So, here we have two different methods for adding. One prints the result, while the other returns it. Now, let's try calling both of these in the main method– remember, that's the place you put code that you want to execute."

public static void main(String[] args) {

    addAndPrint(1, 2);

}

Robert ran the program, and the number 3 printed onto the console. "So, addAndPrint directly prints the result. Let's see what addAndReturn does."

public static void main(String[] args) {

    addAndReturn(1, 2);

}

This time, nothing printed. "See? addAndReturn returns the value to the main method, but if you want to see it, you have to print it in the main method."

Sunny shook her head in confusion. "Okay, but then why would you ever return instead of printing? Don't you want to know the result of the method?"

"Not always," Robert explained. "Sometimes you want to do something else with the result of the method."

public static void main(String[] args) {

    System.out.println(addAndReturn(addAndReturn(1, 2), 5));

}

The program printed 8. "You can call methods multiple times. Here, if we had just printed 1+2, we wouldn't have been able to do anything with the sum afterwards. But by returning the value, we could call the addAndReturn method on it again, giving us the final answer of 8."

Sunny rubbed her head. "Oookay."

Robert summarized, "You should return values when you're going to do more with them later. Print them when all you want to do is know what those values are. But don't worry. Knowing which one to do will become natural as you gain more experience."

"I sure hope so." For the first time, Sunny felt a twinge of doubt in her abilities. Variables and loops and all had been easy enough to understand the first time they were explained to her, but methods? Even besides the print versus return thing, she wasn't really sure when or how to use them.

Hopefully Robert was right. She just needed more practice. Sunny comforted herself with rule #14, which was, "The bad guy strikes when you least expect it. Meaning, you'll never be a hundred percent ready." All she could do was learn as much as possible about the code this world ran on, and hope that was enough to be able to know how to defeat the enemy in the end...


Note: You are not logged in, but you can still leave a comment or review. Before it shows up, a moderator will need to approve your comment (this is only a safeguard against spambots). Leave your email if you would like to be notified when your message is approved.







Is this a review?


  

Comments



User avatar
3821 Reviews


Points: 3891
Reviews: 3821

Donate
Wed Feb 01, 2023 4:12 am
View Likes
Snoink wrote a review...



Hello again! :)

"Let's go, Robert! We're almost to the climax of our quest!" Sunny grinned at the robot, who reluctantly floated up out of his seat.


But she hasn't really encountered many trials and tribulations??

I dunno... if I were Sunny, I would be a little nervous because either I was just so good at questing that everything was going right, OR things were too easy and would suddenly get insurmountably harder. If that makes sense. Or, since we're taking about Sunny, I might be kind of annoyed that my quest was slightly on the boring side, considering how fantasy quests go. Like, she alludes to it a little bit, but she doesn't say it outrightly.

"Wow, thanks." Sunny rolled her eyes. "Well, it looks like we're not too far… My stomach is telling me that it's around lunchtime, though, so are there any good places to eat around here?"

"I don't eat."


Short answers, haha. Gotta love the curtness. (Yes, I will forever love Robert...)

Robert hummed. "Hmm… Perhaps the Cinnamon Synonym Café? It's on the way to Spaghetti Code mountain."


I honestly want this to be a real restaurant name. It is way too fun.

Robert nodded along as he entered the café. "Shall we sit there?" The place was already starting to fill up with patrons for the lunch rush, and the table Robert indicated was squeezed into the back, next to a fake plant.

"Sure. And then there were a couple of ambassadors too– Robert, how come you don't have any fancy colors on you?"


OKAY. SO. THIS IS TOTALLY PETTY, BUT.

I am slightly disappointed that Sunny didn't use this as a way to turn this around on Robert after his previous eating remark. Like, I would have been tempted to grin and say, "I thought you couldn't sit?" Like, I don't think Sunny would be mean about it, but just like some good-natured teasing...

Robert closed his eyes. "Let me know when you're done. I need to conserve battery if we're not going to stop for a charge before heading to Spaghetti Code Mountain."


Wouldn't they have some sort of charging station for Robert? Either here or on the train? Or is it just such a long journey that he ought to prepare for it regardless of how much he is powered up now?

...I don't think the method example is entirely clear-cut. I am not sure why Robert won't bother telling her about public or static and instead only concentrate on void. Like, when I look at the waitress's code, it makes sense, but I think Robert's explanation kind of muddies it. I'm not sure if you want to make it muddy or not though, because Sunny is experiencing doubt, so maybe that is your intention? But also, it was kind of a cute, educational experience, so I dunno. Take it as you will, I guess!

Hopefully Robert was right. She just needed more practice. Sunny comforted herself with rule #14 , which was, "The bad guy strikes when you least expect it. Meaning, you'll never be a hundred percent ready." All she could do was learn as much as possible about the code this world ran on, and hope that was enough to be able to know how to defeat the enemy in the end...


A little bit of foreshadowing????

Just a comment... it's not exactly clear that it's a "who" that Sunny will be facing at this point. For a long time, I thought this was a Sunny vs. Nature story where there wouldn't be a bad guy necessarily, but a muddle of spaghetti code at spaghetti mountain. (Honestly, I was kind of picturing a mountain of noodles, lol). So you might want to foreshadow that there is an actual villain (yes, yes, I've read ahead a little bit) before you show him to us. Otherwise, he might seem random.

(On a personal note, I totally made this mistake for Book 3... it was a bit of a random surprise in the first draft when the villain wasn't actually Cyrus, haha. I'm still not sure that it's completely clear now, but lemme tell you, that first draft was a MESS, lol.)




Spearmint says...


But she hasn't really encountered many trials and tribulations??

I dunno... if I were Sunny, I would be a little nervous because either I was just so good at questing that everything was going right, OR things were too easy and would suddenly get insurmountably harder. If that makes sense. Or, since we're taking about Sunny, I might be kind of annoyed that my quest was slightly on the boring side, considering how fantasy quests go. Like, she alludes to it a little bit, but she doesn't say it outrightly.

...The trials and tribulations part will be fixed. Hopefully. >.> Although yeah, I think it'd still be good to add Sunny's thoughts/expectations!
(Yes, I will forever love Robert...)

I love your love for Robert. XD
Like, I would have been tempted to grin and say, "I thought you couldn't sit?" Like, I don't think Sunny would be mean about it, but just like some good-natured teasing...

Omg, that is so perfect! XDD
I'm not sure if you want to make it muddy or not though, because Sunny is experiencing doubt, so maybe that is your intention?

I do want it to be muddy to Sunny, but not to the reader. Hm. *thinking face*
Just a comment... it's not exactly clear that it's a "who" that Sunny will be facing at this point. For a long time, I thought this was a Sunny vs. Nature story where there wouldn't be a bad guy necessarily, but a muddle of spaghetti code at spaghetti mountain.

That's very valid. I wasn't sure myself that the cause of the error disappearance would be a person until like halfway through the story, I think... Thanks for all your helpful comments!! <3



Snoink says...


...honestly. I thought Book 3 was going to have a different ending until halfway through when I realized that Adelore was the wrong narrator for the last part. XD There needed to be someone somewhat less involved with the wedding scene, after all! :)



Spearmint says...


oh?? so Adelore and Solea do finally get married? yay!! :D



Snoink says...


... there are actually at least three weddings, now that I think about it, lol. Tempted to make a fourth one though... we'll see...



User avatar
542 Reviews


Points: 41664
Reviews: 542

Donate
Fri Jan 13, 2023 4:12 am
View Likes
Liminality wrote a review...



Hi again mint! Lim here with a short review.

General Impressions

The beginning of the chapter felt more light-hearted and humorous. The part where Sunny starts to learn about methods got more serious and effortful. I like the idea of Sunny beginning to doubt herself at this point in the story. I wonder if that will be expanded on more in the next chapter.

Characters

Something I like about this chapter is how you’ve kept up with the continuity of how Sunny and Robert generally are, personality-wise. For example, they have the banter with each other about Sunny pointing out something obvious. I also like that Robert is teaching Sunny new stuff here. And even when having self-doubt, Sunny still refers to her notebook for guidance on being a hero.
As a random side-note. I wonder where it is that Robert recharges his battery? I feel like we only saw him do that when he was at the professor’s house at the beginning of the story. Hmm.

Descriptions

I liked how you described the waitress using her instruction sheet. It felt like a nice way to introduce methods to the story. Reading how a waitress’s job might be put in code made be smile. It’s also funny to think about how the humans in Javalandia are a bit like machines in our world, if that’s how she learns to do her work.
I loved the punny food names. It would have been a nice way to create atmosphere, I think, if the appearance of the food were described. Maybe that’s what’s coming up in the next chapter?

"Did you see that person juggling numbers? And the variapet show! Plus the street performers… I had no idea so many words rhymed with array."

I also wonder if this bit of dialogue could have been done as narration/ description instead. Doing that might help highlight the parts where the dialogue is more important to the ‘point’ of the scene. Just a suggestion though!

Overall

I thought a few more complex things were introduced in this chapter. I can’t really say how they’ll be used, though I’ve noticed that those kinds of things tend to become obvious in the second halves of your chapters rather than the first. I like the idea that Sunny is starting to find this code a challenge and that perhaps Spaghetti Code Mountain might hold something really hard to deal with, even with all the knowledge she’s gathered.

Hope this helps – let me know if you’d like more feedback on something specific!
-Lim




Spearmint says...


Thanks for the wonderful review, Lim!! ^-^
I like the idea of Sunny beginning to doubt herself at this point in the story. I wonder if that will be expanded on more in the next chapter.

Well%u2026 I do touch on it later! Or try to%u2014 I%u2019m not sure if it comes through effectively. xD
I wonder where it is that Robert recharges his battery?

I was thinking he can last for a few days! But I should probably specify that%u2026 Thanks for catching that!
I also wonder if this bit of dialogue could have been done as narration/ description instead.

Hm, probably. >.> I%u2019ll try rewriting it that way and see if I like it better.

Thanks again, and have a fabulous day/night! <3



User avatar
4092 Reviews


Points: 252863
Reviews: 4092

Donate
Mon Dec 19, 2022 9:13 am
View Likes
KateHardy wrote a review...



Good Morning/Afternoon/Evening/Night(whichever one it is in your part of the world),

Hi! I'm here to leave a quick review!!

First Impression: Well this was a lovely continuation from the array side of things. It seems we're really diving in a little heavy into the methods here, which is I suppose partly because there is quite a bit to cover there but I can't also help if it means this will play a big part in something to come and if that thing will be arriving soon.

Anyway let's get right to it,

The rest of the train ride passed by uneventfully, although Sunny could have sworn that she saw an error flying by once. Or at least, something with red scribbles. But soon enough, the skyscrapers of Method City came into view, and the train slowed to a stop.

"We're here!" a young Javalandian cheered. Sunny couldn't help but crack a smile at that.

"Let's go, Robert! We're almost to the climax of our quest!" Sunny grinned at the robot, who reluctantly floated up out of his seat.

"Oh, joy. Cities are too loud to get any decent rest," he grumbled.


Ahhh this is perfect little way to enter this situation honestly. Both of them just exclaiming exactly how one would expect them to with the combination of excited for the end to come and Robert just being Robert as usual. Love the little nod to a flying error too.

Despite his complaints, however, Sunny and Robert were soon standing on the train platform, looking at a map of Method City. Sunny pointed to a cartoon depiction of a mountain range near the top of the map. "I'm assuming Spaghetti Code Mountain is there?"

Robert snorted. "No, Sunny, it's actually down there, in the middle of the ocean."

"Wow, thanks." Sunny rolled her eyes. "Well, it looks like we're not too far… My stomach is telling me that it's around lunchtime, though, so are there any good places to eat around here?"

"I don't eat."


Ahh the banter between these two really is never going to get old here. They just annoy each other with the perfect amount of grumpiness from Robert and cheeriness from Sunny and it just seems to work perfectly. I do hope Robert never loses this grumpiness, this is too perfect at the moment.

"Noted. But in your travels as an ambassador, have you heard people talking about nice cafés or restaurants around here?" Sunny persisted.

Robert hummed. "Hmm… Perhaps the Cinnamon Synonym Café? It's on the way to Spaghetti Code mountain."

"The Cinna- Synon–" Sunny gave up. "Alright, that sounds good."

The pair left the train station and, around a twenty-minute walk later, they arrived at the café. Sunny was still bubbling with the new sights and sounds of the city.


Ooooh well that sounds like quite the café xD. (Do they give you free drinks for pronouncing the name correctly three times fast?) I love that we're talking a tiny bit of a break here from the quest once again. That was motoring along for a bit there. A break is a lovely idea.

"Sure. And then there were a couple of ambassadors too– Robert, how come you don't have any fancy colors on you?"

"Customization is optional." Robert took a seat at the small table.

"Okay. But– ooh, such a cute menu!" Sunny got distracted by the glossy images of food. "The ampersand sandwich looks good. But so do the carat soup, and the hashtag hashbrowns…"

Robert closed his eyes. "Let me know when you're done. I need to conserve battery if we're not going to stop for a charge before heading to Spaghetti Code Mountain."


Welp Robert just shutting down at every opportunity to leave Sunny to just fend for herself there. Thankfully it seems this men here isn't too too hard to decipher and sunny shouldn't be having too much trouble getting some food here.

Before Sunny could decide on an item, a waitress arrived at their table. "Welcome to the Cinnamon Synonym Café! What can I get for you today?" She adjusted her apron and took out a piece of paper.

"What's popular here?" Sunny asked.

"Popular… popular…" the waitress whispered, scanning the piece of paper in her hand. "Aha! listPopularItems()." She cleared her throat, then pointed to the top of Sunny's menu. "The bracket burgers paired with curly braces fries are always a good choice. And we have the soup of the day, which is carat soup today. But if you're a little more adventurous, you might like the pear and parentheses pancakes special." She winked.

"Hmm. That sounds good! I'll have the pancakes, then." Sunny beamed.


Well that seems to be fairly simple for the moment although I hope Robert ends up waking up in time to pay for this food because I'm going to assume Sunny hasn't acquired any new money since buying tickets for the train.

Sunny stared at the paper for a moment, trying to make sense of the code. "Robert? Are these methods?"

The robot cracked open an eye, then glanced at the paper that Sunny was holding out to him. "Indeed. It looks like listPopularItems(), noteDownOrder(), and bringOrderToKitchen() are all methods. Methods are kind of like variables, but they store actions instead of data. So once you write the method listPopularItems(), you can call it as many times as you want to repeat the actions inside the method. In this case, those actions would be printing the contents of the array popularItems."

The waitress shifted nervously. "Would you mind giving me my instructions back? I'm new here, and I need them to–"

"Oh! Sorry." Sunny quickly handed the paper back. "Thank you so much."


Ahhh well for starters that was quite the program there, love that. It definitely seems like we have quite the list of methods needed to run a restaurant like that. I think this is a lovely way for you to go ahead and touch up on this assuming Robert here is going to give us a proper explanation now unlike back on the train.

"You don't need to worry about public and static for now; those are more important when you get into objects and classes. But void means that the method doesn't return anything."

"Return? Like, return clothing that doesn't fit?"

"I'm afraid not. A return value is something that the method sends back to wherever it was called. Here's an example." Robert flipped open the computer screen in his head.


Ooooh that's an interesting way to explain that. You really seem to somehow manage to pick the perfect pairing for all of these very complicated things that are otherwise so much crazier to understand.

Sunny shook her head in confusion. "Okay, but then why would you ever return instead of printing? Don't you want to know the result of the method?"

"Not always," Robert explained. "Sometimes you want to do something else with the result of the method."


Well Sunny there's a few things that don't quite work without that.

Robert summarized, "You should return values when you're going to do more with them later. Print them when all you want to do is know what those values are. But don't worry. Knowing which one to do will become natural as you gain more experience."

"I sure hope so." For the first time, Sunny felt a twinge of doubt in her abilities. Variables and loops and all had been easy enough to understand the first time they were explained to her, but methods? Even besides the print versus return thing, she wasn't really sure when or how to use them.

Hopefully Robert was right. She just needed more practice. Sunny comforted herself with rule #14 , which was, "The bad guy strikes when you least expect it. Meaning, you'll never be a hundred percent ready." All she could do was learn as much as possible about the code this world ran on, and hope that was enough to be able to know how to defeat the enemy in the end...


Well that seems like a great rule and AHHHHHHHHH I can't help but think this is some very pointed foreshadowing right as we have Sunny learning a very complicated part of coding and she's starting to doubt her abilities a little.

Aaaaand that's it for this one.

Overall: Overall I think this has been a very solid dip into the land of the methods here. I can't wait to see what more is to come and I really hope that bit of foreshadowing doesn't end up landing right after when Sunny feels so unprepared.

As always remember to take what you think was helpful and forget the rest.

Stay Safe
Harry




Spearmint says...


hi Harry, thanks for the great review!! ^-^
but I can't also help if it means this will play a big part in something to come and if that thing will be arriving soon.

... ;) perhaps aka i haven't planned that out yet
I do hope Robert never loses this grumpiness, this is too perfect at the moment.

I'm glad you liked the banter! It was fun to write xD
I really hope that bit of foreshadowing doesn't end up landing right after when Sunny feels so unprepared.

Again, ;)
Thanks and have a terrific day/night! =D



KateHardy says...


You're Welcome!!




The fellow who thinks he knows it all is especially annoying to those of us who do.
— Harold Coffin