Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Developers Are Users Too

Leo Sjöberg
September 19, 2017

Developers Are Users Too

When we build an application, we build it for our users – the ones paying for our application, the ones that interact with it. However, we often forget that the ones interacting with our application the most is another group of users – our own colleagues, developers. We'll discuss how building a good UX isn't all button placement and using the right contextual colours, but how it also means catering to the developers on your project, and how we can use Laravel's logging system, internal documentation and commit messages to make everyone on our team happier, and deliver faster. We'll also look at some of the pitfalls that can confuse a new developer who's joining your team, and the simple ways in which we can work around it to make both onboarding and development a better, more enjoyable experience.

Leo Sjöberg

September 19, 2017
Tweet

Other Decks in Programming

Transcript

  1. foreach (['[email protected]', '[email protected]'] as $email) { Mail::send('emails.welcome', [], function (Message

    $message) use ($email) { $message->from('[email protected]', 'Sparky'); $message->to($email); $message->subject('Welcome to Sparky!'); }); }
  2. foreach (['[email protected]', '[email protected]'] as $email) { Mail::send('emails.welcome', [], function (Message

    $message) use ($email) { $message->from('[email protected]', 'Sparky'); $message->to($email); $message->subject('Welcome to Sparky!'); }); } // We loop over the email addresses here because ServiceHub is unable to handle // multiple `to` addresses. This happens because PHP < 5.6 uses a version of // PCRE which incorrectly compiles the Regex used with address validation. // // https://github.com/swiftmailer/swiftmailer/issues/382
  3. $sp = fopen('php://input', 'r'); $op = fopen($path, 'w'); while (!feof($sp))

    { $buffer = fread($sp, 512); fwrite($op, $buffer); }
  4. public function upload(UploadVideoRequest $request) { if ($this->videos->existsByUploadId($request->upload_identifier)) { throw new

    VideoExistsException('This video was already uploaded.'); } $filename = $this->buildFilename($request); $request->file('video') ->store($filename); return response()->json( $this->videos->create($filename, $request->all()), Response::HTTP_CREATED ); }
  5. if ($this->videos->existsByUploadId($request->upload_identifier)) { Log::notice('Duplicate video upload detected'); return response()->json([ 'code'

    => 'video_exists', 'message' => 'This video has been previously uploaded' ], Response::HTTP_UNPROCESSABLE_ENTITY); }
  6. if (! $this->videos->isUnique($request->upload_identifier)) { Log::notice('Duplicate video upload detected', [ 'data'

    => $request->all(), 'user' => $request->user(), ]); return response()->json([ 'code' => 'video_exists', 'message' => 'This video has been previously uploaded' ], Response::HTTP_UNPROCESSABLE_ENTITY); }
  7. return [ 'default' => ['laravel', 'errors'], 'channels' => [ 'laravel'

    => [ 'driver' => 'daily', 'format' => 'json', ], 'errors' => [ 'driver' => 'single', 'format' => 'json', 'middleware' => 'level:error', ], ], ];
  8. class SingleChannel extends Channel { /** * Setup a new

    handler for a single file. * * @param array $options * @return void */ public function prepare(array $options = []) { $this->writer->pushHandler( new StreamHandler($this->app->storagePath().'/logs/'.$options['file']) ); } }
  9. Consumable Understandable Debuggable Document hacks, strange fixes, and inner workings

    Set out detailed code standards Log Everything Use Monolog
  10. Consumable Understandable Debuggable Document hacks, strange fixes, and inner workings

    Set out detailed code standards Log Everything Use Monolog