Skip to content

Instantly share code, notes, and snippets.

@seanpat09
Last active August 29, 2015 14:14
Show Gist options
  • Save seanpat09/62d47c72b1ab364080a4 to your computer and use it in GitHub Desktop.
Save seanpat09/62d47c72b1ab364080a4 to your computer and use it in GitHub Desktop.
What do you say you... do here?

Hello replacement! Below are some notes on what I am typically responsible for here at Apto and some general tips about the code base:

Responsibilities:

  • Github

    • Code review of Pull Requests

      • Check for sufficient unit tests
      • Check for unnecessary comments
      • Make sure I can understand what the code does without having to ask anyone. If not, ask author to simplify/clarify
      • Check what can be abstracted out. A lot of times several developers will be working separate but similar projects. Find the common ground so the code doesn't repeat itself.
      • Check for any name space issues:
        • Field name references should use the SObject describe methods instead of hardcoding strings:
        • Example: listing.get('Property__c') is BAD. Use listing.get(SObjectType.Listing__c.field.Property__c.Name) instead.
      • Note: all this is completely discretionary and a probably could use some formalization
    • resolve merge conflicts

      • This involves comparing the commit histories and making a determination of what is the correct code. This is why atomic commits are so important, or this becomes almost impossible. Especially when there are white space changes that cause "fake" conflicts.
      • This should probably be done by the PR creator instead of one person
    • perform final code review before merge into master branch

  • Managed package management

    • Get very familiar with this managed package guide from Salesforce. It'll let you know what can and cannot be updated via managed packages and will come in handy when making architectual decisions: https://na17.salesforce.com/help/pdfs/en/salesforce_packaging_guide.pdf
    • Create packages for release
      • Review all added components to make sure that needs to be added is added and not to release things that are not ready for release. Once it's out there, it's out there forever.
      • Make sure all profiles are configured correctly in the package.
        • We currently do not track the profile permissions correctly in Github. This needs to be fixed. Right now, I don't even deploy the profiles to the managed package from Github. They do need to be tracked though, if it is not in GitHub then ant test will fail most of the time because of permission issues.
      • Make sure the page layouts are configured correctly. This is another thing that we are not tracking very well in Github. In fact, I suggest we stop tracking them completely.
    • Manage push upgrades
      • Make sure that you are only pushing upgrades to customers on the CURRENT version. For example, a patch for the Winter 14 release should only go out to customers whose version number is 3.308 or higher. You can see the release numbers both in GitHub under Releases or in the managed package org under Setup -> Packages -> Commercial Real Estate Broker, and the click the Versions tab
        • The reason for this is because profile permissions don't get pushed to new orgs, only when a customer goes through the upgrade process. In the future, you may want to look into transitioning to Permissions Sets, which can be pushed.
      • After pushing an upgrade, check to see if any deployments failed. Sometimes they fail for no reason and just need to release again to those orgs.
  • Performing Technical Interviews

    • See this article for instructions on phone screens. Please add more questions to the wiki if you can: https://sites.google.com/a/aptotude.com/wiki/home/development/developer-phone-screen-questions
    • Lately I have been sending out the developer test first instead of phone screening first. Too many times I have talked to a candidate on the phone and thought they were ok only to be severly disappointed in the code. It saves you and the candidate time if you don't have to schedule a meeting first.
  • A list of tools and helper classes that I've created in the org.

    • Grab.cls -> Use this to grab a single field's value out of every item in a list. Creates a set so there are no duplicates. Ignores nulls
   Set<Id> propertyIds = Grab.ids( Listing__c.Property__c, listings );
  • MapBy.cls -> Map a each in list of objects to a certain field value. Warning: if several items in the list are mapped to the same field value, list items may be overwritten. Few use cases, only used it like once or twice
  List<Listing__c> listingsForOneProperty = //10 listings with all the same property__c
  Map<Id,Listing__c> propertyIdToListing = new Map<Id,Listing__c>();
  MapBy.Ids( Listing__c.Property__c , listingsForOneProperty, propertyIdToListing );
  propertyIdToListing.size() == 1 because they all shared the same key

  List<Listing__c> listingsWithUniqueProperties = //10 listings with different same property__c
  Map<Id,Listing__c> propertyIdToListing = new Map<Id,Listing__c>();
  MapBy.Ids( Listing__c.Property__c , listingsWithUniqueProperties, propertyIdToListing );
  propertyIdToListing.size() == 10 because they are all unique
  • CategorizeBy.cls -> Maps an entire list of objects to a certain field value
  List<Listing__c> listingsForOneProperty = //10 listings with all the same property__c
  Map<Id,List<Listing__c>> propertyIdToListing = CategorizeBy.Ids( Listing__c.Property__c , listingsForOneProperty );
  propertyIdToListing.get(property.Id).size() == 10
  • TestHelpers.cls -> A potential God class that just has random helpers for tests, nip this in the bud if you can.

    • Probably the most useful is generateSObjectMockId which generates mock Ids for when you need an Id field on a record without having to insert it. Note: setting an id on an object only works for classes > 26 (I think). If you find that your class won't compile because you are setting the Id, try increasing the version number in the metadata for that file.
    • SObjectFactory -> Extend this class to generate sobject records for your tests.
  • Helping the Support team

    • Support will often ask you for help debugging problems. Be timely in your response so that they can communicate with the customer. Always ask for steps to reproduce any errors.
    • You will occassionally be pulled into a support call. I recommend not going into a support call without someone on the support team on the line with you unless you already have talked to the customer and are comfortable talking with them. While most customers are nice, a few are downright mean and the support team will help deflect that aggression. NEVER give your direct line to a customer. They will sometimes get your direct line and if they start calling you directly, keep the support team up to date on all communications and get as much as you can in writing as possible.

The Code Base:

I consider Apto to have these main features:

  • Pipeline Conversion Process
  • Book Deal Wizard
  • Log a Payment Wizard
  • Listing Search w/ PDF Download/Email
  • Listing Service Integrations (RCM and Capdominus)

Here are few things to look out for in each:

  • Book Deal Wizard / Log a Payment Wizard (applies for both)

    • The javascript is VERY poor in here. Counters were used to keep track of rows on tables instead of using listeners combined with DOM traversal.
    • If you can, make this entire process client side. The combination of client side and server side data manipulation makes it REALLY hard to figure out where data is originating and being manipulated.
  • Listing Search w PDF Download/Email

    • I highly recommend just redoing this. This issue has been pushed back a couple of times is implementing the conslidated Listing_Search_Settings__c object into the currently existing Listing Search. Before doing that, consider just dealing with all the interactions on this page client-side instead of this poor hybrid of client and server side processing.
  • Listing Service Integrations (RCM and Capdominus)

    • The Capdominus integration was poorly planned out by me as it turned out to be kind of enterprisey with all of the interfaces. Every class related to the integration starts with Capdominus
    • The RCM integration is split up into two parts: First the listing sync batch job (RCM1IMporter.cls). The batch size is 1 in order to get around callout limits. After that batch job, the activies import batch (RCM1ActivitiesImporter.cls) is kicked off. RCM1API.cls holds some logic for doing the sync via the ListingSync.page
    • Both integrations use the ListingSynchronizer.cls abstract class. ListingSyncControllerExt.cls uses that abstract class to display the activated integrations on the ListingSync.page. You can add new integrations to that list by adjusting ListingSynchronizerFactory.cls. The ListingSync page and controller will be able to handle all the views.
@thepaulfox
Copy link

Sean's comments on page layouts and profiles:

I think layouts should be managed in the staging branches (like patches, staging, etc) in order to prevent merge conflicts and to keep from slowing down the devs when they don't really know where new fields should go. That way a BA can manage them and keep them in order all in one place.

Profiles are a little trickier because of those weird permissions issues (where we'd refresh the Profiles and try to deploy to another dev org and it would say that some of the permissions don't exist). Also there's the issue where only the Profile permissions for metadata that was refreshed at the same time as the Profiles themselves get pulled (e.g. if you refesh only the the Profile folder and the custom object folder you'll only have the profiles for the custom objects). Perhaps we only track certain Profile permissions (like VF page access, field access) to make it easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment