Java

Page 1

From Processing to

Java V.J.A van der Burgt (Vivian)


s081013 B2.2 Industrial Design

2


Table of Content

Expectations

p.3

Overview homework

p.4

Reflection

p.8

3


Expectations I choose this assignment to get to know other possibilities within programming, to learn another language, to know what the advantages are compared to ‘Processing’ and to have more possibilities in designing a website. The layout of my showcase was a standard website with no dynamic objects in it. It looked very basic with a bad structure of the menus and content. I want to improve my showcase and use JAVA language to design some parts of my website. In the past I used the language ‘Processing’ to program my arduino board for my prototype. It was a very good opportunity to make the technical part of the prototype. I wanted to know the advantages of JAVA compared to Processing.

4


Overview homework Week 1: // HelloDate.java import java.util.*; public class HelloDate { static int i = 47; public static void main(String[] args) { System.out.println("Hello, world. I'm an Industrial Design student and now working on JAVA."); System.out.println(new Date()); } }

//ATypeName.java class ATypeName { int i; ATypeName a = new ATypeName(); public ATypeName() { a.i = 100; public static void main(String[] args){ ATypeName a = new ATypeName(); System.out.println("new ATypeName");

5


//DataOnly.java class DataOnly { int i = 47; float f = 1.1f; boolean b = false; DataOnly d = new DataOnly(); public DataOnly() { d.i = 47; d.f = 1.1f; d.b = false; } public static void main (String[] args) { DataOnly d = new DataOnly(); System.out.println("d.Dataonly"); } }

//StaticFun.java class StaticTest { static int i = 47; public static void main(String[] args){ StaticFun st1 = new StaticFun(); System.out.println("StaticFun.i++;"); System.out.println("StaticFun.i++;"); StaticFun st2 = new StaticFun(); System.out.println("StaticFun.i++;"); System.out.println("StaticFun.i++;"); }

} class StaticFun { static void incr() { StaticTest.i++; } { StaticFun sf = new StaticFun(); sf.incr(); StaticFun.incr();

6


Week 2 //Class Homer.java class Homer { char doh(char c) { System.out.println("doh(char)"); return 'd'; } float doh(float f) { System.out.println("doh(float)"); return 1.0f; } } class Milhouse {} class Bart extends Homer { void doh(Milhouse m) {} } class Hide { public static void main(String[] args) { Bart b = new Bart(); b.doh(1); // doh(float) used b.doh('x'); b.doh(1.0f); b.doh(new Milhouse()); } }

//bicycle.java public class Bicycle { public int cadence; public int gear; public int speed; public Bicycle(int startCadence, int startSpeed, int startGear) { gear = startGear; cadence = startCadence; speed = startSpeed; } Bicycle myBike = new Bicycle(30, 0, 8); public Bicycle() { gear = 1; cadence = 10; speed = 0; } }

7


Week 3 //Instrument abstract class Instrument { int i; public abstract void play(); public String what() { return "Instrument"; } public abstract void adjust(); } class Wind extends Instrument { public void play() { System.out.println("Wind.play()"); } public String what() { return "Wind"; } public void adjust() {} public static void main(String[] args) { Instrument[] orchestra = new Instrument[5]; int i = 0; orchestra[i++] = new Wind(); }

Week 4 //: com:bruceeckel:swing:Console.java // Tool for running Swing demos from the // console, both applets and JFrames. import javax.swing.*; import java.awt.event.*; public class Console { // Create a title string from the class name: public static String title(Object o) { String t = o.getClass().toString(); // Remove the word "class": if(t.indexOf("class") != -1) t = t.substring(6); return t; }

The exercises about the Admoveo robot are not completed because I found them too difficult. I tried to make them even with help from others but it wasn’t successful. I tried to make most exercises as possible and I didn’t give up.

8


Reflection I already did the assignment ‘Creative programming for designers’ which provided the program language ‘Processing’. It was a much more easy language than JAVA and I successfully completed the assignment. With JAVA I had many problems with understanding it. For me the lectures were way too much theory and only talking about the language. It is a way easier to understand the language by showing more examples and together make one exercise in the lecture. Then you immediately can get feedback and ask for help. In the book ‘Thinking in JAVA’ there were hardly any complete examples. It was really hard for me to find out what was meant and where to start. The book of Processing was way more clear (but maybe also easier to explain). An improvement for the assignment can be to show more examples in the lecture and really doing some exercises with the students together, and doing more exercises that show features for in your website. What I’ve learned is that JAVA is a much more complicated version of ‘Processing’ and that for me ‘Processing’ is a language I will use frequently in my design process. In the past I used processing many times in combination with the Arduino.

9


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.