Join Kevin Skoglund for an in-depth discussion in this video Refactoring the add action, part of Ruby Essential Training.
In the last movie, we successfully coded the add action, and it does exactly…what we would want it to do.…It lets the user input the properties of the restaurant that they want to create…and then it saves them to the restaurant's file.…In this movie though, I want us to look at how we can refactor that action.…If you haven't come in contact with that word refactoring before,…code refactoring means rewriting the code to improve it, to improve its structure,…its readability, maintainability, performance, or its extensibility, being able…to extend it, without modifying behavior or functionality.…
So that's what we are going to try and do here.…The end result is it's still going to save it to the file, exactly the same.…But we are going to see how we can improve our code.…At the moment, our add action is creating a new restaurant and then setting all…of these values one by one and then saving it.…That's the behavior I want to change.…Instead of creating an object and adding attributes, I think an improved way…
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish
Skill Level Beginner
Q: You mention e-texteditor.com as a place to get a Windows "sister" version of TextMate. However, e-texteditor.com looks like a Chinese auto website. Are there any other alternatives?
1. Getting Started with Ruby
2. Ruby Object Types
3. Control Structures
4. Code Blocks
8. Working with Files
9. Ruby Project: Creating the Food Finder
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.