True or False: Use _Ext at the end of a new Gosu class name created in the com.acme. package.
False
When defining datatypes in a new entity, I should use CHAR instead of VARCHAR on variable-width columns, as a matter of best practice.
False - You should use neither.
• The OOTB text datatypes (shorttext, mediumtext, longtext) are preferred over using varchar(xx). One exception to this is if a fixed width is known or required by an external system.
Name the logging config file GW uses.
log4j.xml
Widgets can have what kind of properties? (There are 2.)
Static and dynamic.
The Query processor field returns a result of:
1. QueryResult
2. IQueryBeanResult
3. IQueryResult
4. QueryBeanResult
IQueryBeanResult
The default logging level in Guidewire is:
TRACE
DEBUG
INFO
WARN
ERROR
INFO
True or false: Virtual properties added to entity enhancements need not have "_Ext" at the end because they are virtual and so are not stored in the database.
False.
• The suffix "_Ext" must be added to all new field names for existing entities. This applies to fields added to the data model, and to "virtual" properties and functions added via entity enhancements.
You can find the config file for GW logging at this location:
1. Configuration -> config -> settings -> logging
2. Configuration -> config -> logging
3. Configuration -> settings -> logfiles
4. Configuration -> settings -> logging
2
Dynamic behavior is typified by what two statements below:
1. Can reflect uncommitted changes to data
2. Applicable to both the dynamic and static properties of a widget.
3. Partial page update configuration required.
4. The widget must have "editable" set to true for dynamic values to be changed in Gosu code.
5. Partial page update configuration is not required.
1 and 3.
2: Applicable to dynamic properties only
4: Not true.
5: Since 3 is true, this must be false.
What is true about an array-backed ListView? Choose two.
1. The full set of data is loaded when the ListView is initially rendered.
2. The data is not re-loaded in database recordset pages when sorting or filtering the ListView, or when navigating between PCF pages, because the full set has already been retrieved.
3. Paging, sorting and filtering are disabled while editing the data.
4. Paging, sorting and filtering are supported while editing the data.
5. Performance is predictably good because the arrays are frequently supplied by entity references.
1, 4
2: The full set of data is re-loaded.
3: This is true for query-backed ListViews, not array-backed.
5. Not reliably. Array-backed ListViews are actually better for shorter lists for this reason. A ListView referencing a type with many database entries is more likely to generate poorer performance versus one with only a few entries.
Following is an example of a recommended approach to logging:
if(logger.DebugEnabled) {
logger.debug(a_process_heavy_method())
}
True
With SLF4J parameterized logging, the following two log statements perform approximately the same, regardless of whether debug logging is enabled or not:
var hello = "Hello"
var world = "world"
Logger.debug("{}, {}!", hello, world)
if(_logger.DebugEnabled) {
Logger.debug("$(hello), $(world)!")
}
• Either approach is acceptable. If guarded logging is used (the second case), it may be preferable to place the if-test and the log statement on the same physical line to avoid additional lines of code.
• However in the case where a replacement parameter involves an expensive method call, it is necessary to guard the log statement to avoid calling the expensive operation in case where logging is not enabled
If (_logger.DebugEnabled) {
_logger.debug("{}, {}!", hello, someReallyExpensiveOperation())
}
Three statements below are correct. Choose wisely.
1. The suffix "_Ext" must be added to all new script parameter values.
2. Sub-packages should be based on function, and not on feature type so as to encourage code re-use.
3. Only use the "_Ext" suffix if you must for some reason add a class to a Guidewire (gw.*) package space, which is considered the best place for most new packages.
4. Do not append "_Ext" to new interface names.
5. Do not append "_Ext" to new abstract class names.
1, 4, and 5 are correct.
2: Sub-packages should be organized by feature, not function.
3: Adding new packages under gw.* is to be avoided at nearly all costs. If you do need to add a package to that parent package, inform Guidewire via support ticket.
In the log config file, there is a property associated with the base logging object that permits or denies a message to be logged upward in its chain. What is it?
1. propagate
2. uplog
3. additivity
4. inherit
3
Ways to improve performance on a page may include (some, none, or all of these may be true):
1. Limit property settings to simple Boolean values if at all possible.
2. Use array expansion in dot expressions to minimize database query time.
3. Use a reference to a widget such as a ListView rather than return the same data set more than once.
4. Use functions such as allMatch(), countWhere(), et al. to reduce the need for aggregation queries.
5. Check the Empty property on a query to determine if there are any results to process then proceed from there.
1: True.
2: False; just the opposite.
3. True.
4. False. Use aggregation queries where necessary instead of aggregation and stream processing that brings back more objects from the database than are really necessary.
5. True.
What do you use to create a filter on a ListView?
A Gosu Standard Query Filter
True or False: Following is an example of a recommended approach to comments in Gosu at the method level:
/**
* Description
* @param param
* @param param
* @author J. Smith
**/
False
• Use the traditional Javadoc style for Javadoc comments. Do not use Gosu annotation style comments for Javadoc.
• Avoid the use of @author tag in comments. Most production code will have many authors during its lifetime, and information about who added and modified code is available in the source control system.
Which form does GW consider preferable?
1. if(not (a and b) or c)) { .. do something ..}
2. if(! (a && b) || c)) { .. do something .. }
3. if(! (a & b) | c)) { .. do something ..}
1
Form 2 works but is less readable. Form 3 will not work.
Choose the 4 types of events that ought to be logged:
1. Logfile rotation
2. Success
3. Object destruction
4. Identification
5. Recovery
6. Administrative session creation
7. Instantiation
8. Failure
9. Deployment
10. Suspension
2, 4, 5, and 8 are correct.
True or False: By default, PCF variables are calculated only once when the PCF loads, not every time it is referred to in the PCF's widgets or other objects themselves.
True
Are both of the following statements true?
1. Retrieving an item outside of the view entity backing the ListView can adversely affect ListView performance.
2. Retrieving an entire entity instead of its display name can adversely affect ListView performance.
Yes
Choose two of the five statements below that are NOT correct:
1. Log exception information before handling the exception.
2. Take care not to log and then accidentally "swallow" the exception.
3. Exceptions should be handled at the lowest possible level.
4. The preferred Gosu syntax for try/catch is to catch Exception and not use checked exceptions.
5. Avoid the Gosu "using clause" in preference to the Java finally block to release resources.
3 and 5 are wrong. Exceptions should be handled at the highest possible level and the Gosu "using clause" is actually preferred over Java's "finally" when releasing resources.
Three of these statements are correct. Choose the two that are wrong.
1. The suffix "_Ext" must be added to all new typelist names.
2. Always add at least a perfunctory description for all new typelists.
3. Always add an informative description for all typecode values in the new typelist.
4. Because the new typelist name is suffixed with "_Ext", there is no possibility of conflict for typecode values in the new typelist. Typecode values for the new typelist should also be suffixed with "_Ext".
5. The suffix "_Ext" must be added to all new typecode values added to existing typelists.
2 and 4 are wrong.
2: Descriptions should be informative, not perfunctory.
4. Typecode values in a typelist when added to a new typelist should not be suffixed with "_Ext". This is because the typelist name already has "_Ext" in it and typecodes are always distinguished by their typelist names, so no chance of conflict exists should GW add more typelists later.
Two statements are true. Pick them.
1. Sometimes exceptions are expected but should always be logged no matter as a matter of sound practice.
2. Sometimes exceptions are anticipated or even expected.
3. Typically, you would use the WARN logging level to log exceptions arising from the user interface.
4. ERROR level messages are intended for those cases where the user experience is affected.
5. Log messages should contain enough information to make it easy to track down who the developer of the code was so they can be contacted directly for assistance.
2 and 4.
1: You need not always log exceptions because they might be part of the natural application flow.
3: ERROR is used to log exceptions that affect the user experience. UI errors are very likely to do that.
5: Log messages should make it easy to know what the app state was and what was happening at the time.
True or False: Application permission keys, PCF variables, and entity queries are all components of possible approaches used to improve performance on a slow PCF page.
False
Entity queries are often sources of slow-downs, especially when repeated multiple times for each rendering of a page. Replacing entity with row queries is one way to reduce the amount of data returned from a database.
You need to access a field value that is not part of the ListView's object data source. What do you do?
Extend the view entity with a new field to return just the desired field value instead of the entire other object.