Photo by Windell Oskay
Colin O’Byrne and I talk about SDD, a term that was coined in the New York office of Pivotal Labs.
Photo Credit: Eastern Market Identity Guide by Daryl Tanghe
I have recently become more comfortable with the command line, but for a long time felt like that blinking cursor was telling me “you. remember. nothing. you. remember. nothing.”
I have a visual memory. I can picture a drawing of the water cycle from my fifth grade text book, and I remember that the drawing was on the left side of the page. The command line makes poor use of a visual memory (though setting up the bash shell with some colors can help), and I thought perhaps we could do better.
Ages ago, 2010ish in fact, I imagined a solution, which I called the magical command line. I pictured a series of in-context drop-downs that could guide someone who was less comfortable with this mode of interacting with the computer. For example, when a user typed
gi the drop down might suggest git, gitk, git-duet, or any number of other commands beginning with the letters gi.
I also wanted a command line that would auto suggest things that could be found in help documentation (without me needing to type –help again and again). As the user finished typing
git and then added a trailing space, the suggestions would auto-update to match the new set of constraints, and only subcommands of
git would be suggested.
So, when I type
git m, the magical command line would in a context sensitive way, realize that I’m typing a subcommand of git and auto-populate the drop-down with subcommands that begin with the letter m. Notice how the icons and colors change to let the user know they are dealing with a primary or subcommand.
As I select the second option
git mv the magical command line now populates the drop-down with two file-picker triggers for both the source and destination file. Different iconography distinguishes the file picker from the regular command/subcommand suggestions.
When I choose source, it opens an OS specific file picker.
Is this still a good idea four years later? I don’t know. I think it would still help beginners and those with visual memories like mine get comfortable with the command line faster. Maybe in the intervening years something like this has already been created? If so, I’d love to hear about it. What do you think? How does your memory work best? Would this tool help you?
Note: Obviously the interaction is heavily inspired by my use of adobe products. I even proposed this to Adobe years ago because I thought it would be a great bridge-tool for designers on the nerdier end of the spectrum, but the PM just smiled and nodded. Maybe it’s actually a dumb idea? I thought I’d put it out there before I nuke this buggy laptop and possibly lose the designs forever.
Photo Credit: Carlos Rios
Or is it Ruby? I’m not really sure. I’ve been building the sample app in Chapter 2 of this Ruby Tutorial, and straight away I can see that my CSS is getting structured incorrectly for long term maintainability.
I used rails to generate the User automatically…
rails generate scaffold User name:string email:string
rails generate scaffold Micropost content:string user_id:integer
I did not order these stylesheets
I took a look inside
/app/assets/stylesheets/, mainly because I wanted to spend a bit of time in a part of the app that was likely to look more familiar to a front-end developer. ;)
What I found surprised me. There were already four stylesheets – none of which I would have created were I rolling a brand new app by hand.
application.css microposts.css.scss scaffolds.css.scss users.css.scss
Erm, weird. Our CSS architecture should certainly not match our back-end architecture if we want it to scale. It seems like rails creates a new stylesheet every time I make a new model (and some other times too, because scaffolds aren’t a model).
How could Rails handle CSS better?
As a first pass, it seems like it would make sense for rails to add command line options to add CSS components. So you could ask rails to add buttons and it would create sass files for buttons, add .erb templates, etc. Maybe they could even be dependencies? I’ve been thinking that it would be cool to add components like buttons, boxes, grids and media blocks to NPM so that a project could require buttons and automatically get any code required for them without including an entire front end library. Maybe rails needs something similar.
Is that nuts? What do you think? Has your CSS stayed maintainable on Rails projects? I’d also love to hear about it if I’m misunderstanding aspects of Ruby, Rails, or the line between the two.
Photo credit: Christina B Castro