Curious Junior Developer

Detective of life, New Dad, Developer.
A Flatiron Fellow

Each programming language is unique, to prepare code correctly you need familiarity with the ingredients. Java is more explicit with initializing its variable types. If you need to set up Eclipse, please see my previous post on Java.

For a comprehensive list visit Java Data Variables. Below are common types I’ll be using during future Java tutorials on this blog.

boolean: Truth values (true / false)
int for Integer: Whole numbers, for example 42
double: Real numbers. We use doubles for negatives and numbers including decimal places, for example -42.0
String: Text.

Lets try using Java variables.

VariableType Name;
int answer;

Variable = variable’s value;
answer = 42;

Lets put it all on one line!
String answer = “Answer to the Ultimate Question of Life, the Universe, and Everything is 42.”;


Time to look at Class Structure
class CLASSNAME{
public static void main(String[]arguments){
CODE
}
}

Output

System.out.println(some String) output to the console
i.e. System.out.println(“output”);


Lets get deeper…

The above will produce the following…

This series of posts teaches JS using the game Munchkin. A fun way to learn how to play is by watching the Table Top Video staring Felicia Day, Steve Jackson and Sandeep Parikh.


Declared functions, like the Plutonium Dragon from the last post, are built in memory right as we load the program.

Function expresessions are assigned to a varaible so they’ll only be loaded when its reached inside the program.

// Syntax of a Function Expression
var variable = function functionNameIsOptional (parameters) {
code to be executed
};

The function name above is optional. If the function has no name, then its an anonymous function.

// example of calling a Function Expression
variable(parameters);

You’ll notice above that the variable name includes parentheses, and we’ve included parameters to be used by the function it contains.

Lets see an example



Call the Function Expression

We’ll be programing Java on Eclipse.
Eclipse provides …
- Library management
- Autocompletion
- Run app from the editor
- Real time error checking


To set up Eclipse on your Mac OS X
1. Visit http://www.eclipse.org/downloads/?osType=macosx
2. Download the appropriate version
3. Open the Zip File
4. After starting it, it may state you need to install Java. You may select to allow it to install now
5. You’ll be prompted to select which folder you’d like to save your projects. We’ll go with default: /Documents/workspace


We’re close the Workbench (start portal) and move directly to creating a new Java Project. Let’s start with "Hello World."
1. Select File -> New -> Java Project
2. Enter the project name hello_world



3. At the bottom right hand corner click Finish

4. Right click on src -> New -> Class



5. We’re going to give our New Java Class the name HelloWorldMainClass, then click Finish at the bottom right hand corner.



You’re now ready to write your first Java program!



To run your program, hit the green play button



At the bottom of Eclipse you’ll see your code ran in the Console.

This series of posts teaches JS using the game Munchkin. A fun way to learn how to play by watching the Table Top Video staring Felicia Day, Steve Jackson and Sandeep Parikh.


Game note: Pursue only relates to an attempt to run from the monster. If the monster does not pursue a specific character they automatically succeed on their escape attempt and do not need to roll the die to run away.

In the game you open the dungeon door and enter a room. Oh no! You spot a Plutonium Dragon!



We’ll create a JS function to describe the dragon.
// Syntax for a function
function functionName (variable1, variable2){

Operations for our function.

};


// Syntax for calling a function
functionName (variable1, variable2);

Lets see an example in play…



Choose your character’s level…







Donald Knuth published The Art of Computer Programming in 1968. His goal was to provide firm mathematical and historical foundations to programming methods. He is now considered by many as the “father” of the analysis of algorithms.



3 Steps to a Solution:
1. Divide the problem into subproblems
2. Conquer each subproblem
3. Combine the solutions

Time to revisit sorting…
Approach:

Array[p..r]
p = proportion, or index
r = n = total sample size


1. Divide the n-element array into two sequences, Array[p..q] and Array[q+1..r]
2. Conquer each sequence by sorting them
3. Combine the sorted sequences for a total sorted solution






And of course, Merge-sort with Transylvanian-saxon (German) folk dance

I was inspired by the youtube video Insert-sort with Romanian folk dance

We are going to recreate the sort method. We’ll order the elements of an array in numerical order.

Pseudocode:
Iterate through the array.
Each time take a key to compared with the rest of the values to the left of it.
If the key is smaller than the one immediately to the left, swap them.
We will skip the 0 index of the array, because there is nothing to its left.


"Lets determine the correct param for this form." Felicia and I continued to pair program when we heard the call. Blake announced, "Head to the dance floor, we’re going to discuss the science fair." The dance floor is our safe space, its our lecture space.

The Flatiron Science Fair is an opportunity for us to display projects and practice presenting code we’re proud of. To me it looked like a reverse career fair, where potential employers would move between booths to inspect talent.

Blake framed expectations more appropriately. “Think of this as meeting people at a party or bar. Tell them fun interesting things about yourself and be sure to ask them about their interests as well. Its about seeing if they’re a good fit. Be positive. You may prefer Angular, but if you get more familiar with an alternative framework perhaps you’ll like that more.”

The real question: How can I prepare?
The real goal: Become over prepared.

Lets get real… whats important is being present for the experience.
Its our experience to enjoy as much as theirs. While its tempting to have every project we’ve prepared on tap, its best to identify 1 to 3 projects we enjoyed building. Including a group project is a good thing, considering the time invested in it. If of course you love Game of Thrones, I’ll show you that class Sinatra project.

There we were, making a Rails App. My team consisted of Keturah, Uzo and Tessa. Our primary goal was to enable users to find what movies were filmed nearby a given location. Once we accomplished that we wanted to answer the hunger for trivia with a movie’s details page.

The Internet is full of great resources, especially APIs. We turned to Rotten Tomatoes to fulfill our curiosity.


We went ahead and created different methods to extracting particular data. Through our App we traveled NYC film locations. The plot thickened when we stepped on a subway car in Coney Island.


Our API was less than perfect. Perhaps we could use the Critics Consensus item for the film? Nope, The Warriors didn’t have that either. Would the Warriors let this stop them from getting home? Didn’t think so. Till we find a better API we took drastic action…

We scrapped from the Rotten Tomatoes website, for consistency of course. Luckily the API was able to help guide us to the film’s page.

To paraphrase Donald Rumsfeld, there are known unknowns, such as the fact certain APIs may have information gaps. Once you know your known unknowns you need to figure out how to make them known. In clearer terms, if you know something is missing, keep researching till you get the information you need.

Unlike most other frameworks, AngularJS’s view reflects its model at all times. Before we continue lets quickly review:

Model: maintains the state of the application.
View: generates the user interface.
Controllers: get input and based on the model will post it to the user appropriately.

While other frameworks only bind data from the model and template once to create the view, AngularJS is based on the idea of constant data binding. Changes to the model are automatically reflected in the view. The first template is compiled in the browser, and the second creates a real time view. This process save developers from having to write code to re-sync the view and model for the user while also creating a more responsive website.