Skip to content

Instantly share code, notes, and snippets.

View gdoenlen's full-sized avatar
🦜
A Big Ball of Mud

George gdoenlen

🦜
A Big Ball of Mud
  • Pinnacle 21
  • Santa Monica, CA
View GitHub Profile
@gdoenlen
gdoenlen / Java.md
Last active July 21, 2024 21:37
Language features

These are the language features I think Java needs to solve the most of its fluidity issues.

Try as an expression

Try should be an expression much like switch. It would enable clearer try catch code.

var a = try {
    yield someFn();
} catch (SomeException ex) {
    yield default;
@gdoenlen
gdoenlen / Workflows.md
Last active July 18, 2024 12:38
Workflows, bugs, and encapsulation

Recently at work I was tasked to fix a bug that was occuring when a user would get assigned new roles. In our product we use roles to dictate what actions a user can do within the app. A user obtains a role either via an administrator assigning them a role or they can request a role and that request can later be approved by an administrator. Whenever a role gets assigned, the user's role requests for that role should also be approved. We have 2 main workflows where a user may be assigned a role:

  1. An administrator edits the user and assigns the role to a user via the user interface.
  2. An administrator can import a csv file with the user's email and their roles to be assigned.

The bug we were encountering was that in the bulk import workflow the user's requests were not getting auto approved. The product would then say the user had the role but was also requesting it. I discovered that both of the workflows were implemented individually and were both directly modifying the backing entity records. The

@gdoenlen
gdoenlen / AccountSelector.cls
Last active October 19, 2023 11:42
Simple dependency injection within SFDC
/**
* Selector for the `Account` entity
*/
public class AccountSelector {
public static final AccountSelector INSTANCE = new AccountSelector();
/**
* Finds all accounts that are child accounts of
* the given opportunity's account.