Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
jQuery Basics - Planning question
In this part of the problem solving process, Andrew lists all the steps required to fix the problem. My question is, what is a good way to get started learning how to list the plan when trying to tackle a project on your own? If I had the planning down, performing is the easier part. If it's just about experience, how would you even get off the ground to accumulate it?
Andrew Shook31,709 Points
I start my planning process by defining what my goal is and then defining what the data is that I am working with. For example, I need to build a jQuery form validator ( note that I would never do this because there are a lot of good ones out there). So in this case my goal is to validate a form and my data will be the user input from the form.
Then the next step in my process is to determine what I need to do with the data to accomplish my goal. The short answer is I need to validate it. The long answer is I need to define what is and what is not valid for each input field in the form. For this I use my Google-fu and do some research. For example, what are common features of an email address. Well, it will have some kind of string, followed by an @ symbol, followed by another string, followed by a dot, followed by another string. So all email address look something like this: email@example.com
Once I finish my research I build out the structor I need to start testing (the form in this case), and determine what steps I need to take to check the data. In this example, I should probably stop the form from submitting until the jQuery validates it. How should I do that? Lets ask google. Now that the form isn't submitting what should I do? Well each field will probably need its own validator so I start writing those. They work fine individually but I didn't tell the jQuery when is should use each validator. How do I do that? GOOGLE IT or ask a co-worker/boss/forum. Oh I'll just tell jQuery to check the type attribute of each input element and then select the correct validator.
That's pretty much my work follow. Figure out the goal, figure out the data, and then figure out how to get the data to do what you need it to do. And if the data can be broken down in to chunks (like the form example), then I separate the data by its differences and group things that are alike. In the end, breaking a complex problem like this down take practice so it's just a matter of doing it over and over again.
EDIT TL; DR:
- Define what the goal is and what data you will be working with.
- Examine data and determine whether it can be broken down into smaller groups. If so, group thing that are alike and separate them from things that are different.
- Determine requirements for data. Ask your self what do you need to do with the each group of data to accomplish my goal.
- Reacher methods for the best way to meet your requirements for each data group.
- Determine steps needed to process the data as a whole and then as individual groups.
- Build method for processing each group of data and then test individually.
- If necessary, build method for unifying the separate data processing methods.
- Add each individual data processing method to the unifying method one by one. Test for bugs before adding next method.
- Once all methods are unified, test and debug.
- Check to make sure all goals and requirements are meet. If not make corrections.
- Understand that all systems (e.i your library or program) have there limitations and shortcomings. Decide if the limitations or shortcomings of your work will have a negative impact (user experience, backwards or forwards compatibility). If shortcoming or limitation are likely to cause a lot of problems, go back to step 4.
James Barnett39,199 Points
- figure out the various parts of a large problem.
- the large parts into smaller pieces.
- Keep going until you've got "bite-sized" features that you can code to 20 or 30 lines
- Get the code working
Your goal is then to keep your code working adding together bite-sized features until you get to the large problem.