Things I learned: Week 4-5

Hi guys! I’ve almost forgotten about blogging. I’ll definitely try to blog more, but I tend to get writer’s block a lot.

So I actually don’t have a lot of things that I learned in the last two weeks. My mentor has gone missing. I haven’t been able to get in contact with him since last Monday. :( I don’t know where he’s gone, but it’s a bit distressful.

I think I’ve learned that I do best when I have a safe place to ask questions. Since Dereckson was the one who understood my project the most, it was easiest to ask him for opinions. I have been asking questions on #mediawiki, but it’s not quite the same.

I’ve hit a bit of a snag with my project in the last week. It was really hard trying to do my project on my own. I had a lot of environment problems so I had to reinstall a clean copy of mediawiki (which I’ve already done twice). I’m hoping my environment doesn’t die anymore because it really sets me back a few days. My problems seem to be unique to me, which is the worst possible feeling.

In terms of my project, I can still get my stuff done before I need to go into in-depth discussion with Dereckson (I hope he comes back soon). I’ve gotten my project to successfully clone and switch branches and now I’m working on getting the file open and read. It’s coming along well. I’m trying not to let the fact that I’m behind on my timeline get to me. MUST STAY MOTIVATED!

EDIT: My mentor is alive! Huzzah!

Advertisements

Things I learned: Week 2-3

I’m feeling particularly exhausted this week and I figured I would write a blog post to help me get out of this slump.

Week 2:

Week 2 went by pretty well. I got a good foundation working on my extension and I was gearing up to work on the main parts of my program. There wasn’t anything too eventful, but I definitely felt very proud of my progress.

 

Week 3:

This week I learned about how absolutely frustrating it is to try and fix a work environment. When I first started writing my extension, I used MAMP to run my web server. This was the first time I’ve ever run a web server locally and I was likely to run into problems.

Well, I ran MAMP with no problems for a while, but I wanted a way to debug my code. Dereckson suggested that I use the debug log toolbar. ($wgDebugToolbar = true;) Unfortunately, my logs through wfDebug(); weren’t quite working. I thought it might have been a problem with MAMP and pear. I kept getting a message about how a class in pear wasn’t loading.

So I spent the day (Wednesday) trying to get my debug logs to show up properly. It didn’t work. :( Dereckson was able to see the messages on his console so I was convinced that it was something wrong with my set up. After all, if the same code was displaying properly on someone else’s work environment, then it must be a problem with my work environment. I had my boyfriend, Ofer, try and fix my problems as he’s more experienced with web servers and work environments in general. When we weren’t able to fix the debug log, Ofer suggested a virtual machine (VM).

This was a suggestion made by Mark when I deciding on how to run my web server. I ultimately decided on MAMP, but a VM was always an option. Ofer said that running a VM would be simple and that I could get it running quickly.

Well, he was wrong. He had gotten me set up with Vagrant and Virtual Box the night before and left me to my own devices the next day. Honestly, if you asked me what I did, I couldn’t really tell you. There were so many hack-y things that I did to get things working. I ended up having to download an entire new copy of Mediawiki and a clean clone of my extension. I had to employ the help of my friend, David, to get me through this as well.

So after two days of messing around with my work environment, I came back to the same situation that I started with. Debug toolbar wasn’t working. I decided that enough was enough and went with a logging situation instead.

 I have to say, working with a broken work environment is REALLY draining. I think I’m still feeling the effects of it even though I’m working on actual development now. Googling doesn’t always work because your situation might be/probably is unique and there’s a ton of things you need to be wary of like OS versions or set up configurations.

I did learn some stuff though so it wasn’t a total loss. I’ve never worked with a VM before so this is a pretty cool learning how all that works. I think I’ve come to realize that being a programmer doesn’t mean you just sit around writing code all day every day. There’s a lot of research (basically, googling) and thinking involved. If I was writing code for 8 hours straight, it would probably come out horrendous.

Things I learned: Week 1

I kept trying to write this blog post, but was unsure of what I wanted to say so I kept creating and deleting it. I decided to do a list of things that I learned during the first week or so.

Gerrit/Git:

  • All code goes through gerrit and has to be reviewed before merging into mediawiki.
  • +2 code review and verified means that everything is great and it will be merged.
  • You commit code when you have functional changes.
  • When your code is in review and a reviewer has made comments and you want to go and fix them, you should amend your changes instead of committing new code. (I committed new code.) Keep amending till reviewer(s) are satisfied and it gets merged.
  • Wikimedia is very branch happy. Previously, I never used branches extensively so it was weird for me. I try to make a new branch for every commit I make and name the branch to something meaningful, but sometimes I want to just keep working while my code is being reviewed and everything is dependent on previously committed code. Not sure the workaround yet. (See process below)
  • Each branch should only be one commit past master. Ideally.
  • In Gerrit, there’s one commit message for a change set. So when you make amends, you should add in what you’ve done to the commit message. This can be done with git commit --amend. It will just overwrite the commit message. Also useful if you messed up your entire commit message and have to rewrite it. It can be run without changing any code. Make sure you’re in the change set first. (Use git review -d [change id] first.)
  • There are change sets which are new commits and patch sets which are amends to those commits. Some people use them interchangeably.
  • You can submit your code in draft mode with git review -D. It’ll only be visible to reviewers that you add.

Here are some notes that I made for committing code:

For new commits:

*create your branches and make your changes*
git diff
git status
git add <file>
git diff --cached
git commit
git pull origin master
git rebase master
git review -R

The git diff and git diff --cached are optional, but I like to check what has changed. git diff shows you what code has changed since the last commit and git diff --cached is the code that’s going to be going into the next commit.

For amends:

git review -d [change id]
*make your changes*
git add 
git commit --amend
git review -R

This is the process of working on code:

git checkout master
git checkout -b feature/nextfeature
*work on the code*
*commit the code*
*send it to gerrit*
git checkout master
git checkout -b feature/anotherfeature

Although for now, a lot of my changes are very dependent on each other so I’ve been waiting for my code to be merged before creating a new branch and working on it.

Personal/Life Lessons:

  • The first week or so doesn’t feel like you’re doing much, but you are. I learned all about git and gerrit and how extensions work (which I thought I knew, but really didn’t). I wrote little code, but I was able to correctly submit things.
  • Mistakes are for learning. Don’t be too hard on yourself when you make a mistake. I don’t have the ability to screw up Mediawiki. It was through my mistakes that my mentor was able to clarify things that I didn’t know.
  • Most of the other interns are on the same boat as me. We’re all learning and making mistakes together. I don’t feel so alone or stupid for not writing code.
  • There’s more to this job than just writing code. It’s also about being part of a community. I’ve been asking my mentor for help through #mediawiki instead of PM and other people can chime in. I think he secretly makes me ask in #mediawiki because he’s quite unresponsive in PM. Either way, the consequences are beneficial to me since I can get over my fear of feeling like people think I’m stupid. I hope that I can be active enough to be able to answer newbie questions. :)
  • People are more helpful than you think. I didn’t realize how many people would bother answering my silly little questions. I’m not even sure that I should be asking as many questions as I am since it feels like I’m just flooding the chatroom with my problems. But I’m gonna ask them anyways and until someone complains about it, I’m gonna keep doing it. Honestly, I probably am not even asking that many questions.
  • Have fun. I don’t know where I got the idea that work is full of dread, but it’s been quickly dispelled over the last week. I don’t feel like I’m doing work because I’m having fun. I think that contributes to the fact that I feel like I haven’t done enough.

I have a notebook beside me to take notes and I write down questions that I have. Periodically, I’ll go back to the questions and I’ll see if I’ve found an answer yet. A lot of the time, I do and I manage to find these questions on my own or find them in passing when someone is explaining something. It’s been quite useful.

I hope that when I look back at these post entries (and future ones) and see what I struggled with and how to solve those problems, I’ll smile and think, yeah, I remember when I didn’t know shit.

Oh! As a side note, there was a meeting for OPW today and unfortunately I missed it. 6 AM was way too early for me. I barely woke up at 8:30 to come to the Wikimedia office. But I read the chat logs and I’m sad that I missed it because it seemed like a great time. Hopefully, I’ll be able to meet everyone and there’s another meeting like this. It’s really nice to have an environment where all the interns can get together and just get all their questions (and frustrations) out.

First Day

I started as an intern today. I thought I’d share some of my thoughts on my first day, which technically hasn’t ended yet.

There’s so much to learn. As a person who’s never had a programming job before, I struggled with all there is to know. I suppose with every job, there’s a bit of a learning period: figuring out how to use development tools, where to look for information/answers. There’s numerous resources out there on how to develop for Mediawiki that it gets a bit overwhelming and I get bogged down with trying to read through all the articles. (I have so many tabs that I can’t even see the favicons or texts!) Sometimes, it’s easier to ask for help and be redirected to the correct page. Also, It’s okay to take things a little slowly to get accustomed to the development workflow.

If you have a question, ask it. When I first got on the #mediawiki irc channel, I was deathly afraid of asking questions or even converse with people. I felt like I wasn’t smart enough to hold a conversation or if I asked a question, people would think I was stupid. It’s an awful attitude to have and will only hurt me in the end. So I’ve been trying to ask questions when I get stuck and I’ve come to realize that a lot of people have questions. No matter how basic or advanced the questions are, they’ve been answered with courtesy and even enthusiasm.  It’s silly to be worried about how others are judging you (when they really aren’t) and not ask for help.

Mistakes happen. That’s why git is there. Today, in the midst of confusion, I managed to review my own commit and then de-review it, 3 or 4 times because I was unsure what I was supposed to do. Embarrassingly, you can see each time I’ve done it. At first, I was worried that I was doing everything gravely wrong, like I was kicking babies or something to that extent, but then everyone has hiccups and I haven’t had any real world experience. The person who blames me most is probably myself.

Boy, this post sure makes me sound like an anxious crazy person, but I swear it’s just nerves from the first day! Maybe. Part of the reason I applied to this internship was to bolster my confidence in my coding skills and learn how to navigate a real company. Hopefully, by the end of this internship, I will be less apologetic in my lack of skills and more reassured and confident. Until then, fake it till you make it. :)

In terms of what I did today, I tried to figure out gerrit and am still trying to figure it out. Perhaps it’s time to go to the office again and get some hands on help. I also got around to editing all the style problems that the skeleton program had but it got lost in the gerrit review system.

Edit: Also I updated my facebook and linkedin to show off my internship. Probably the most exciting thing to have happened today. I still feel really proud of getting in and blessed to have this opportunity.