Wednesday, December 5, 2018

ruby on rails for dummies

if you are a dummy like me, here's the best way to learn how to develop web apps.

1) read the latest "agile web develpment with rails" by sam ruby (sam's family name is a mind blowing coincidence). just UNDERSTAND each paragraph. just relax and enjoy and do not bother trying to remember anything.

i saved the pdf version to my iphone so i can read it while waiting in line at the grocery checkout counter. you can email the pdf to yourself or save it to google drive so you can download it to your phone.

2) do the HANDS ON parts such as installing rails, instant gratification, and the depot application tutorial. just get things working. do not try to remember any syntax or command.

3) read the entire book again but this time, write down the major points or HIGH LEVEL algorithms/procedures for a major topic and memorize them before moving on to the next topic. no need to memorize any code or syntax. it's ok to forget what you learned from the previous topic after studying the current topic.

4) for each topic in the table of contents, try to narrate the high level features or CAPABILITIES of rails that fall under that topic. try to know what problem the feature solves or what would happen if the capability does not exist. be aware that whenever you need the feature or capability, you just need to COPY PASTE the code from the book and massage the code to suit your purpose.

most topics are self explanatory but some are not. example, "broadcasting updates with action cable" allows the price of a product or "items left" that a user is viewing to be updated without the user having to refresh or reload the page. "atom feeds" allows you to do something like this from the command line: curl --silent http://localhost:3000/products/3/who_bought.atom. 

at this point, you already have good knowledge about ruby on rails. but you still cannot rapidly create a web app. you would not know what to do or where to start. but if you do the following, you can QUICKLY START developing even if you haven't worked on rails for years and you forgot everything. 

5) print the 3 flow charts in the "what depot does" section and post them on your WALL. also print a list of all "bin/rails generate" commands in the book and post it on your wall. make sure you know what each "bin/rails generate" command in the list does.

in the pdf, just search "bin/rails generate" and copy-paste each found item to a text file. if you open the pdf from the iphone books app and search "bin/rails generate", it will list all the commands. 

THAT'S IT !!! you are now a rails jedi. you can quickly create any web app by simply re-drawing each of the 3 depot flow chart you posted on your wall except you modify it to suit your purpose. then start generating code by following any of the "bin/rails generate" command on the list and massaging the code to suit your needs.

---------- the "feature creep" void (enter at your own risk) ----------------------

(you have entered the void. be on the lookout for phony philosophizing, self-interested crusade, and the slurry of bullshit that will be fire-hosed on your face)

if you want to be a MASTER jedi in rails, you simply memorize each of the 3 depot flow charts and memorize the list of "bin/rails generate" commands. but keep in mind you are just a jedi in the dummy galaxy so do not join any coding contest or apply for a job.

what's the use of being a rails jedi if you can't even apply for a job? ruby on rails is like a saw or hammer. it's just a TOOL. building architects and engineers don't need to be good at using the saw and hammer but they need to know what it can do.

however, there are times when inventors need to know how to use a tool just enough to build a prototype and determine if the IDEA works or is commercially viable. example, i need a web app for my "golf on rails" book clinical trials (https://bit.ly/golf-on-rails). i also need a handicapping app for my barrio golf project (https://bit.ly/barrio-golf). i'm also planning to develop a lechon sharing app (https://ian-crystal.blogspot.com/2021/06/asal-lechon-sharing-app.html). 

if your flight is delayed and you will be stuck at the airport for quite a while, what else can you learn to ENHANCE your rails jedi skills? i would first make sure i'm already a jedi in the more important things in life before i enhance my rails jedi skills. example, i would watch the ted talks about gut health (my summary is in https://bit.ly/mafha). i would read one of the top investing books (a good intro is "https://ian-crystal.blogspot.com/2024/01/tucker-is-wrong-about-cramer.html). i would BROADEN my HORIZON by watching history and travel videos (kings and generals, history oversimplified, fearless and far, delos, peter santenello). the key to being a jedi on politics is to focus on human nature (https://ian-crystal.blogspot.com/2019/06/politics-for-dummies.html). 

once you feel you are a jedi on the more important things in life, my advice is to learn more HTML and CSS in w3schools. as always, do not memorize any syntax. the strategy is similar to my rails learning strategy.

1) read the entire html and css tutorial in w3schools and just try to UNDERSTAND everything you are reading. no need to remember anything.

2) go through each TOPIC in the table of contents drop down box (html and css) and make sure you have a high level idea on each topic's scope and features. 

most html and css topics are KINDERGARTEN. the next step is to master the none kindergarten topics:

3) memorize all the different types of css SELECTORS. 

4) master all the topics related to LAYOUT: display, max-width, position, float, multiple columns, media queries, mq examples, flexbox, and all topics under "css responsive" and "css grid". just try to know the PURPOSE of each line of code in the examples. ignore the formatting codes such as color and size. google the keywords if you don't know the purpose of a code that looks important. click the "try it yourself" button and resize the browser to see the feature in action (note you can only do this on a pc because you can't resize a phone's browser window).

next, read the "REGULAR EXPRESSIONS" chapter in the "programming ruby" book by dave thomas. you don't need to memorize any syntax. just know what regular expressions can do. this gives you the power to create sophisticated regular expressions. although you won't be able to answer job interview questions because you will need to refer to the book.

next, master the parts of the RUBY language that is needed in developing rails apps. try to remember all the concepts in the "introduction to ruby" chapter of the rails book especially the blocks, iterators, and idioms. although not important, you can read part I of the book "programming ruby" by dave thomas. the other parts are only important if you are developing your own framework or very big program using pure ruby code.

next, learn more JAVASCRIPT in w3schools by reading the topics under "js html DOM". as always, just be familiar with the high level features and capabilities that will be useful in developing a web app in rails. just know that javascript has data types (e.g. strings, numbers), operators (arithmetic, string operators), functions, while loops, etc ... just like all other programming languages. 

what makes a javascript book very THICK is that it's also an object-oriented language and it allows functions to be assigned to variables, passed as arguments, and returned as values. you don't need these features unless you are developing a very sophisticated web app or creating your own javascript library. javascript also has powerful graphics capabilities which you don't need unless you are developing very fancy web app or browser game. 

keep in mind that it's the substance that matters. CRAIGSLIST has a very SIMPLE UI and it's very successful. it's still popular even until now. you really don't need fancy UI to make your ideas work. maybe if the idea starts making lots of money you can hire real programmers to take the app to the next level. you only need strong javascript or react skills unless you are applying for a job.

if you have done all of the above and you are waiting for your pho bo to be served, learn REACT by going to https://react.dev/learn. just go through the topics under "get started" (quick start, tic-tac-toe tutorial, etc ...)


(for more of my knowledge bombs, click the "ian's knowledge bombs" banner at the top of this article and choose any article in the table of contents that piques your interest)

No comments:

Post a Comment