I recently completed my first Java programming project: a simple command line application built to provide random character ideas for the 5th edition of Dungeons and Dragons. Some of the final program’s outputs can be seen above. What follows will be a deep dive into the code that makes up the application, detailing the techniques used and choices made in its development.
Randomization
Despite the similarities in their name, Javascript and Java are two entirely different programming languages. Certainly, there are some similarities; after all, the basic logic that goes into coding is the same regardless of which language it’s being typed in. However, oftentimes these similarities make the places where the two languages differ even more confusing. As an experienced Javascript programmer who recently began learning Java, one of the first big differences that tripped me up was in the two languages’ interpretations of the array data type.
Common Ground
In all languages, an array is a data type that consists of…
Object-Oriented Programming (OOP) is a method of coding that uses succinct, modular “objects” to organize data and functions. It is a concept that can be used to build complex and expansive programs and spans multiple coding languages. I first learned of it while learning to code in Ruby, for example.
Recently, I began looking into learning Java — a language with a long history known for its use in OOP. Other newcomers to Java might be surprised to find several references to four “fundamentals,” “principles,” or “pillars” (the language used varies, but they’re all referring to the same concepts) of…
Here’s a scenario: imagine you’re the CEO of a wildly successful new company. You have a luxury office at the very top of a high-rise in your city of choice. You are absolutely drowning in money and fame. Unfortunately, you are also drowning in work. Now, you have three things to do before you attend a meeting with your employees in an hour. First, you need to create a spreadsheet for the company’s budget. Second, you need to have your assistant pick up any company mail from the mailbox downstairs. …
Writing forms in HTML can be a tedious task, but fortunately Rails provides a host of form helpers that reduce the amount of typing you have to do and the amount of syntax you need to memorize. For instance, the following HTML code that provides a form for the user to add a song to a database —
<form class="new_song" id="new_song" action="/songs" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓">
<input type="hidden" name="authenticity_token" value="0boS3/K4pFOUvggOBuWD1E16V7XjN2vcJ4v0yOmvMmsSvTeKIdONQ561mKWZqpp0QHkdy8gnJBirHg4eBZX49w=="><label for="song_title">Title</label><br>
<input type="text" name="song[title]" id="song_title"><br><br><label for="song_release_date">Release date</label><br>
<input type="date" name="song[release_date]" id="song_release_date"><br><br><label for="song_Youtube Embed Link">Youtube embed link</label><br>
<a href="https://wpexplorer-themes.com/total/docs/get-embed-urllink-youtube-video/">(how …
A CLI (command line interface) application is one that takes place entirely within a computer’s terminal. The terminal is meant to do exactly two things: read user input, and write a response. No graphics, no complex interface, only text. While CLI applications are limited in what they can express to a user, they can still accomplish much more than one might think at first glance.
While creating my first CLI application in Ruby, the first hurdle I came across was in implementing time as a factor in my app. …