Hacker News new | ask | show | jobs
by MichaelBurge 3819 days ago
Get used to using 'grep' or 'ack' to dig through a codebase to find things. For example, if your task is, "Add a new button 'Find Vendors' next to the 'Find Clients' button on the Company Search report", I would:

1. grep for the string 'Find Clients' to find the UI

2. Note the URL that it hits when you click it

3. grep for a unique fragment of that URL to find where the routes are stored. Make sure you grep for something 'static', so if the url is '/search/query.html?action=search_clients' you could grep for 'query.html'.

4. The route should map to some code that implements it. grep for the controller or whatever else you find in the routes.

5. Once you've found the controller, something there should retrieve a list of clients. Find out how it's hitting the database.

Then you should know enough to tack on a new button in the UI and modify the controller to hit the database in a different way. Something as simple as 'grep' I never used in college or high school, but use all the time having needed it on the job for the past couple years.

1 comments

IDEs really are much better at this than grep or ack. My experience has always need something that can perform symbol resolution, and something more powerful than grep or ack wins here. You may be ack-guru and and do that on the fly, but the rest of us mortals are not willing to put in the effort when some other dev has given us a command line tool, an editor plugin, or an IDE to do that for us. Its all about how much time you want to spend feeling cool and how much time you want to spend getting things done.