Make this code better

  • Best way to remove duplication 5 reactions

    I have duplicate code in two methods (so far) of one controller: indexAction and editAction. Similar duplication is going to occur in any other controller with similar methods as well. I'm just wondering what is the best way to remove or reduce it. I could make a getGrant($slug) method and put t

    Tocacar about 6 years ago
  • Service Layers 4 reactions

    While helping out the guys at youhighfive.me we were discussing a Service Layer and how to write controllers in better ways, and form processing was one of the issues that came up. This is the current structure and i'm making a few suggestions.

    Rafael Dohms about 6 years ago
  • [php] How do apply rule one from object calisthenics to this code? 7 reactions

    I want to know how avoid two level of identation on my controllers that process a form.

    Diego Oliveira about 6 years ago
  • Rails - controller code cleaned up? 2 reactions

    I know this is more php on this site, but can any rails coders take a look at the controller code here? Looking to refactor. Thanks!

    bob shaw about 6 years ago
  • Static file cache with namespaces support 6 reactions

    Static file cache with namespaces support

    Gabriel Ricci about 6 years ago
  • Memcached cache with namespaces 2 reactions

    Memcache library with support for pseudo-namespaces

    Gabriel Ricci about 6 years ago
  • Avoiding a lot of ifs in Ruby 1 reactions

    I have a serious nesting of ifs in a helper code and I would like to making cleaner. I would like to avoid case if possible as well. I know there is probably a more Object-Oriented approach to this but I can't seem to know how.

    Pedro Nascimento about 6 years ago
  • Getting the right object value from a Doctrine Collection object 4 reactions

    I have a m-m relationship between 'room' and 'guest' with a join table in the middle called 'booking'. Columns in the 'booking' join table are room_id, guest_id and dateIn, dateOut to record when a guest is booked in/ out of the room. I have a method that gets a Doctrine (1.2) collection of all

    Tocacar about 6 years ago
  • PDO Data Model 5 reactions

    This is a basic PDO Data Model that I'm curious if there was a way to make it any better.

    Jacques Woodcock about 6 years ago
  • [Sample Entry] My Validation Script 9 reactions

    This is a sample code I use for my Object Calisthenics talk, which is where this website was born (read about page). Its a trivial code but it can be made better and simpler, easier to read and even faster. So to give you an idea of how to use this website, i'll be posting the code and fixing it mys

    Rafael Dohms about 6 years ago