Feeds:
Posts
Comments

Part of working with any code base is understanding what is already developed. Luckily shields help show actions associated with objects in the form editor. However, an object method shield will show for empty (‘blank’) object methods. We should clear any empty object methods to avoid confusion and optimize the code base.

Example

Two objects on a form, both with an object method shield indicating the presence of an object method.

two objects with method shield

The last developer removed the object method content from the variable input area but did not explicitly clear the object method. This falsely indicates object method content, and worse yet 4D will execute the blank object method for each event enabled on that object.

The best approach is to clear the object method so that no shield displays, and reduce the number of lines the 4D engine executes.

Solution


Select the object to clear the method from, then from the Object drop down menu select Clear Object Method

Results

No misleading shields and no more tracing through empty object method.
Object method cleared

I was doing some light reading via Slashdot on why guis suck revisited. Reading the endless debate about graphical interfaces versus command line is like a political debate. Authors often frame the article to one spectrum end or another to entice response.

The myriad of examples back up a specific view point I’m going to say something totally uncontroversial: “real programmers use the right tool for the job”. This post title itself being a reference to xkcd “Real Programmers”.

Yes we all know plenty of examples where a well placed sed saved the day. We also know when popping open an application and clicking a few buttons is much easier than writing individual commands.

Really, how many people do you know who use mail or mutt as a command line interface to their mail? How many people browse the internet using links? My approach to any problem is to find the right tool to accomplish the task. Sometimes this means going straight to the command line, other times it means interacting with a program via a graphical interface.

Real programmers have an arsenal of tools to get the job done and can identify the best way out of a problem.

Java string comparison

Mostly just a ‘duh’ moment by myself.

I was fetching properties out of a database using hibernate objects. In my test scenario I asked if "true" == "true" which does work. However a String object does not always equal a string literal nicely.

public class Test {
	
	public static void main(String args[]) {
		System.out.println("String comparison");
		// BAD could be true, but could also be false
		boolean result = "true" == "true" ? true : false;
		// GOOD will actually compare the strings, not the objects
		boolean result2 = hibernate_object.getProperties().get("boolean property").equalsIgnoreCase("true") ? true : false;
		
		System.out.println(result);
		System.out.println(result2);
	}
}

String JavaDocs

Design a site like this with WordPress.com
Get started