[brailleblaster] Re: Accessing the GUI Environment in Windows

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Thu, 24 Feb 2011 09:16:36 -0600

I have fixed that problem by rearranging the code a bit. Now the program 
runs, but the GUI needs more work.

John

On Thu, Feb 24, 2011 at 02:50:40PM +0000, Michael Whapples wrote:
> A constructor never can return null, its likely to be an assignment 
> issue. If an object cannot be created the constructor will raise an 
> exception.
> 
> There seems to be a line where you create a Display object, however you 
> have it in a try/catch block and in the catch you assign null to the 
> variable. Is this really what you want to write? Doing this you are 
> basically saying, if Display cannot be created because of a 
> UnsatisfiedLinkError then simply output the fact the error occurred, set 
> the reference to null and continue on the way with the normal flow (IE. 
> this implies Display in your mind is optional).
> 
> Wouldn't it be better for an exception to be thrown from that block of 
> code and caught at a point where it really would be handled properly, if 
> it cannot be handled properly at that point.
> 
> I am not convinced all the things in the code I don't like the look of 
> are down to it being incomplete: Creation of an object with no 
> assignment (IE. new WPManager(); ) would be an odd way to start writing 
> code, I cannot see any benefit in leaving it in such an incomplete state 
> (IE. the line is incomplete). Also all the static variables in BBInit 
> are concerning, is there a good reason for it being so static? You have 
> a constructor for BBInit but its private and nowhere in that class do 
> you ever create an instance of it, why have the constructor? I am 
> slightly surprised that javac didn't pick up this constructor as an 
> unreachable code block.
> 
> I think in writing that I have now found your problem you were asking 
> about, simply put you are never creating or assigning a Display object.
> 
> Michael Whapples
> On 24/02/11 13:52, John J. Boyer wrote:
> >Michael,
> >
> >Display is a class in org.eclipse.swt.widgets I was hoping someone would
> >be familiar enough with swt to give a useful opinion.
> >
> >This is just the start of coding, and I have not been coding Java that
> >long. Sone of the things you have noted are just incomplete.
> >
> >John
> >
> >On Thu, Feb 24, 2011 at 01:19:50PM +0000, Michael Whapples wrote:
> >>You'll need to give better detail than this. When you say calling
> >>Display() what do you mean by this, what class/object is it on? The name
> >>convention of a capital first letter suggests this is not a method call
> >>but rather a constructor of a class.
> >>
> >>Looking at the code in the repository did not help at all, to be honest
> >>its dreadful. There's an instance where you construct an instance of an
> >>object but never assign it to a variable, this is meaningless in object
> >>orientated design. A constructor should only do work which is necessary
> >>to prepare an object ready for use, therefore never assigning it means
> >>you never use it, therefore why create it?
> >>
> >>In the public static void main (psvm) where you enter BrailleBlaster you
> >>have put some throws on it, is this really wanted, shouldn't
> >>BrailleBlaster try and handle them and if users need to be informed/need
> >>to make a decision then couldn't BrailleBlaster catch them and give more
> >>user friendly error messages?
> >>
> >>As well as this rather unusual use of an object orientated language, you
> >>have made it harder to read/understand in some more cosmetic ways: What
> >>is the variable m? Indentation of blocks would also help quickly know
> >>where one is in the complicated conditional blocks you have used.
> >>
> >>I could go on but I feel it would get too long.
> >>
> >>Michael Whapples
> >>On 23/02/11 07:37, John J. Boyer wrote:
> >>>As noted, I have BrailleBlaster running on Windows so I can develop and
> >>>test a prototype GUI. I have SWT in my classpath. However when I call
> >>>Display() it returns null. Do I have to do something more than just call
> >>>the SWT methods and classes? I am calling BrailleBlasster from the
> >>>command line with java -jar brailleblaster.jar However, I've called GUI
> >>>programs from the command line before, and they operate normally. Any
> >>>suggestions will be appreciated.
> >>>
> >>>Thanks,
> >>>John
> >>>
> 

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities


Other related posts: