We’ll call this week a half a week because we’re off this week for Thanksgiving, though I’ve still been working and coming in. I’ve been working steadily through Rails, and it’s been interesting… In a lot of ways it’s kind of harder to grasp than some of the other topics I’m not sure exactly why. And then there’s also the feeling of learning yet another totally new topic and feeling like my brain is going to explode from all the different totally new things I’ve learned in such a short amount of time! :-) Rails is tricky though because a lot happens behind the scenes, so it’s hard to know what’s going on. Vs. like when we started straight PHP and were building everything manually we knew exactly what was going on all the time because we wrote every line of code, so we had to know what it was doing… “Harder” because it was more code to write for sure but also way easier because you knew where to look if there was a problem. One of the TAs says that everything in Rails happens automatically or “automagically.” :-) And another of the TAs says that everything in Rails is black magic. Ha. Today I got majorly hung up on a couple of things and since it’s Thanksgiving week and I didn’t have people to ask it was pretty frustrating, but I struggled through. And actually I did end up getting some help so that was good. Black magic for sure though. :-) Anyway, today was a good day for Coding Dojo “rule” #3:
Hmmm – I had some major issues getting this post posted. It kept disappearing! The black magic is spreading… :-)
I think? It’s obviously getting up there when it takes me that long to figure out which day we are on. Speaking of which… I think I’m starting to really feel the pressure of not having that much time left at Coding Dojo and having so so much I still want to do while here… Thankfully we have the whole week off next week for Thanksgiving but I have *so* much I want to get done over that week and I know it’ll fly by.
This week we started Ruby on Rails. I spent the past few days on the Ruby language, which I hadn’t touched since my brief time on Codecademy and going to a Railsbridge workshop this past summer – though I do think it was helpful to have had that prior exposure. My teacher says people either love Ruby or hate Ruby which definitely makes sense. It’s sort of quirky/different but I can see its benefits. So far between PHP, Ruby, and Python I can definitely see the benefits of each and am not sure I have a strong preference yet. A lot of people hate PHP, but in some ways its excess of more rigid syntax is good for me. Then Python is the opposite with barely any syntax and just very dependent on white space which is also very appealing. And then Ruby sort of has a whole different way of framing everything including chaining methods, sometimes writing things in a way that seems backwards, and it’s supposed to mirror regular English language more which is interesting – plus there just seem to be more ways to do everything in Ruby because there are so many built in methods, different ways of phrasing, etc. which is maybe both good and bad!
Anyways, feeling the time crunch, I skipped the final Ruby assignments – with the intention to finish them next week – because I really wanted to get to Rails (the framework) this week. So I started Rails and am slowly working my way through. I don’t like skipping things, though I’ve been doing it more frequently in order to keep up. If I had unlimited time or could magically freeze time or something, I’d spend tons of time carefully working through every assignment and making sure I really understand everything and try multiple ways of doing everything, etc. before moving on. But in reality I’m very aware of making the most out of the time I have here with the support and everything, and possibly at this point it’s better to just keep going. So the take-away quote of the day, again courtesy of one of my classmates:
You can learn anything, but you can’t learn everything…
We just had a tech talk, and the speaker shared with us a question that he always asks at interviews:
Is coding more like a paintbrush or a hammer…?
Also/related I guess: is it an art or science…?
The best time to plant a tree was 20 years ago. The second best time is now.
(Stolen shamelessly from my classmate’s blog.) :-)
Okay, so. Everything else. In addition to working on my project this week, I also worked on CodeIgniter. I worked my way through all of the videos, and I completed one of the two major assignments which involved re-doing login and registration pages in CodeIgniter. It was a little confusing at first, but I started getting the hang of it. It was definitely one of those very step-by-step processes where I really just did one little piece at a time and built from there. I get it now though – all of my confusion during learning OOP and stuff about what should go on which page – it was all just leading up to MVC frameworks where it’s pretty explicit what belongs as a view, a controller, and a model… I actually sort of wish that was more explicitly stated before because I spent a ton of time like on that OOP country assignment puzzling over what should be in the process class, what should be in the country class, etc. I still have one more CodeIgniter assignment to go, and we’re supposed to be starting Ruby on Rails this week. I’m not sure if I’ll just jump to Ruby on Rails and finish everything else later or try to finish up everything before starting on Ruby on Rails.
After working so hard the past week and putting in a ton of time, I actually took it pretty easy this weekend, which has been a good mental break I guess. I even went to see Ender’s Game finally. Yesterday I literally did not code at all. The first day in ages that I didn’t even touch Sublime Text (code editor). :-) So now that I’ve given myself a mental break, I’m ready to get back to it tomorrow!
The one major piece of coding I did this weekend was this morning I took my red belt exam, which did not go particularly well. We have 4 hours to complete as much of the exam assignments as possible, and for the yellow and green belt tests I took most of the time but got them done. This one just had so many elements combined and enough new things that I had never quite encountered before that tripped me up that I only got part of it done. I’m not sure how much needs to be completed in order to pass the test, but no matter what I will go back and finish the rest of it and take my time to make sure I really understand everything. And I can retake the test if need be, which maybe I want to anyway because I know I should be able to complete assignments like that. I just needed a little more practice putting everything together I guess.
Last week the new class started also, and it’s been fun to see them in their first week starting with HTML and CSS and remembering when we were in our first week. Nice again to take a step back and see how far we’ve come and how much we’ve learned in 6 weeks. But it’s scary that we have less than a month to go. I’m not going to want it to end…!
And on a final note, in the past few days a few different people have asked me variations of the question of whether I am having fun at Coding Dojo. It’s a slightly different question than do I like it, or is it a good experience, and maybe I hadn’t been thinking of it specifically in those terms. But the answer is, yes, I am having fun! Coding is incredibly fun for me, and I think it’s an important thing to realize. It’s more than just “this is a good experience” or “I’m really learning a lot.” Yes, both of those are true, but the feeling of actual fun adds a whole different element that makes it all the more exciting to have found something that I really love. :-)
I have lots I want to write about so I think I will break this into 2 posts – 1 about my project and 1 about everything else. So let me start with some of the details of my project. As you can see in the prior post, one of my major accomplishments of this week was building my basic drawing app which will be part of my final project. Working on the project was interesting, and, as with everything else, there were lots of ups and downs, and I think it’d be helpful for me to write out some of my process over the week.
I wasn’t even sure at first how possible it’d be for me to build my own drawing app, but I found an article that walked me through some of the basics, and on Monday when I first got the drawing working I felt awesome. I was able to customize it on my own with colors and font weights using what I know in jQuery, and it was amazing. Then Tuesday and Wednesday I messed around with adding lines, shapes, and text, and I felt way less awesome. Basically, adding those features added complications because my drawing was set to record mouse clicks and drags across the canvas and doing the shapes would need to work totally differently. I spent a lot of time trying to figure it out and getting frustrated. In the end, I did actually get them working to a degree but not at all the way I wanted them to. And I didn’t even spend too much time trying to get text inputs working because that seemed even more crazy and complicated. With enough time I’m sure I could figure all of these things out, but I decided that for now my time is better spent elsewhere – so I got rid of all those features. When I have time later I will try again. However, I did add draggable clip art using jQuery UI totally on my own which I was excited about.
All this time I’d been thinking how great it’d be to make an app that works on touchscreen devices but I assumed that’d be really hard to figure out and that I’d need to “make an app.” But then on Thursday talking with one of my classmates I realized that of course I could just have a website that could be pulled up on a touchscreen device! I’m not sure how I didn’t quite realize that on my own, but again time to be grateful for being at Coding Dojo with classmates working on similar projects, and you never know how some random conversation you overhear might help you in the end. I had bought a domain name and web hosting before Coding Dojo since it was part of our pre-work, but all this time I didn’t actually know how to deploy something to the web. I knew it couldn’t be that hard, but I never just made myself figure it out. So on Thursday finally when I realized I’d need to host my drawing app if I wanted to be able to test it on a touchscreen device, with some help from that same classmate, I put it online! Of course in the end it probably only took 15 minutes and just required downloading FileZilla and setting up an FTP account through my hosting service. Easy enough!
So then the site was up but I still didn’t know how to make it work on a touchscreen. I had found some other code for drawing that worked on both computers and touchscreens, and I assumed I’d be able to find a way to integrate it into my existing code, but I when I sat down on Friday to try to do it I realized it was set up entirely differently, and I figured I should try a different route. I spent lots of time Googling and trying all kinds of crazy things with complex code, none of which worked. Then finally I discovered that jQuery Mobile has “events” that essentially work on both computers and touchscreens. So in the end pretty much all I had to do was add the jQuery Mobile script source, and change “mousedown” to “vmousedown,” “mousemove” to “vmousemove,” “mouseup” to “vmouseup,” and “click” to “vclick.” HA! Seriously – just add in the script source and add some “v”s and it all worked! After all of that. But again, the first time I got it to work on a touchscreen it felt pretty amazing. Oh, I should also mention that I had to do more to get the jQuery UI draggable elements to work on a touchscreen. Luckily someone already built something to make that possible – it’s called Touch Punch. So just one more script source to add and then the draggable elements worked on the touchscreen too! Amazing. I spent Friday night cleaning some things up, and after a week of on and off work, I had the first real working version of my basic drawing app! Yay.
I know that was a lot of details, but it’s helpful for me to record. And I think there are some lessons in all of it:
1. The main one I think that I find myself needing to continually remind myself is that none of it is not time well spent. (How’s that for a double negative?) It’s so easy to feel like I “wasted” so much time trying to figure out the lines and shapes that I ultimately scrapped or like I “wasted” all that time trying weird things to get the touchscreen to work before figuring out the simple jQuery mobile events. But it is not wasted time; it is part of the process. By trying these things out, I’m learning, and sometimes learning what doesn’t work can be valuable in addition to learning what does work. I’m also honing my Googling skills and figuring out how best to find answers online on my own. And maybe something I learn that doesn’t help me in this instance might end up helping me on some unrelated thing down the line. And of course when I go back and work on these features again I’ll have a much better clue where to begin.
2. Related to that, it’s also important to know when to let something go and move on. This also relates to the idea of prioritizing. It’s so easy to get stuck on a question and want to do everything I can to figure it out. I *really* wanted to get the lines and shapes working the way I wanted, and I actually got kind of close. But in the end I had to realize that that was just one more feature that wasn’t strictly necessary and that might introduce confusion if I couldn’t get it working in a way that would be user-friendly, and I had to call it and move on. Later on when I have time I’ll circle back and work on it again but in the meantime there’s really no big loss. The users can just draw a line themselves anyway, right? :-)
3. Don’t be intimated by things I haven’t done before like deploying to the web. Just take the time to figure it out, and it often is nowhere near as hard as I think it might be!
4. Remember that there are always ups and downs. We’ve all had days where it feels like nothing is working and that we’re wasting time on stupid things and that maybe we’re not really learning anything at all. But then we all also have had tons of times where we get something working and it feels amazing. The key is not to be at all discouraged by the down times and to know that it’s part of the process and that we will have an up time again soon. I think I read somewhere someone comparing it to a sine wave – yes there will downs, but you never stay down for too long and if you stick with it you’ll get to an up soon enough!
These are all things that have been percolating in my mind the past few weeks, so it’s good to actually put them into words and write them down. :-)
More details to come this weekend, but I am excited to share now… My drawing app is much improved and works on computers and touchscreen devices! And it’s actually hosted so you can try it out! Actually – at this point I think it won’t work in Internet Explorer. It works best in Chrome and okay but not great in Firefox and Safari. And it works great on an iPad and not quite as well on an iPhone just because of size. So here it is!!!:
(Try clicking and dragging the clip art on the bottom!) This is still only 1 piece of my project idea and there are tons more things I want to change even about this, but I’m definitely excited to at least have gotten this far…! :-)
So this week I have 2 goals: to learn CodeIgniter (which is a PHP framework) and to start on a project. I spent the first halves of the past 2 days watching through all the CodeIgniter videos and the second halves starting on part of my project. And now the project stuff is all I want to do! I won’t go into detail yet, but a major part of my project idea involves creating a drawing/painting app, and I totally wasn’t sure how complex that would be. I knew I could probably reuse at least some of some existing code that’s out there but I was worried I wouldn’t really understand it or be able to modify it well. But I found an awesome article that explains some of the basics of doing something like this and provides code for the complex parts. It turns out there’s an HTML5 element called canvas that’s meant for things like drawing which is awesome, and then most of the actual drawing stuff just involves jQuery which I know! It’s getting a little complicated, but it’s exciting that parts are working really well and I mostly understand it and am able to modify it!
So far the colors and line thickness are working and the eraser – and then I have it so it can draw straight lines too which actually made it really complicated. Now I need to figure out how to add other shapes like circles and rectangles, how to add text for typed input, and ideally how to add something like clip art. And there’s tons to customize like which colors to have as options, what everything should look like, etc. I am channeling my days as a kid drawing random things with Kid Pix! There’s more to the project, but I will save that for later. But at the very least I’ll have created a drawing app! :-) And then I also need to get to the CodeIgniter assignments… Tomorrow… :-)
Yikes – week 5 is already over?! We’re more than halfway I guess! This week was not my most productive week, I’m not sure why. Maybe just starting to slow down a little after doing this all day every day for so long! But I don’t want to stop… :-) The second half of the week was spent trying to wrap my head about object-oriented programming. I actually wrote another post about OOP awhile back based on my experiences learning online on my own, and I was feeling like I understood the basic principles of classes, objects, etc. more or less but didn’t have any sense of how to implement it in a real situation. In this class too we started with basic examples like creating an animal class and then a dragon class that inherits from the animal class but also can fly for example. But then finally I got to an assignment where I had to implement OOP for a basic form submission that retrieved info about a country from a database of countries of the world and displayed it. So in the end I had a database class that established the connection to the database, a process class that dealt with the form submission, and a country class that retrieved country info from the database, and then I created instances of those classes to do everything. It took some time to work my way through figuring it all out, and I tried it a bunch of different ways to see what was possible and what was not, but by working through everything I think I’m definitely starting to understand. It’s just a whole new way of thinking about everything, that at first seems almost unnecessarily complex vs. just doing things the regular way, but in the end it actually simplifies everything a lot. Our teacher told us we’d experience some “growing pains” as we go from the regular way to learning OOP to starting to use MVC frameworks, so I guess I am experiencing that a little. :-) There’s so much to do though – I need to finish the OOP assignments and get on to learning CodeIgniter! And this week we are also supposed to start our projects… Anyway, regardless of pace, it’s good to take a step back and realize how much we’ve learned in 5 weeks!
Here’s a screenshot of my country form (though of course the OOP set-up is all behind the scenes). So it needs to query the database right away to populate the dropdown list with the list of country names and then get and display the specific country info when the form is submitted. And it all uses Ajax too so the page doesn’t ever need to reload! More good practice… :-)