Skip to main content
View by: Most Recent | Topic | Community | Webloggers   
Monthly Archives:    

Blogs by topic Programming and user staufferjames

• Accessibility • Ajax • Blogging • Business • Community 
• Databases • Deployment • Distributed • Eclipse • Education 
• EJB • Extreme Programming • Games • GlassFish • Grid 
• GUI • IDE • Instant Messaging • J2EE • J2ME 
• J2SE • Jakarta • JavaFX • JavaOne • Jini 
• JSP • JSR • JXTA • LDAP • Linux 
• Mobility • NetBeans • Open Source • OpenSolaris • OSGi 
• P2P • Patterns • Performance • Porting • Programming 
• Research • RMI • RSS Feeds • Search • Security 
• Servlets • Struts • Swing • Testing • Tools 
• Virtual Machine • Web Applications • Web Design • Web Development Tools • Web Services and XML 


Programming

How much code documentation is a symptom of bad coding (i.e. poor method or variables names, poor class or package structure, missing logging, etc)?
on Jul 15, 2013
What should be in a source control commit message for a single file add? Ideas: Reason: The reason for the file should be in a comment in a file so it would be a duplicate to also include in the commit message. File add: Already part of the commit Issue identifier From http://jamesjava.blogspot.com/2012/11/source-control-message-for-single-file.html
on Jul 15, 2013
When interviewing candidates (only 3-4 interviews) I would ask them the following question: What kind of programming work do you like best? They always gave then same basic answer: Creating new software. Since that isn't the answer that I would give I asked my co-workers and between 4 of us we had 3 different answers: Creating something new Debugging problems Improving (adding features,...
on Jan 23, 2008
On a real-life desktop I will often move toward an object to work with it. i.e. When I want to look at the calendar I will move closer to it. That allows better use of my desktop because some objects are "zoomed out" and therefore take less space (in my field of view). I received an iPod Touch for Christmas and the zooming of web pages and pictures works well. Of course adding a touch screen to...
on Jan 23, 2008
How much paper would be saved each year it Microsoft changed the default margins in Word to 1" on each side (or even 1/2")? Remember that when you choose your program defaults.
on Jan 23, 2008
I had a URL that I wanted to POST with JavaScript so a made a         <form name="doForm" action="" method="post">        </form> and used JavaScript to set action and call submit. But Tomcat showed the request as a GET (I.E. 7 is my browser). I found that adding a dummy...
on Jan 23, 2008
Does widening or autoboxing happen first? Which param method will be called from the autoboxing method? If one param method is commented out then it will have no problem calling the other. <pre>private static void autoboxing() {    Integer integer = new Integer(2);    param(integer);}private static void param(int param) {    System.out.println(...
on Dec 18, 2007
I initial asked about adding dynamic types to Java but someone pointed out that I probably wanted type inference instead. So, would type inference be a good fit for Java? Java FX script will have type inference with static tying. Would automatic casting be better instead? Here is a example of how it would be useful (I think/hope):List list = new ArrayList();list.add("Hi");list.add...
on Oct 17, 2007
What if a Java allowed both static and dynamic types? That might allow the best of both worlds. i.e.:String str = "Hello";var temp = str;temp = new Integer(10);System.out.println(temp.intValue()); Would that be possible? Would that be beneficial? For languages that support it, how is it used? When are static types used and when are dynamic types used? Are there patterns? Is this a...
on Aug 27, 2007
Do you assume that toString() on any given object has a low cost? I do. Is that assumption generally valid? If it has a high cost should that normally be changed? What are valid reasons to make a toString() method with a high cost?
on Aug 24, 2007
Here is a quick tip: Do you have two anonymous inner classes that need to communicate? I had two anonymous inner classes that implemented Runnable and needed to communicate with a boolean value. Therefore I decided to make a boolean variable in the declaring method but in order for the inner class to access the variable it needs to be declared final. But that would prevent me from changing the...
on Aug 17, 2007
Would it be useful to be able to provide method return values for null objects? For the List interface, the null return values might include: get(int) : null<br/>size() : 0<br/>iterator() : An empty iterator That would allow the following code that has less null checks: <pre>List items = null;if(false) {  items = ...}for(int index = 0; index < items.size(); index++) {//...
on Jul 31, 2007
Is there any downside or problem potential to changing the Java compiler to automatically cast? In the example below the result of list.get(0) would automatically be casted to the type of the variable hi (String). <pre>List list = new ArrayList();list.add("hi");String hi = list.get(0);for(Iterator i = list.iterator(); i.hasNext(); ) {  String item = i.next();//Automatic casts...
on Jul 26, 2007
The code below actually prints "yikes!" If you return in a finally block then any Throwables that aren't caught (in a catch block that is part of the same try statement as the finally block) will be completely lost. The really bad part about this is that it looks so innocent. I can think of no reason to return in a finally clause. If nothing else, catch(Throwable t) and return in that so it is...
on Jun 27, 2007
A pet peeve of mine is when a variable is declared way before it is needed. It is much easier to understand a piece of code if a variable is declared just before it is needed. That immediately tells me that it isn't used anywhere before that or in any wider scope. I also find it annoying when a variable is declared with a null value and them immediately assigned a value. String value = null;...
on Jun 25, 2007
I often see code like this (when using Java 1.4 or earlier): Iterator i = list.iterator(); while(i.hasNext()) { ... } but I write that as: for(Iterator i = list.iterator();i.hasNext();) { ... } because * It shorter * It keeps i in a smaller scope * It reduces the chance of confusion. (Is "i" used outside the while? Where is "i" declared?) I think code should be as simple to...
on May 23, 2007
I like to make my static method names start with an upper case letter. I know that isn't standard and that only class names are supposed to start with an upper case letter but I find that it is helpful because it quickly shows which methods are static. Also, I have never confused a static method with a class because the usage/syntax is different. Does this sound beneficial? Notes: I don't know...
on May 18, 2007
ClassCastException didn't used to have a message but I noticed that now it has a message that includes the cast class and the object class. That extra info is very beneficial. (Note that only recently could I start using 1.5 in my main product so I am behind the times a bit.) What other common Throwables need improved messages? NullPointerException should have the name of the variable. I...
on May 17, 2007
Do developers write good product documentation? Is someone who knows a product inside and out the best person to document it? Have you ever bought a product and you could obviously tell that the manual writer didn't speak the language natively? From my little knowledge of languages it seems that it works better for people to translate into their native language. I think the same principles...
on May 16, 2007