##Some ways to iteratively reduce your code distance:
- pair with developers
- learn to write pseudo code
- integrate live style guides into your practice
- try designing and implementing a very small, very simple app (better yet, pair w someone doing it.)
before_save :generate_title_slug | |
protected | |
def generate_title_slug | |
title_slug = self.title.downcase.strip.truncate(50) | |
#replace spaces with dashes | |
title_slug.gsub! " ", "-" |
# disable submit unless all fields with .require_field class have values | |
$(document).ready -> | |
total_required_fields = 0 | |
$( ".required_field" ).each -> | |
total_required_fields += 1 | |
if $(this).val().trim().length == 0 |
##Some ways to iteratively reduce your code distance:
##The client's description of the problem
>A major challenge for us is adding new employees to our HR system, which is connected payroll, benefits, email, and many other internal system. Currently, this is a manaul process, involving the security staff, IT, and HR personnel. It’s very time-consuming and it leads to delays in new employees having access to internal tools. The main goal of the tool is to provide new employees with an Employee ID. After that, we need to use that ID to give them access based on their department, role, and level of seniority. For example, a VP of Engineering will get all kinds of admin-level access to a range of internal systems, while, say, a product manager, would likely only get access to email, the intranet, and a few other services. In order to provide the ID, we have to confirm their identity. This can be done using either the last four of their SSN, valid driver’s license number, or a valid passport number. We use an external service to confirm that this number match
##Code Distance Activity
##What's Your Code Distance?
##Goals
##Links
##Pseudo Code Basics: Everyone will have their own approach. This is mine...
describe "Cut two slices of bread and place on the plate" do | |
it "grasps the Knife in a cutting grasp" do { | |
#code that attempts to complete this task | |
#if it passes, it returns something to hte effect of "test passed" | |
#if it fails, it returns a message like "grasps the Knife in a cutting grasp" failed, for the following reasons, eg no 'No Knife was found' | |
} | |
# Grasp the bread-loaf and place it on the table, such that it is directly below the knife. | |
# Position the bread-loaf such that it is perpendicular to the cutting edge of the knife and move the bread-loaf laterally until only a half inch is below the knife. |
#Explain to an Alien How to Make a Peanut Butter and Jelly Sandwich
##Your assignment