• Home
  • About
    • Bio
    • CV
  • Music
    • Shows
    • Works
  • Research
    • Works
  • Programming
    • Projects
  • Blog
    • Watson
    • Viget
  • Contact
    • Message
    • Subscribe
    • Availability

Voting Shenanigans

30 Jun 2016

Reading time ~2 minutes

What I Did

  1. Added finishing edits to my comment branch.
  2. Have gotten up/down voting completed for articles and posts - bare minimum functionality

What I Learned

  1. Default scope can mess with things if one attempts to implement specific orderings for records in particular parts of an app.
  2. Public methods in controllers ought to align with available application actions. Ideally, all other methods would be private.
  3. A counter cache contains counts for a model’s associated models. If I were to have implemented up and down votes as two separate classes without values of their own, I would have to do SQL calls to the my database for all of the votes associated with a given votable (i.e. post or comment) in order to tally up an up/down vote counts or an overall score. Caching allows for these values to be accessible by simply adding a counts field to the record itself. However, since I’ve implemented voting by adding upvote and downvote count fields as attributes for my votable models (i.e. post or comment), I simply can access that data directly by a single SQL call to a given record’s count attributes. The downside to this, of course, is the additional memory requires by those additional fields.
  4. A race condition is an undesirable situation in which a device or system attempts to perform two or more operations at the same time. However, for the device or system to operate properly, the operations must be done in the proper sequence. In order to avoid such situations, one may require an operation to be atomic using synchronization mechanisms in order to make sure that the operation is seen, from any other thread, as a single, atomic (not splittable) operation.

What I’d Like to Learn

My startup ‘accelerator’ group met up yesterday in order to discuss the technical overview for our proposed project (an interest and geo-locational driven social media app). We’ve decided to utilize FaceBook’s API, Firebase, NodeJS, a SQL database, Amazon S3, and Android/iOS platforms. I’ve been assigned to navigate designing the Android UI, which I’ve never done before (let alone work with the majority of the mentioned technologies). At the NerdTalk meeting today, I mentioned our plans to the other developers present, and they mentioned that I ought to consider using React Native instead, so I would not have to tackle Android Programming from scratch. We’ll see how things go…



Share Tweet +1