RodgerB's Profile User Rating: -----

Reputation: 66 Whiz
Group:
Expert w/DIC++
Active Posts:
2,319 (0.93 per day)
Joined:
21-September 07
Profile Views:
15,437
Last Active:
User is offline Aug 03 2013 05:56 AM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Who Cares
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Mitsubishi
Dream Kudos:
2200
Expert In:
Dot Net Technologies

Latest Visitors

Icon   RodgerB has not set their status

Posts I've Made

  1. In Topic: Should I Start With Java?

    Posted 6 Nov 2012

    View Postjon.kiparsky, on 07 November 2012 - 02:11 AM, said:

    This is exactly where we diverge. The compiler output, in my view, is much better feedback for the programmer. Having to go back and find the problem for yourself actually forces you to learn it. Punching keys until the red goes away is more like Skinner training pigeons than anything to do with learning.


    Again if you're using it as a tool rather than a crutch, and you're actually actively attempting to learn as you go and not punching keys until the red goes away, the IDE isn't a magic bullet if you're applying yourself.


    View Postjon.kiparsky, on 07 November 2012 - 02:11 AM, said:

    If the IDE does it for you, you don't learn anything from that. This is like saying you can take pictures with an automatic camera and learn about aperture settings.
    Programming is a practice, you learn it by doing it. Hiring someone to do it for you defeats the purpose.


    That's a pretty big overdramatization. Programmers are given the opportunity to see their code get changed at the lowest level applicable. Photographers wouldn't generally have the same intimate relationship with a matrix representation of their image. I agree you learn to code by doing it, but I disagree that being shown the correct way that the code should be formatted is going to stifle a new programmer's ability to grasp what's required of them.

    View Postjon.kiparsky, on 07 November 2012 - 02:11 AM, said:

    If you're typing

    Foo foo = new Foo(
    


    and you don't know what comes next, this is exactly what I mean by an IDE allowing you to go ahead without knowing what you're doing. And this is a disaster - you're really making my case for me!


    It's not a disaster at all, it seems like a logical progression to me. In the context of classes that are self-explanatory for example Date, there are many different arguments you can construct the class with. Knowing every single option you can construct a Date class with off the bat is unheard of and a waste of time. Referring to Javadocs gives the exact same result as Eclipse's content assist functionality listing possible constructors.

    This isn't a special case, you can know theoretically how a class works but potentially have the order of the arguments muddled up in your head. If you don't know how the class works, then it's time to read Javadocs.

    View Postjon.kiparsky, on 07 November 2012 - 02:11 AM, said:

    I don't have a lot of faith in someone's ability to work with complex systems if they can't get up and running in vi in a few hours, frankly. Think of it as a low bar to step over. If they learn it and prefer not to use it, that's another thing, but you're learning a handful of keystrokes to get yourself editing text. If you can't manage that, you might as well hang it up and go home.


    I'm not saying learning vi or emacs is a bad thing. I quite like using vim but certainly wouldn't consider myself overly great at it. But if you're going to spend time learning just a handful of keystrokes to edit text and not use the functionality of vi or emacs to assist you in writing code faster, why not suggest the use of a more relatable text editor such as Notepad++? Yes I understand the perks of not needing to lift the mouse when wanting to select things etc, but as I've said before learning a quite involved text editor like vi in conjunction with finding your bearings in a programming language isn't going to be the best of times.
  2. In Topic: Should I Start With Java?

    Posted 6 Nov 2012

    View Postjon.kiparsky, on 06 November 2012 - 02:41 PM, said:

    Wrong question. You don't want the easiest at this point, you want the thing that teaches you the most. You can go with easy once you know what you're doing. I recommend a text editor and the java compiler - vi is what I use, but some people like emacs and they don't seem to be damaged too much by it. This forces you to engage with your code hands-on, instead of in the mediated environment of an IDE.


    I would have to disagree with you here. If you're using an IDE simply for the passive convenience of auto-generating everything without too much thought then yes you're correct. However, using an IDE as a tool rather than a crutch allows for faster learning in my opinion.

    IDE's check for potential problems in real-time, meaning you're not writing big chunks of code and then needing to decypher what the error actually is from the compiler's error log or run javac every time you're not sure. By getting faster feedback about what is and isn't semantically correct, and have a decent indication of where the error is, the new programmer is able to better recognise what is and isn't acceptable at the points that they've made the error so they can then rectify it and continue.

    If an IDE is adjusting the structure of the code this should actually provide the new programmer with feedback on the correct styling and conventions used in Java. A text editor isn't going to provide this type of feedback (unless it has some extending module or fancy inbuilt feature) and hence the new programmer can't actually learn anything unless they're strictly learning by example.

    IDE's also make aware of the many different constructors an object can have and this saves time thumbling around Javadocs, and as I said before, if the IDE is being used as a tool rather than a crutch, the programmer will learn more and be exposed to Object Orientated Design decisions such as constructor overloading gently rather than being left for dead in Javadocs.

    For these reasons I personally wouldn't recommend using a text editor at first and I certainly wouldn't be pushing the use of vi or emacs if you haven't used either of them as there are a lot of commands to remember and it's just not practical to be fighting with your tools while you're still learning the craft.

    I do however agree that using a text editor is great way to consolidate skills that have been developed over time, and to also get a bit of background on the method the IDEs are actually using to converting the source code to Java bytecode.
  3. In Topic: How do you display an Image in a JFrame?

    Posted 3 Nov 2012

    No worries, glad I could help.
  4. In Topic: Parsing a full date/time/timezone date to "yyyy-MM-dd"

    Posted 3 Nov 2012

    No worries! :)
  5. In Topic: How do you display an Image in a JFrame?

    Posted 3 Nov 2012

    Something like this should help you get underway.

    import java.awt.Graphics;
    import java.awt.Image;
    import java.io.File;
    import java.io.IOException;
    
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    
    
    @SuppressWarnings("serial")
    public class Main extends JFrame {
    	
    	private Image img;
    
    	public Main() {
    		setTitle("My Smile App");
    		setSize(640, 480);
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		
    		try {
    			File imgFile = new File("/home/rodger/Documents/happy.png");
    			img = ImageIO.read(imgFile);
    		} catch (IOException e) {
    			System.out.println("Something went wrong while attempting to read the image!");
    			System.out.println(e.getStackTrace());
    		}
    		
    		// Tell the form we want to make it paint before setting it to visible
    		invalidate();
    		setVisible(true);
    	}
    	
    	public void paint(Graphics g) {
    		g.drawImage(img,220, 140, null);
    	}
    	
    	
    	public static void main(String[] args) {
    		new Main();
    	}
    
    }
    
    


    I will explain what's going on.

    Firstly the static main method is called, as with every Java program. The class just so happens to be called Main, and so the constructor is called.

    The Main class extends JFrame. What this means is that the Main class inherits all of the methods and properties a JFrame exposes for us to play with. If we didn't inherit from JFrame and let Main become a subclass of it, we wouldn't be able to call methods like setTitle etc to set up the JFrame, define its behaviour and tell it to become visible.

    File reading is something that can go wrong. If a file doesn't exist or some other similiar error happens, Java will crack it and throw a fruity, or otherwise known as an Exception. Java wants us to catch said Exception when stuff goes awry and so we just do what it wants.

    A JFrame has an internal method called paint, and every time the window is resized or maximised from being minimised it needs to "repaint" everything again. When it's called, we conveniently get given the Graphics object from the JFrame. Think of the Graphics object as a pencilcase. We can draw lines and do all sorts of things you'd expect.

    Interestingly enough we can also display an Image.

    Hope that code above is enough for you to adapt to your current application.

    Cheers,
    -RodgerB.

My Information

Member Title:
D.I.C Lover
Age:
20 years old
Birthday:
October 27, 1993
Gender:
Location:
Melbourne
Years Programming:
3
Programming Languages:
Java, C#, VB.NET, PHP, (X)HTML, CSS, Javascript, SQL, 68000 Assembly, C

Contact Information

E-mail:
Private
MSN:
MSN  RodgerB@dreamincode.net
Website URL:
Website URL  http://rodgerbenham.blogspot.com/

Friends

Comments

Page 1 of 1
  1. Photo

    ajb22 Icon

    09 May 2012 - 17:15
    i just came across your breakout tutorial which is very good but i cant get the ball to launch or the paddle to move in vb 2010 e
  2. Photo

    hifistyle Icon

    23 Nov 2010 - 10:46
    Thanks for the pong tutorial, was fun even if it is unbeatable.
Page 1 of 1