Pages

Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, September 19, 2011

This Moment

"How long would it take to fix this problem," innocent coworker asks.

"A few hours," I reply thinking that it will be pretty simple to fix and will just require a buttload of testing.

"Oh great!" Innocent coworker exclaims. "Let's do it then."

"OK!" I say back with a smile, figuratively already rolling up my sleeves.

I sit down and start looking into the issue. "No problem," I mutter to myself. "I bet if I do this, it will work perfectly."

*Test runs*

Issue still happens.

"Hmm...oh ok, it must be this!" I decide and press a few more keys before running the next test.

Issue still happens.

Rinse and repeat this for about an hour until I decide that this issue is a stupid f-ing issue anyway and people should just learn to deal with it instead of having me waste my time trying to fix it.

Then I take a 15 minute break and read blogs on the Internet because somehow, that always calms me down. Or, I update my blog. Hello world!

Once I'm adequately calmer, I'll go back to fixing the issue on hand. I'll fix it at some point - but it might take longer than that initial few hour estimate. And at the end, I'll feel really good. But up until then, I'll bitch and whine and moan and say that it's impossible and that there's no way to fix it.

Welcome to a day in my life. And this very moment.

Yours,

Friday, September 16, 2011

(Programming) World Conspires Against Me

I've been working on this coding issue since yesterday afternoon. Basically, I have a list of items out of order, we'll say:

B, D, A, C, E

I need to put them in a specific order based on some of their attributes (for simplicity, let's say I need them in alphabetical order). Unfortunately, I need to do this with two passes because there are a couple attributes I need to look at.

First pass executes and I get:

C, D, A, B, E

That's ok. It's not perfect but it's fine. I can adjust pass two to make this end up magically in the right order. Pass two, go!

A, B, D, E, C

What...the...That's not what I wanted at all. Well ok, it starts off ok but what the hell happened? I've been looking into this problem and I've come up with one solution.

The world hates me. That must be it. It's decided that I am not destined to figure out the solution to this and therefore will always give me the wrong result no matter what I do. Even if the process is correct, the world will still hand me out of order items.

Unfortunately, I get paid for this and I have to fight the world. Boss, do you see how hard I work? I'm fighting the whole damn world here. See. I am useful.

Yours,



Friday, September 9, 2011

Replace x 100

When you see the next few lines, you may have the urge to run away. Or at least to close this browser. That is, if you have an aversion to programming, code and other technical things that many people do not really like. Sometimes, I don't like them either. Let me assuage your fears, you don't need to be familiar with any programming concepts to understand what I'm about to say.

There are these things called "Stored Procedures". It's something that sits around and when triggered, does something. That's all. I opened one of them here at work to see what it did. Then I burst out laughing. Because I saw this:

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace((i.description),'&','&amp;'),'&amp;#','&#'),'™','&#8482;'),'>','&gt;'),'<','&lt;'),'"','&quot;'),char(39),'&apos;'),'—','-'),'&#145;','&apos;'),'&#146;','&apos;'),'&#133;','...'),'&#147;','&quot;'),'&#148;','&quot;'),'®','&#174;')

If you know nothing about code, you still should be able to see the hilarious nature of this. Basically, it's taking in a string (you can think of a string as a word) and replacing all characters to be SQL friendly. In other words, if your word was "O...M...G", it would replace all the '...' .

But seriously, how would anyone understand what this is doing? Is the best way to do this really to have a million replace statements in one line? I don't know everything (or much) about SQL but to my non-expert eyes, this does not look good.

If someone wants to tell me that this is standard and done all the time and is perfect then I'll humbly admit defeat. But for now, I'll keep giggling.

Yours,

Wednesday, September 7, 2011

Procrastinating Problems

I spend a lot of my time at work solving problems. I feel like that's mostly what my job is about - a problem comes up in one of our applications, and it's my job to fix it. I have to find the cause of the problem and come up with a solution that will not create new problems.

For the last few weeks, I've been working on one application specifically - one that I basically got to build from scratch. It's pretty fun seeing something you created from nothing but when it gets to the end, I start to procrastinate all the little things that still need to be done.

Examples? Well, I needed to add validation to my form (e.g. so you can't enter IMAWESOME as a phone number). I spent forever coming up with other things to work on so I didn't have to do this.

I needed to make the web app look good in both IE and Firefox. Whoops, there's something else to work on! I don't have time to deal with why that red X is coming up in IE. It's IE's fault anyway. Stop using it, move onto Chrome or Firefox.

Apparently, I can't have that kind of logic. Fine, fine. I can accept that since I am being paid to do this.

I finally got around to finishing all these details. I make a to-do list for every project and break it down into steps so I don't forget about anything and I'm finally down to two tasks:

1) Implement these buttons that are more complicated than I like
2) Find some way to log everything a user does

#2 is pretty important. Even though this is an in house application, it's inevitable that I'll get an email after it goes live saying something along the lines of, "I didn't change this but now store XYZ says it is located in Nowhere, Alaska! It's supposed to be in Los Angeles! What happened?"

If I don't have any logs that show what the user has been doing, my answer would be a blank stare. If I have logs, I can pull them up and point exactly to the time and place where the user decided the store would be better off in Alaska, rather than LA. And I can show them the system did not just crap out on them like they thought, but rather, it was user error.

Damn, do I sound mean? Imagine I'm saying all this with a happy smile on my face. Does that make it better?

I'll work on it.

Time to stop procrastinating. Maybe.

Yours,

Friday, August 26, 2011

Engineering: A Magical Accomplishment

Sometimes, when I'm programming, I feel like I'm capable of doing magic. I feel like this guy.

Harry Potter cartoon style Pictures, Images and Photos

Which is saying something since usually, while programming, I feel more like this.

woman_mess

However, there are those moments when everything just clicks and all of the sudden things work - and I almost feel I just cast some spell that worked. Stupid comparison? Why, yes it is. Do I care? Nope.

My point is the feeling of accomplishment you get - and seeing things work the way you want them to, from something you created. That's engineering.

Yours,

Wednesday, August 10, 2011

Why CS: Math Is Not A Reason To Quit

One of the arguments I hear the most when I talk to people about studying software engineering is, "I'm not good at math" which leads to "I don't want to take math in college."

Although I can understand people's initial hesitation, this argument is not really valid because software engineering does not have to involve math.

I can completely relate to wanting to avoid classes. When I first started college, I was in the pre-engineering major. I had to choose at orientation which path in engineering to follow. Based on the chart that was drawn out in front of us, I noticed that Computer Science was the only engineering path that did not need Chemistry. And so, I entered the Computer Science major.

My first quarter was really tough and I actually ended up getting a D in my math course. I had to retake it the next quarter since the following course in the series required me to get a C or above. I was very discouraged but thought I would give it another try - and I did much better the second time around. I was actually good at math in high school but college was pretty tough. Luckily, my school had a great tutoring program - I'm not sure I would have made it through without them.

I had many doubts all throughout college while I was studying Computer Science. It started with math because I just could not hit my stride there - not to mention the programming courses that actually involved math. However, I kept pushing along because I would always find a class each quarter that I actually loved and wanted to continue in the major.

"But I don't want to suffer through my classes!" I can hear you thinking. "I want to study something I love."

Ah, the time of innocence. I miss that.

It is a good point though - but tell me of a major where someone loves every single class they take. There might be the rare person far and in between who actually does - but then again, that exists in Computer Science also. The way how requirements work for college degree programs, it's pretty rare that you will love every single class you take. I counter your thinking by saying that there will be classes you love to take - and that will make up for it. At least, that's what happened to me.

Here's a little known fact for those outside of Computer Science: You don't have to use math after college.

Obviously, I don't mean all math - we all use math, especially if you go out to eat as much as I do (who loves those tip calculators on iPhone/Androids? I do!). But there's definitely not a daily need to find the derivative of an equation or take the integral of some linear combination. In fact, in the area I'm in, I can tell you that I haven't done that since college.

There are so many areas in Computer Science - and many of them do not involve math. Of course, if you want to go into an area like game design, you better be comfortable programming math (which is why I did not end up there). But if you want to write web applications, mobile apps, even working on UI these days - depending what industry of course, you might not actually use any advanced math. Basically, once you're done with school, you can decide what area to go into - whether it is related to math or not.

The bottom line is this: don't let your dislike for math be an argument for not studying Computer Science. Of course, Computer Science is not for everyone. But if your main hesitation is the fact that you aren't good at math, try to get past that. It's such an amazing field with a huge variety of opportunities that something as small as disliking math should not stand in your way.

Disclaimer: In college, you will have to take math. There usually are A LOT of resources offering help - for example, at UCSB, I was a big advocate of CLAS which really helped get me through some of the tougher math classes. Take advantage of the tutoring services your school offers - there's really no reason not to.

What do you think of math? Love it or hate it?

Yours,

Tuesday, August 9, 2011

Feel Good Moment

My coworker just called me and told me she loved me.

Why? Well, after telling her I loved her too (it felt like a moment you couldn't leave someone hanging), she explained. Apparently, this change I added to the system has made her life so much easier. She went on to tell me how it has made adding 20+ items so much simpler and she LOVES this change.

It made me feel really good to hear that - one of the things I love is being able to help others and this just helps solidify my reserve that I'm doing what I love. At my last job, products were so slow to release, I would never really hear customers' comments. Since I'm working on an internal tool here, I'm starting to hear "customers" (i.e. coworkers who use the system) and I'm loving it.

This is why I love working on the front end & business logic/middle tier.

Yours,

Wednesday, August 3, 2011

Coding nightmares

I worked from 8-5:30 yesterday. Then I went to the gym, went home, cooked dinner and started working again.

I stopped working at midnight and went to bed.

Then I dreamed all night about working. I had nightmares that instead of making development changes to the test database, I accidentally made them to the real database. I kept trying to fix it but it just made it worse. Then I would wake up, think that I really shouldn't have tried to keep working when I was so tired and purposely go back to sleep to fix it.

Rinse and repeat.

Then I woke up at 7am and came to work to do it all over again. How do I keep my head up through this?

I tell myself, "Self, when it works, it will all be worth it."

I just need to repeat that for the next 8 hours to get through today.  Please tell me someone else has had coding nightmares too and I'm not as strange as I feel.

Yours,

System Changes and Gorillas

Here is how I feel my day goes on the system I'm trying to learn and fix at the same time:

Because I've dealt with scrum a lot, let's just say the person giving me the requirements is the Product Owner, or PO.

PO: Here is a new kind of animal we've found. If the naming department decides on a name, let's ask the review committee to check the name.
Me: Ok. *magic happens* System is now set up this way.
PO: Wait, there's a bug here. When the naming department decides on a name, we don't want the review committee to get it before the research department can decide what kind of animal it is.
Me: Hm. *Checks* Oh, well that's because when the naming department gives it a name, it automatically becomes a gorilla. Actually, when someone saves the animal, even if nothing is done on this animal, if the type of animal hasn't been decided on, it will always default to gorilla. ...Is that not supposed to happen?
PO: Oh yeah, I found out about that gorilla default last week. Does it have to have a default?
Me: *Checks* Well, teh system is all tangled together. If I change it to not have a default, chances are something else will break. And given that we're, oh, 2 days behind schedule, I vote for not changing this part.
PO: Agreed.

Success!

And this:

PO: Ok here's the update I need you to make. If the type of animal gets changed, the cage it gets assigned to needs to change as well.
Me: Ok. *Magic* Done!
PO: Well that's fine now. But now because the cage changes, the picture of the animal automatically got set to blank.
Me: ...I didn't even know there was a picture of the animal. Ok, so what do you want it to be?
PO: Let's ask the image department to confirm the picture of the animal is still right.
Me: *Magic* Ok! Check it out.
PO: Well yeah, that's fine. But since the image department needs to confirm it, we should also ask the writers to make sure the description still matches the image once they're done with it. You know, if it's an angry elephant vs a calm elephant, the writers may want to know that.
Me: ...There are writers?

And so on.

Don't get me wrong though - I love my job. But since I've only been here for about a month, there's a lot of the system for me to learn. That's not so fun. I wish I could just magically know everything about the system already so I could fix all the problems. Unfortunately, I just have to grit my teeth and learn it through.

When I do fix things though, those are the fun moments. And those are the moments when I love being a developer.