The BEST Naming Strategy for Any Programming Language

  • Shortest names possible
  • Easy to understand
Readily Logo
Example of Readily Features

Naming Conventions != Naming Strategy

  • camelCase : all words except the first are capitalized at the first letter (JavaScript)
  • PascalCase : all words capitalized at the first letter (C#)
  • snake_case : all lowercase, words separated by underscores (python)

High-Level Overview

Prefixes, Why?

  • current (integer), indicates the sentence number the user is on
  • highlights (map), indicates which sentences should be highlighed
  • commands (array-like), stores the command history
Prefix Table
[1] The commands object most closely resembles a stack. A command is pushed to the object to be at the top. However, when undoing, the top command is just popped and discarded. The undone commands are kept until a redo is executed or the user applied a new command to overwrite the popped commands. The popped commands could be stored in another stack.

Further Notes on Prefixes

  • doIter
  • user
  • calc & get

Additional Functions

  • componentDidUpdate: compare previous state and new state, then apply do functions

Example Flow

/**
* The following chain will increment the this.state.current
* value to indicate that the next sentence should be
* highlighted.
*/
userMoveNextSentence() // Calls the command function to
// record the action
- commandMoveNext() // Calls the execute to apply state change
= executeMove(commandProps) // Causes the re-render
- (state-change re-render)
- componentDidUpdate() // Calls the do functions to
// remove the previous
// highlight and add the next one
- doRemoveHighlight(prevN), doAddHighlight(nextN)

Conclusion

Award-Winning Software Engineer | Business and Web Consultant

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Finding connected components in a Graph

Angular animations

Publish Events using SNS, SES, and the Serverless Framework

Interfaces in TypeScript Pt. 1

Angular Tutorial ( Day — 1)

Act 2: “The Client” — Part 2 (Workers and Parallel Computing)

Why React Hooks: A Declarative Data Love Story

Send Emails with Amazon SES, Part 1: Simple SES Template

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Justin San Juan

Justin San Juan

Award-Winning Software Engineer | Business and Web Consultant

More from Medium

A beginner’s guide to Git Version Control — in terminal

What Are Microservices and 4 Reasons Why You Should Begin Using Them in Your Applications

What exactly is the Cypress framework?

How to Revert Local Changes with Git Restore