Guidewire Query API and Profiler Best Practices, Exams of Electrical and Electronics Engineering

Best practices and anti-patterns for using the guidewire query api, as well as an overview of the guidewire profiler tool. It discusses topics such as logging, performance optimization, and branching strategies in guidewire development. Guidance on efficient querying, avoiding common pitfalls, and leveraging profiling capabilities to identify and address performance issues. It also covers key concepts related to git source code control, including branching strategies, merging, and best practices for managing code changes. This information is valuable for guidewire developers and architects who need to ensure their applications are optimized for performance and maintainability.

Typology: Exams

2024/2025

Available from 09/26/2024

BESTOFLUCK
BESTOFLUCK 🇺🇸

3.9

(10)

4.5K documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Guidewire Best Practices Exam - Complete
Study Guide 2023
Avoid using internal path for your classes - Answer - com.guidewire.* should be
avoided. These can always be potentially changed or replaced during an upgrade.
When referencing typecodes, use the static property on the typelist class instead of
the string representation - Answer - Use TC_TYPECODE instead of "typecode",
example: LossCause.TC_REAREND instead of "rearend"
Use the text for logical operators instead of the symbols - Answer - Use "and","or",
and "not" instead of "&&", "||", and "!"
Code placement - Answer - 1) Avoid placing code within the CODE tab of a PCF.
Create a UI helper class instead
2) Avoid extending entity enhancements with code supporting UI operations
Avoid using deprecated classes and methods - Answer - Guidewire will eventually
remove deprecated classes and methods.
Turn on and run Studio Inspections - Answer - These analyze configuration
resources
Use whitespace effectively - Answer - Add spaces around operators
Do not add spaces between parentheses and operators
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Guidewire Query API and Profiler Best Practices and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

Guidewire Best Practices Exam - Complete

Study Guide 2023

Avoid using internal path for your classes - Answer - com.guidewire.* should be avoided. These can always be potentially changed or replaced during an upgrade. When referencing typecodes, use the static property on the typelist class instead of the string representation - Answer - Use TC_TYPECODE instead of "typecode", example: LossCause.TC_REAREND instead of "rearend" Use the text for logical operators instead of the symbols - Answer - Use "and","or", and "not" instead of "&&", "||", and "!" Code placement - Answer - 1) Avoid placing code within the CODE tab of a PCF. Create a UI helper class instead

  1. Avoid extending entity enhancements with code supporting UI operations Avoid using deprecated classes and methods - Answer - Guidewire will eventually remove deprecated classes and methods. Turn on and run Studio Inspections - Answer - These analyze configuration resources Use whitespace effectively - Answer - Add spaces around operators Do not add spaces between parentheses and operators

Indent logical blocks of code by two spaces only Add a blank line after code blocks Add two blank lines after methods, including the last method in a class Comments and Annotations - Answer - Document new classes and functions with Javadoc-style comments Use single-line comments within functions and methods when you need to clarify the intent of the code Use GoseDoc annotations which are included when generating GosuDoc "Upgrade-Safe" naming conventions: Add the suffix _Ext to - Answer - Columns added to existing entities Typecodes added to existing typelists The name of custom entities The name of custom typelists New PCF files Script parameters Package naming conventions - Answer - Use the format customer.application.featurecategory.feature Customer - company name abbreviation Application- InsuranceSuite application code (pc, bc, cc, suite) Feature Category - major feature (delinquency, configuration, integration) Feature - feature (rating, catastrophe, authentication) Example: si.suite.integration.authentication Class naming conventions - Answer - Use UpperCamelCase

Logging components - Logger - Answer - has a category and level, sends content to an Appender Logging components - Appender - Answer - is an output destination (server console or rolling file) Logging components - Layout - Answer - defines the format of the content sent to an appender Logging Level - Trace - Answer - Description: Fine-grained informational events When to use: Log method entry and exit Logging Level - Debug - Answer - Description: Detailed informational events When to use: Log important steps and calculations for diagnosing problems Logging Level - Info - Answer - Description: Coarse-grained informational messages of progress When to use: Log the occurrence or result of an important event Logging Level - Warn - Answer - Description: Indicate a potential problem When to use: The user experience has not been affected Logging Level - Error - Answer - Description - Indicate definite problems When to use: The user experience has been affected

There are 2 ways to initialize a logger in Gosu - Answer - Integration: PLLoggerCategory.INTEGRATION Plugin: PLLoggerCategory.PLUGIN Use sub-level of existing logging category to maintain structure. Example: PLUGIN.MotorVehicleRecord static var _motorVehiclePluginLogger = LoggerFactory.getLogger(PLLoggerCategory.PLUGIN."MotorVehicleRecord") Logging Format should be - Answer - a standard format to simplify analysis of large logs Guarded Logging should be used - Answer - To test log level before logging costly messages (those with expensive expressions) Typically used with the DEBUG level Format is - if (_logger.DebugEnabled) { } Not required for parameterized expressions lacking expensive operations, as in: var hello = "Hello" var world = "world" _logger.debug("{}, {}!", hello, world) Logging: Exception Messages - Answer - Logged at the ERROR level when user interface is affected

Avoid the use of where(), first(), last(), firstWhere(), and lastWhere() Guidewire Query API Anti-Patterns - use dot notation with care because - Answer

  • accessing foreign keys or array fields retrieve additional entities into memory Guidewire Query API Anti-Patterns - Check for existence of an entity when the number of results is not important by - Answer - Verifying the results of a targeted query are not empty Avoiding hasMatch(), countWhere(), and select().Count Guidewire Query API Anti-Patterns - When a count is necessary, let the database count the entities and - Answer - Avoid countWhere() Avoid counting collections Avoid iterating over entities from the database to count them Avoid counting entities before accessing them Avoid countWhere() and select().Count Guidewire Query API Anti-Patterns - Avoid queries to check for new or changed entities, instead - Answer - Use Boolean methods getChangedFields, getAddedArrayElements, getChangedArrayElements, and getRemovedArrayElements Use specialized methods that test for new or changed entities when available (Claim.PolicyChanged) Guidewire Query API Anti-Patterns - Avoid queries to access new or changed entities by - Answer - Use Boolean methods getChanged, isFieldChanged, isArrayElementAddedOrRemoved, and isArrayElementChanged Check the Gosu API for specialized methods on entities

Guidewire Query API Advanced Concepts - Entity queries - Answer - should be used unless performance is not adequate Guidewire Query API Advanced Concepts - Row queries - Answer - Use a single database query on the main entity and related entities to return only the data columns you select from the database Allow you to use only the values contained the query results Filter the rows returned from the database using query.compare Involve more code maintenance and should only be used when performance issues are encountered with an entity query Support database aggregate functions (Avg, Count, Min, Max, Sum) Guidewire Bundle Management - General information for Bundles - Answer - A bundle is an in-memory container for entity instances representing rows in the database Bundles are read via queries or foreign key and array accessors Caching at the local and global level improves performance of bundleso Bundles can be read-only or writable Guidewire Bundle Management - A Current bundle is created by the application and is - Answer - Read-only or writeable Contains entity instances available to current code context Guidewire Bundle Management - A New bundle is created in code and is - Answer

  • Writeable Code determines the contents

Guidewire Bundle Management - Gosu syntax for bundles: Determine changes/original values in a bundle by using - Answer - myEntity.Changed myEntity.isFieldChanged(Entity#FieldName) myEntity.getOriginalValue(Entity#FieldName) Guidewire Bundle Management - Gosu syntax for bundles: Mass updates - Answer

  • Use paging with regular commits for mass updates (for example, in batch processing) Setting the page size: resultObject.setPageSize(1000) Bundle or chunk size: "for (entities in com.google.common.collect.Iterables.partition(resultObject, 250)) {} Use ScriptParameters to determine the optimal Page/Chunk size UI Performance Best Practices 3 examples of expensive expressions are - Answer - Multi-step dot paths - exposure.Claim.Catastrophe.ClaimsHistory Array expansion - User.MemberGroups*.DisplayName Collection methods - allMatch(cond) UI Performance Best Practices 3 examples of problematic expression usage in the UI are - Answer - Called on multiple properties of a single widget Called on multiple widgets in the same PCF Solution - create a PCF-level variable that evaluated the expensive expression once UI Performance Best Practices

Test for visibility or editability of a widget based on permissions by - Answer - Examining role privileges directly to determine the user's role uses a collection method in the background and performs poorly Using application permission keys (perm.System.editobfuscatedusercontact) performs well Extending the SystemPermissionType typelist with new permissions is a best practice ListView Performance Best Practices Using View Entities can - Answer - Improve performance for viewing data in a list view Include data from related entities via a path from the primary entity to a related entity Be subtyped ListView Performance Best Practices Array-backed list view features: - Answer - Full set of data reloaded when list view rendered and when paging, sorting, and filtering Paging, sorting, and filtering are enabled when editing Example - an array field ListView Performance Best Practices Query-backed list view features: - Answer - Only the first page of data is loaded when the list view is rendered Query is rerun and the first page of data is loaded when paging, sorting, and filtering Paging, sorting, and filtering are disabled when editing Examples - a query processor field, a finder method, a query builder result

GUnit Testing - GUnits 3 Facts - Answer - Available in Studio and can be run from Studio Can be automated as part of Continuous Integration Cannot test the User Interface or Gosu Rules GUnit Testing - Test Classes - Answer - Names must end with Test Extend gw.api.test.XXServerTestClassBase or gw.api.test.XXUnitTestClassBase Can include beforeMethod/afterMethod methods that run before or after each test method is invoked Can include beforeClass/afterClass methods that run as test class is loaded or after all tests are executed Are best organized in packages based on testing needs Can be created to be reused for repeated functions or data generation GUnit Testing - Test Methods - Answer - Names must be lower camel case, have names that start with test, and describe the test being executed Set up test data using entity builders and variables Test and verify results using assert statements Include annotations (optional) GUnit Testing - Test annotations are - Answer - strings that begin with @ and provide metadata about a Gosu element Example: uses gw.xml.ws.annotation.WsiWebService

@WsiWebService() GUnit Testing - There are two types of test annotations - Answer - Server runtime annotations appear before the class definition and indicate how the test interacts with the Guidewire server Environmental annotations provide additional test functionality and override default system behavior GUnit Testing - For code usability you should create - Answer - Test helper classes or functions GUnit Testing - When executing a GUnit test, do so by - Answer - Package or Class GUnit Testing - 4 characteristics of effective unit tests are - Answer - Readable - speeds up developer productivity Accurate - predictable and repeatable Fast - long-running tests slow development and are abandoned Independent - can be reliably run in isolation from other tests to identify root cause of a problem Guidewire Profiler is used to - Answer - Investigate performance problems in the production environment Help find and diagnose problems with database queries, rules, and other Gosu code Detect problems early by developers Guidewire Profiler

Saves results in database Guidewire Profiler is accessed 2 ways - Answer - Navigate to Server Tools (Alt+Shift+T), select Profiler from left pane Popup from an application screen (Alt+Shift+P) Guidewire Profiler Before capturing a profile you must first do these 2 things - Answer - Clear the application cache to force queries to go to the database Enable stack traces to show the widget or code where queries originate (impossible to pinpoint root causes otherwise) Guidewire Profiler - Web Profile terms - Answer - Frame is single invocation of a profiled section of code Stack is single server round trip that includes multiple frames Profile is a single Profiler session that includes multiple stacks Guidewire Profiler - Web Profile Analysis terms - Answer - Offset - chronological order of stackso Elapsed Time - execution time Own Time - time that is unaccounted for, indicates the need for code tags Show Queries - shows query aggregated view (default) Find Frames - used to find frames based on text search Query Details - SQL, Raw SQL, Basic, Stack Trace, Filtered Stack Trace, PCF Stack Trace PCF Stack Trace - shows PCF widgets related to the SQL Guidewire Profiler - Web Profile Analysis Guidelines - Answer - Limit each Profile to a narrow focus of interactions

Look beyond timings (the H2 database is fast and not always reflective of a production environment) Focus on anti-patterns, poorly written, or multiple execution of queries Test thoroughly using a representative data set to simulate scaling Guidewire Profiler - Entry Point Profiles and Profile Tags Profiling custom Gosu code requires these two things - Answer - Creating custom profiler tags Adding the tags to the custom code Guidewire Profiler - Entry Point Profiles and Profile Tags Profiler Tags - Answer - Are defined in a separate class as public static final variables Improve the ability to analyze performance issues Guidewire Profiler - Entry Point Profiles and Profile Tags Use the Profiler.push("profiler_tag") to - Answer - push a frame onto the stack to begin profiling Guidewire Profiler - Entry Point Profiles and Profile Tags Use the Profiler.pop(some_frame) to - Answer - pop a frame off the stack to end profiling Source Code Control Key Concepts Git: - Answer - Is a distributed version control system (DVCS) Stores links to previous versions of unchanged files Provides each developer with a full copy of the entire history of the project

Bitbucket Server: - Answer - Is used as the remote code repository for Git Facilitates code reviews by means of pull requests Supports various Git development workflows Can automatically propagate merge changes from earlier to later branches Source Code Control Key Concepts User story development with Git - Clone, Checkout, Stage, Commit, Push: - Answer - Clone remote repository to duplicate it on your local repository (Fetch to retrieve latest changes to existing local repository) Checkout the files in your working directory to create a local branch off develop Stage changes locally - use task-level commits as work is completed ▪ Git status command displays both staged and unstaged changes ▪ Git add command to add files to commit to staging area Commit changes added to staging area to create a new snapshot of the project (stores modified and added files and a point to previous version of unmodified files) Push user story branch back to origin (the remote repository) Source Code Control Key Concepts Branching Strategy - Branch: Production - Answer - Description: Contains code currently in production Naming convention: master Created: Start of new implementation Deleted: n/a Source Code Control Key Concepts

Branching Strategy - Branch: Product Release - Answer - Description: Contains changes for new Guidewire product versions Naming convention: gw-releases Created: Off master at beginning of project Deleted: n/a Source Code Control Key Concepts Branching Strategy - Branch: Mainline - Answer - Description: Contains code across all releases Naming convention: develop Created: At beginning of project Deleted: Source Code Control Key Concepts Branching Strategy - Branch: User Story - Answer - Description: Create off develop to deliver a user story Naming convention: user/{user_id}/{US_id} Created: When development begins Deleted: When story accepted Source Code Control Key Concepts Branching Strategy - Branch: Defect - Answer - Description: Create off develop or a release branch for changes to address a defect Naming convention: user/{user_id}/{DE_id} Created: When work starts on defect Deleted: When defect tested and closed