From Shakespeare to Java

Life Begins Where Your Comfort Zone Ends.

Coding on the Edge - the Failure to Use Best Practices

bad code cartoon

wtf - code quality measurement by smitty42

Some Background

For two semesters, my programming professor (then head of the University of Pennsylvania’s MCIT program) taught me a number of Agile techniques – unit testing, coding standards, refactoring, TDD, and pair programming. Since I hadn’t really done any programming before entering MCIT, I didn’t have any bad habits that needed to be unlearned. I do know that I did not follow TDD as well as I should (write tests before writing the method? Impossible!), but I slowly adapted the right way to do TDD.

During my summer internship, I was surprized to learn that no one seemed to write any tests for their code. To be fair, I didn’t either, because I didn’t know exactly how to test HTML and JavaScript without actually starting up the website and verifying its look and behavior. My boss exclaimed, “People don’t actually do test driven development in industry.”

I’m currently taking a software engineering course, which focuses on how to measure if a piece of code is “good.” It’s an entire class about software development best practices. Many articles I’ve had to read for the course all have an interesting theme through them. “But [author’s name here], what if my company doesn’t practice Agile development?” The answer: Do it anyway.

Some Statistics

I wanted to know if my former boss was right. Does industry NOT follow TDD? So, I found a 2013 survey called State of Agile from VersionOne. Now given, VersionOne makes a product to help companies adapt Agile techniques, so I’d say the results are skewed when the report says 88% of respondants say their company practices Agile development. But what’s more interesting is what techniques those companies that do Agile development actually use:

  • 85% have a Daily Standup meeting.
  • 72% utilize unit testing.
  • 47% refactor their code.
  • 38% practice Test Driven Development.
  • 30% do pair programming.

So it seems my former boss was right! TDD is not popular, despite it’s obvious benefits (“Using TDD, you are never far from working code…”).

Some Inferences

The statistics are what each company openly practices in terms of Agile techniques. That doesn’t mean that their developers aren’t doing things like refactoring and TDD on their own! After all, these developers are supposed to be professionals. They probably do incorporate best practices to do their work (at least, we can hope so!).

We can also infer that some Agile practices are more beneficial than others. While I have done pair programming in the past, it’s not a big deal if a company doesn’t embrace that technique. It’s great to get a new employee up to speed on a piece of code and add new functionality to it, but it’s not a necessity.

Needless to say, I am a firm believer of good practices. Anyone who has me on their team will know that the code I produce has been tested, refactored, and written with a great deal of attention, care, and dedication.

The Takeaway

All developers should be aware of key Agile techniques and incorporate them into how they code. Not testing or refactoring your code is a very, VERY bad idea. Those 60+ hour weeks might very well be the result of poor coding practices, which, as Business Insider explains, may be driving you and your co-workers crazy.

The Language Wars

programming language cartoon

Essays - a cartoon by Marco Antonio Islas Cruz

There are thousands of programming languages. Each language has its strengths and weaknesses, its own special qualities, and some have very specific purposes.

After reading this article about a Texas university’s graduates getting a $10,000 bump in salary for taking an elective course on COBOL, I started thinking about what programming languages really matter in industry and beyond.

According to IEEE, Java, C, and C++ are the top 3 programming languages because they are widely used in web, mobile, desktop and embedded development. Python, which has a steadily growing fanbase, is only in 5th place, probably due to the fact that it’s not used for mobile or embedded development. This is interesting, considering Python is currently the most popular language being taught in introductory computer science courses. Does this mean more companies will adapt Python as their primary development language as the graduates look for jobs related to their “language of choice”?

I put “language of choice” in quotes for a reason (I’m not in this group of people). My hunch is that the level of proficiency of a programming language determines the developer’s preference for that language. If they don’t know it well, it’s not going to be their favorite, even if it might be better for the project at hand. (As it turns out, this hunch is seemingly incorrect. Thank you, Reddit responders.)

That leads me to believe that out of the thousands of programming languages currently out there, the ones most utilized in industry may not be the optimal ones. They’re just the standard. Java might be the dominant language, but some other language out there might be more efficient and easier to use to do the same tasks! Those other languages are just not well-known by a significant number of people. And of course, companies are notoriously resistant to change.

In the meanwhile, developers will continue to argue about the superior programming language(Python! No, Java! No, Go! No, C#!). They will have conferences championing the accomplishments of their language and what’s been created with them. But remember, there are a lot of programming languages out there just waiting to be discovered, learned, and used to build really amazing things! They may just become one of the standard programming languages of the future…

Learn to Code: Let Me Count the Ways

evolution

The Evolution of Computer Programming Languages by dullhunk

Learning to code has become a heated topic these days. I read this critical article about the UK’s decision to teach children to code as part of the curriculum. Then there was this article about how tech skills are overvalued in today’s marketplace. And not to be outdone, there was this about how even if a person does get a degree in computer science, they might not have the skills companies want.

So, is learning to code important? If so, should it be a manditory class in elementary/secondary education? If someone wants to learn to code, should they teach themselves for free using the many sites online? What about attending a coding bootcamp? Does majoring in computer science at a college/university really give someone an edge when looking for a software engineering position?

Is Coding Important?

Let’s first define “important.” My definition of important is: useful, bordering on necessary to function in some capacity. In the developed world, I’m pretty sure most people would say coding is important. Think of all the things that depend on code for their functionality. Without code, there would be no cell phones and all those apps we love so much. There would be no jobs that use a computer. In our cars, the fancy touchscreens that tell us the traffic on our way to and from work—gone. The microwave, oven, dishwasher, and wifi connected television would be pretty much useless. The list goes on and on. People who knew how to code made these things possible. It’s important that many people know how to code since so much of the convenience of our daily lives depends on it.

Teaching Children To Code

The controversy about teaching programming in schools is really a controversy about a broader issue. Is what we teach children in school relevant in today’s modern world? Since coding is important in our technology-driven society, it seems relevent to teach it to children. But how many children, and when? Not every child is going to become a software engineer, so some would argue a computer science course should not be a mandatory part of the curriculum. Yet certain other courses are mandatory, like physical education and foreign languages, but children aren’t expected to become professional athletes or translators. Those types of courses teach children about healthy lifestyles and other cultures accordingly. Students must take them so they are “well-rounded.”

I’d argue computer science fits into that “well-rounded” objective. I was never exposed to computer science in school, so it was never on my radar to learn it. However, I was exposed to art, music, keyboard typing, woodworking, sewing, home economics, Spanish, German, and French in my middle school years (6 - 8). Why not add computer science to the list of “exposure courses.” Students should be exposed to writing code so they know what it’s like and what it can do. If students enjoy learning to program, they can take it as an elective in high school or even pursue it in college. Most schools around the world teach history, so students understand how the world they live in came to be. Computer science will also teach them how the world they live in came to be.

Learning to Code Through Online Tutorials

The number of websites that teach visitors to code is staggering. There’s Codecademy, Code School, and Code.org to name a few. There are also free online courses through sites like Udacity and MIT’s EdX that people can take to learn to code.

Before I started the MCIT program, I thought I’d give myself a heads-up before classes began and take the Python course on Codecademy. I went through each cutesy little exercise, but truth be told, I didn’t know what I was doing. Nothing really sunk in. I followed the directions, made guesses on the open-ended exercises, but I didn’t see the big picture about what I could really do with if statements and while loops. Making a tip calculator was nice, but too simplistic a view of what coding can really do. That’s my opinion. Maybe there are others for whom Codecademy opened doors to all the possibilities! It wasn’t for me (when I was a beginner). Note: If you already know how to code and want to learn a new programming language or framework, these websites are invaluable!

I believe in a more structured approach to teaching computer science. For the budget-conscious or for those who want to learn to code to move up in their career, taking courses through Udacity or EdX might be the way to go. It requires the user to be motivated, to put in the time to learn (much more time than it will take going through a Codecademy course), and to be ready for some difficult challenges. These courses are more thorough and will make students better prepared should they want to dive deeper into computer science.

Learning to Code By Going to a Bootcamp

Coding bootcamps have started cropping up everywhere in the past few years. Click here to see an exhaustive list of them! Many of these bootcamps are specialized schools, focusing on one programming language or skill. They’re quicker than a college education and cheaper than one, too, but students only learn “skills employers want.” Some of these schools are partnered with companies that will hire graduates of the program - that’s great! But are the students coming out of these schools really prepared to work in the tech industry? Do they know about best practices like what data structure to use in certain situations? Do they practice any test driven development? Will they be relevant in later years when iOS has been replaced by a better mobile OS? What if Ruby becomes obsolete? Will the students of these bootcamps be able to adapt?

These bootcamps seem better for meeting short-term goals and for people who need structure to motivate them. So they may be a step up from online courses at Udacity and EdX, but their long-term success remains to be seen.

Learning To Code By Studying Computer Science

It’s interesting how college computer science courses have come under fire for not providing graduates the skills employers want. Employers want people with a broad assortment of technical know-how. It’s not just programming languages, but frameworks, databases, specific operating systems, version control systems, testing applications…the list goes on and on! Do colleges teach these skills or are they really more “theory driven?”

I can only speak about my experience studying computer science at the graduate level. The courses I’ve taken taught me four programming languages, a tad about version control using Git, and test driven development using JUnit for Java. I’ve also had courses that taught a lot of theory. I balked at having to take a Discrete Mathematics course. I’ll never be writing induction proofs ever again! Yet, the topic of relations came up in my databases course this week and I knew what that really meant because I learned all about it in Discrete Mathematics. Does it really matter that I understand how a relational database works? Maybe not, but it might come in handy somewhere down the line. I didn’t think knowing relations was important, but databases today wouldn’t be the same without it!

Theory is dismissed as fluff by critics, but they do not seem to understand that theory is what makes reality. People who learn theory can then apply it to real-world situations. Computational theory influenced Alan Turing who, in turn, theorized the Turing machine (which you can now make out of Legos…), and was the basis of all computing today. Brilliant people know both theory and current, practical skills. They can adapt because they see The Big Picture.

Employers may want people with skills, but they also want people with experience. Knowing this fact will help you choose a good college with a good program. Colleges cannot teach students everything for the workplace, because employers vary widely in what they do! That’s why it’s important to choose a university that balances theory with practical applications and provides internship opportunities to gain experience in the field.

For these reasons, employers may value someone with a college degree in computer science more highly than someone with the same skillset without a degree. Someone who really understands the ins-and-outs of computer science might be able to adapt to changes in technology more easily than someone who has been self-taught. But employers keep their options open. There are many programmers out there without a college education who are doing great work. It’s clearly not the end of the world to know how to code and not have a college degree in computer science. However, it may be more difficult to find a programming position considering many large companies require their developers to have a computer science degree.

Final Thoughts

Learning to code is important, if only to understand how modern technology works. If you’re interested in coding, there are tons of online resources, workshops, bootcamps, and colleges ready to help you on your way. Choose what’s best for your style of learning and level of motivation. There is no one right way to learn how to code. There’s only your way.

Collaboration Optional

Group

“I-quit illustration” by Fritz at hikingartist.com

The Fall semester started this week and a common thread appeared. In my first class, Databases and Information Systems, the professor went over a slide showing the breakdown of how each student would be graded. “30% of your grade will be dependent upon a group project,” he said. “If you do not like working in a group, this class probably isn’t for you.” This made me wonder if there was another databases course that didn’t require a group project. The answer, of course, is NO. The professors of my other two classes declared the same thing - almost a third of my grade will be tied to the success (or failure) of a group project.

The Push For Working in Groups

Currently, there is a giant push to teach people how to collaborate with others. In some cases, people are forced to work together because there are many benefits. By working in a group, a teammate can learn a great deal from their peers. They can accomplish bigger tasks in a group. And they will be more tolerant of diversity because they will all be working towards a common goal! Some companies have traded cubicles and offices for the open floor plan. No longer can someone hide behind cheap temporary walls - they must see and talk to the people around them!

The education industry also recognized the importance and benefits of learning to work with others. From an early age, students are placed into groups to complete some task together. Sometimes, it works very well. If a child does not understand a concept, their peer of the same age will use a different vocabulary set than the adult teacher to explain it to them. However, some children will not fair well in groups as social pressures make interacting with others awkward. Nonetheless, educators see this as good practice for the real world when students may need to work with others they do not know or like.

As a former high school English teacher, I pushed students into collaborating with each other for all sorts of writing projects, book reports, and end-of-unit assessments. Some groups did exceptionally well! Others were total disasters. I had done everything by the book (actually, by the books…there are tons of books out there on how to successfully design group projects and get students motivated and ready to work together), but no matter what I did, there would always be at least one group in peril.

The Collaboration Fallacy

Groups inevitably fall into a few categories:

  • The Rockstars - Everyone in the group is equally motivated to complete the assignment and do it well. They innately know how to communicate with each other (usually because they are all friends already). Everyone knows how to do their part, and what they produce is top-notch!
  • The Average Joes - Most people in the group are motivated to complete the assignment and want to do well. Their expectations are lower than the Rockstars. Some members may not fully know what to do or how to do it, so they contribute whatever they can that fits the bill. It’s usually pretty good, but not great.
  • The Unbalanced Act - This group has a mix of people at horribly different skill sets and/or levels of motivation. There will inevitably be one person who wants to get the task done and ends up shouldering much of the work. This person may or may not be qualified to do that work. Others in the group may either not know what to do or how to complete their piece of the project. Their work may be abhorrent, forcing others in the group to re-do it. There may yet be other members who contribute nothing, either due to lack of motivation or simply being unqualified. Their more knowledgeable teammates don’t have the time or patience to teach them, so they just do that person’s work for them because it’s just easier.

Needless to say, I’ve fallen into the Unbalanced Act group too many times. I’ve been the zealous leader who does everything, the worker who slapped things together (which wasn’t good enough by another teammate’s standards), and I’ve been the one who contributed nothing because a zealous teammate didn’t want to teach me. They wanted it done “right” or “right away” and just completed my part, in some cases, doing it without telling me while I struggled to try to do it myself.

All of the benefits of collaboration have rarely occurred for me in school/college projects. I didn’t learn from my peers. Either I knew the most out of anyone in the group or my peers knew more, but didn’t have time to teach me what I needed to learn. “We” accomplished big tasks, but it was usually the work of one person, maybe two, in a group of four. I suppose it could be said that one person can accomplish a big task after all! And being more tolerant of others? Ha! If anything, working in a group teaches intolerance and resentment, unless the group falls into the Rockstar category with almost no diversity at all.

Group Project Dynamics Are Different in Industry

Group projects should be optional in educational settings. I consider grades to be the equivalent of a worker’s salary. Unlike the workplace, where one’s salary is generally not tied to the success of a project, a student’s grade (a representation of how much and how well that individual learned something) is tied to the success of the project.

Educators rarely want to deal with the problems that arise in groups. Part of learning to work with others is how to deal with these problems. Most educators see group strife as a “clash of personalities” rather than a clash of skill-sets and make groups work it out on their own. Sure, there are slackers. But many times, the people who can’t do their part simply don’t know how to do it and deadlines never allow that person to catch up and learn. Yet, once the educator knows the name of the “poor group member,” their grade will inevitably be negatively affected, even if their poor performance was due to lack of knowledge, the very thing the educator could have alleviated!

In the workplace, that same person would not see their pay reduced because they weren’t able to contribute to a project. Rarely would it lead to being fired. Most employers prefer remediataion - “Oh, you don’t know how to do that? Let me help you…” It is in the best interest of an employer to help their employees because they have already invested in them for the long-term. Educators, however, see students for a year or a semester, making it more difficult to provide the same support as an employer would to their employee.

Individual Projects Should Be An Option

If someone wants to work in a group, by all means, go ahead! But for those who wish to be graded on their own merit, who don’t want to fall into The Unbalanced Act groups, why not have a separate but equally challenging individual project? It doesn’t make them any less able to collaborate with others later when they’re in the workplace. Group projects are simply not a fair assessment of an individual’s abilities. They do not have all the benefits of those collaborative projects completed out in industry. Providing an alternative project that can be done independently allows students who know they learn best on their own to actually learn something, instead of possibly becoming a problem group member.

Starting Out at a Start Up

Right now, start-ups in the United States are booming. Tech start-ups are doing immensely well. Their products and services are unprecedented and larger companies, like Google and Amazon, are buying up start-ups in droves to gain access to both their talent and intellectual property.

When I was searching for an internship, I had a good selection of places to work. Some were start-ups, some were small, established businesses, and others were massive global corporations. At the first MCIT social event, second year students talked about their summer internships. One student’s experience really piqued my interest. He did his internship with a start-up and told us about how he was able to learn whatever he thought might help him do his job. If he needed a week to learn a new technology, it was granted. He talked about how he was able to be a jack-of-all-trades because working at a start-up meant all-hands-on-deck. (Ahhh, buzzwords!)

I’d already worked at a large corporation and I knew that even in the tech department, you might end up in a lonely cubicle with deadlines, Deadlines, DEADLINES!!!! Not only that, many corporations expect you to already know how to do your responsibilities and can be inflexible when it comes to learning on the job, considering those deadlines that must be met. NOW! On the flip side, some corporations give interns menial assignments that will never be put into production.

So, I was excited when one local start-up offered me an internship. My experience was very much like the second-year student who inspired me to embrace start-up life in the first place. I worked in the start-up’s brand new office, located in a new and thriving innovation center that also housed other start-ups and incubators. The office was modern and well-furnished. Offices lined one whole wall along with a conference room. There was a kitchen with more counterspace and cabinets than some apartments. Like many tech companies today, the open floorplan is revered. That’s where I worked: 6 wooden desks pushed together into one big table, one of many desk-groups in the open floorplan.

I’ll say this about open floorplans: They’re meant to foster collaboration, and they do. But they also make it difficult to concentrate as people go in and out of the office, move around the space, or as some people collaborate while others are working independently. There were two points during my internship where I needed to get some critical functionality working and I asked to work from home so I could concentrate without constant distractions. Sure enough, working from home made me enormously productive. It made me wonder if the open floorplan’s collaborative benefit is worth the loss in productivity associated with the lack of a quiet, private space.

I’ve written before about what I learned on my internship and how I did it. There’s no way I would have mastered all of these new technologies in any environment other than at a start-up. Each time I was given a new project, I had no idea how to go about doing any of it! It was daunting, but I was given time to learn. And it made my successes that much sweeter. I went from, “Seriously? I don’t know how to do that!” to “Woohoo, it works! Check it out!” My boss let me struggle, but he always had confidence that I’d come through. And I did!

The company I interned for was a little more organized than start-ups that are just starting. I was always a developer, but I was sort of a jack-of-all-trades developer. My main focus was front-end development, but that encompasses many realms. Not only did I make a website with dynamic content, I did WordPress development in PHP and created a Play Framework template and controller in Scala. I learned how APIs work, all about HTTP requests, about how to use JSON to do some pretty amazing things. If you had told me back in May that I’d be doing these projects, I’d have told you that you were crazy. But here I am, at the end of my internship and I’m so much more capable of web development that I ever thought possible!

Working at a start-up helped me grow as a software developer. I didn’t just learn some great technologies. I learned how to learn. I gained a ton of confidence in my ability to deliver quality results, meeting and, in some cases, exceeding expectations. I will always be grateful to the start-up that believed in me. Thank you!

3 Reasons STEM Has an Image Problem (With Women)

Copyright 2013 CBS Broadcasting, Inc. All Rights Reserved.

1. To Qualify, You Must Be A Geek

Geek. Nerd. Same thing. The terms conjure up images of socially inept geniuses, usually with little to no fashion sense and thick glasses. They don’t take showers and they really love Doritos and Mountain Dew.

At some point in time, someone tried to make being a geek/nerd cool. The characters on the Big Bang Theory epitomized “geek chic”. Leonard, Sheldon, Raj, and Howard were to be revered as successful intellectuals “with quirks”.

Their female counterparts have highs and lows. Bernadette is a microbiologist, who makes more money than Howard. Even if she does make more money, her accomplishments are nothing compared to Howard’s. After all, HE went into SPACE! Bernadette is awkward with her little squeaky voice…and she marries Howard of all people! Amy is a neurobiologist and she’s involved in quirky projects, like the effects of nicotine on monkeys (why?). She’s downright unlikable, obsessed with her reproductive system’s failings…and she’s dating Sheldon of all people! The only successful female scientist on the show is Leonard’s mother, a psychologist (you know, the soft sciences) and she’s portrayed as a heartless, cold bitch.

Who isn’t a geek? Penny. Penny is good-looking. She has social graces. But she’s stupid. She’s incapable of learning Physics or passing a history class on her own merit. The Big Bang Theory practically oozes the message that pretty girls don’t belong in the sphere of science. They can appreciate their boyfriend’s accomplishments in STEM, but STEM is not for them. No, Penny can be an actress (although unsuccessful) and even an entrepreneur (although she needs a man’s help to do that), but she’ll never be a scientist.

That’s the message being sent to girls by the media. It’s not just the Big Bang Theory. It’s every science-y show, from Dr. Who (The Doctor understands what’s happening, but his female companion will inevitably be the victim) to Bones (sure, Bones is good at forensics, but again, totally socially inept).

The notion that you must be a geek/nerd to enter STEM needs to be crushed. It makes for good television, but it’s terrible for recruiting strong, smart, normal women into these fields.

2. Pink is a Girl’s Favorite Color

If it’s pink, girls will like it, some say. A few months ago, Goldie Blox burst on the scene to encourage girls that they could do anything! But they’re mostly pink. The rest are “pastels.” What’s wrong with regular building blocks colors–red, blue, yellow, white, and black? Do they discourage girls?

Yes, there are some women who really like the color pink. They embrace feminine things, including feminine colors. But the reality is that using pink actually singles women out, seperates them from the main stream, and gives the feeling that those products are inferior (dare I say “dumbed down”?). I think it’s totally ridiculous that manufacturers think pink is more approachable for girls. A silver computer or a black computer case isn’t masculine. Its color does not deter women from using it.

Pinkifying technology to attract girls to STEM is actually a huge turn-off. Let’s stop doing it.

3. Girls Like Doing Girly Things

I volunteered at The University of Pennsylvania as a helper for an event to encourage middle and high school girls to pursue careers in STEM. It was sponsored by the Society of Women Engineers. As I helped the girls make a windmill to be placed into a wind tunnel (the windmill with the most balance and that withstood the most airflow won), I asked the girls what other things they’d done at the event.

“We made lip gloss.” That’s what the girls told me. “Was it fun?” I asked. “It’s okay,” they replied. Making lip gloss was the activity to interest girls in chemistry. I was pretty certain boys didn’t pursue chemistry because they once had a teacher who taught them to make homemade lip gloss.

In fact, this is a standard lab to inspire girls into the field of chemistry. And that’s the problem. The whole mindset that in order to get women into STEM, we need to make STEM “girly” is just plain wrong. Once again, those that are trying to get women into the sciences are isolating women from the real thing. Instead of getting men and women to work on the same challenging work, women are separated and patronized, even from those of the same gender! Girls don’t need pink things and they don’t need girly experiments. Girls need to be treated as equals, side by side with men, in the classroom and out in the field.

In Conclusion

Yes, young women need more positive experiences in STEM. But the images of women in the field are deterrents. Embracing geekiness is great, but it undermines those who are mainstream - male or female. And catering directly to women by embracing the feminine is actually rather patronizing at best. If we are serious about recruiting women into STEM, we need to show them all that STEM has to offer, all that is exciting and intriguing. A few pink gizmos and lip gloss labs isn’t going to cut it.

Women in Tech: A Perspective

If you don’t read the news, then you probably don’t know there’s a crisis in computer science. The lack of women pursuing computer science in the United States is abyssmal (though the same statistics also seem to apply to the UK), or so many reports say. And then there are a number of reports claiming the gap is narrowing and things are getting better as discussed here, here, and here. Unfortunately, those that do pursue computer science may leave the industry due to hostile working conditions and other issues.

The following are my experiences pursuing a computer science degree.

Growing Up

My father was a chemist, my mother an elementary teacher with a Masters degree in mathematics. My dad loved computers ever since he bought our first one, an Apple II in 1985. As a hobby, he started building PCs from scratch and he let me help (mainly holding screws or moving wires back so he could install a piece of hardware). Dad printed out star charts and we’d go outside and look for constellations and planets. Mom sat at the kitchen table with me and helped me with my math homework when I had questions. My parents were very involved in my education. It wasn’t that failure wasn’t tolerated - they believed you just should do whatever it took to avoid failure. I was to get help from the teacher or from my parents until I understood the material and could master it.

Needless to say, my parents never discouraged me from pursuing the sciences. Nor did my school. In 3rd grade, I created some neat drawings using a new program for Apple as part of a special project. The school sent me and a few selected classmates to a conference hosted by Apple, promoting children’s software among other things, and we showed off our projects.

The problem was I excelled in English, History, and the arts. I was an exceptional writer. I used to read novels (180+ handwritten pages!) I wrote myself to my friends on the school bus. I visited the libraray frequently. I won three awards in Photography by my senior year in high school. I wasn’t exceptional in Biology, Chemistry, or Physics. I was in a slower track for math, because I felt like I needed quality more than quantity. I was just better at the liberal arts. So, I majored in Photography and later, got my Masters degree in Secondary English Education because I had a track record of being great in those areas. It had nothing to do with anyone saying I wasn’t good enough to pursue a science degree.

Why I Chose Computer Science

There were always signs that I loved computing. I was always grateful when Dad upgraded our computers at home, whether it was more RAM or a larger hard drive or a new OS (though Windows 98 was AWFUL!). I was much more comfortable using a computer than my classmates in high school and even in college. Learning new software was a breeze - who buys a manual? Just play around with it to learn! By college, my best friends were computer science majors. My future husband was a computer science major. And in college, I got my first taste of coding without even realizing it. I was a gamer. I loved this game called Neverwinter Nights(NWN) and it came with the Aurora toolset to build your own game similar to NWN. To make things happen, I had to write code with a syntax very similar to C.

When I decided to change career paths, computer science was on the top of my list. Learning different languages, solving problems, being creative: that’s what I wanted in a career. I was afraid of the math, but the truth is: Computer science doesn’t actually require complex math. It CAN, but there are plenty of areas of computer science that do not require that skill.

In The Classroom

The University of Pennsylvania has done a great job accepting a fair amount of women into the MCIT program. I’ve never felt like the only woman in the computer lab. I’ve never even felt as though computer science was a boy’s club. My classes are at least 30% female. I sadly have never had a female professor in computer science, but I have had numerous female TAs, all of which were highly qualified and extremely helpful.

Disclaimer: At the time of writing this, I have not yet taken a CIS course and therefore, cannot tell you the male/female ratio in that area of study. It may be different.

In the Workplace

I interned at a very small start-up - maybe 20 people total. There were only two women - me and another software developer. She worked from home. My office was usually populated by 7 men and me. It never bothered me. I held my own, did my work well, had nice lunch outings with my co-workers, and enjoyed my internship.

What did bother me was my co-workers changing their vocabulary in an effort to “accomodate me”. I never asked them to do this, but I think they were doing it to be polite. Instead of saying, “Ok guys, meeting time!”, they’d say, “Ok guys…and lady, meeting time!” Why couldn’t I just be one of the guys? Did this mean I couldn’t be a brogrammer either? Of course, they were trying to be polite and inclusive. Little did they know treating me like one of the guys would have been the most polite and inclusive thing they could do.

What are your experiences? Use the comment area below!

Learning on the Job

Eniac

“Eniac” by Unknown - U.S. Army Photo. Licensed under Public domain via Wikimedia Commons

My summer internship as a junior developer is coming to a close. One of the most important skills I learned as an intern was simply how to learn new technologies on the job.

Truthfully, I threw myself into the deep end of the pool. I was hired as an intern by a local startup. My strong suit was coding in Java, but my love of GUIs made me curious about doing something UI related. So, I spent my winter and spring breaks teaching myself HTML, CSS, Javascript, and Android development. I was by no means an expert in these things, but I thought this was the direction I wanted to go in my career. So, when my boss-to-be asked me what I wanted to work on during my internship, I said, “front-end or mobile development.”

I didn’t know what I was getting myself into. My first assignment was to combine the company’s three API tutorials into one single, responsive website. I needed some tabs to go between each of the tutorials which were generated by Swagger UI, provide code samples for each of the tutorials, and finally use Bootstrap modals to let users select sample code or see specific screenshots within specific Swagger/API calls. Well, I’d never used jQuery before, never used Bootstrap, barely understood what an API was, and certainly thought that what Swagger UI did was AMAZING! How in the world was I going to complete this assignment?

The wave of learning to code has created dozens of websites with almost gamified tutorials. There’s Codecademy, Code School, and Dash. Code School was my personal favorite. The mixture of videos and exercises helped me learn jQuery and later, ember.js. Once I understood that, I was able to simply look at Bootstrap’s website and use their sample code to build what I needed. The internet is a fabulous place. Anything you want to learn is there - if you know how to search for it.

I completed that project with excellent results. It was quite an accomplishment to see the final project, meeting all of the CTO’s specifications. And I’d done it all by learning on the job.

But wait! There was one thing I really struggled with learning on the job. The Play Framework. There are almost no online tutorials, except Play’s own Hello World tutorial, which is too simplistic for what you’ll probably need to implement in Play. The books out there on Play are for advanced developers and do not provide a clear explanation of what you’re doing (or why) as you follow their sample projects. It took me THREE books to have a vague understanding of Play and then I just had to try things out on my own. I must have spent two weeks learning Play and all I really felt confident with was creating a new Play project and exporting it to Eclipse. Sad! Finally, I just got my hands dirty and tried to do what my employer wanted me to implement. I guessed a lot and searched StackOverflow when I could finally verbalize what I wanted to accomplish.

Sometimes, there are no resources out there to teach you how to do what you need to learn. Jumping in and trying things out that might be completely wrong is scary, but it’s never a waste of time. I think that’s the most important lesson I learned during my internship. Do what research you can on the technologies you need and then jump in and try things out. You’d be surprised at how much you can accomplish on a hunch.

I don’t regret throwing myself into the deep end. My internship taught me about 10 new technologies and I feel pretty comfortable using them all now that I’ve had some hands-on experience. I’m not afraid to try new things, to experiment, to play around. No one in the tech industry should be afraid of learning new tools. I’m extremely grateful I was pushed to embrace new technologies, even if it meant climbing a long road to learn them. To my employer, thanks!

Creating a WordPress Plugin Settings Page

In my last post, I showed you how to make a WordPress short code plugin. In this post, I’ll build upon that short code and teach you how to make a simple settings page.

A Little Backstory

I found the resources currently available on the web on plugin settings pages extremely frustrating and convoluted for someone’s first foray into WordPress development. I was continually pointed to Otto’s tutorial. Otto’s tutorial works. It just isn’t clear to beginners why it works or how to modify it for your own purposes. I believe it’s always nice just to see a simple tutorial on how to create a plugin settings page before you start introducing how to do all the bells and whistles that can be implemented. This is the only site I found that really helped me understand how to create a settings page, and it’s to create custom settings for themes. Still, I was able to use it to make a nice, working plugin settings page and for that, I am extremely grateful! My tutorial is to teach you what I’ve learned in hopes that you will struggle less than I did.

Getting Started: Creating The Settings Menu and Page

There two things we need to do. 1. Add a submenu to the admin page. Our settings page will be found under Settings -> Signature Plugin Settings after all is said and done. 2. Create the settings page itself. Since we’re building upon the Signature plugin from my last post, you can add all of the following code right into that same PHP file, directly under the add_shortcode call.

So, let’s add a submenu and begin creating our settings page:

add_action('admin_menu', 'sig_admin_add_page');

function sig_admin_add_page() {
    add_options_page('Signature Plugin Settings', 'Signature Plugin Settings', 'manage_options', 'sig-plugin', 'sig_contents');
}

What does all this code mean/do? Well, the first line tells WordPress to add a submenu to the admin page and to create it using the sig_admin_add_page function. This function calls the add_options_page method which sets the text to be displayed in the menu, the page title for your settings page, the level of capability needed by the user in order to even see this menu option, the slug (end of URL) for the settings page, and finally, the function to call to generate the content of your settings page.

Creating Your Setting Page’s Content

Remember how the signature’s default first name was “Firstname” and the last name was “Lastname”? What if we could let the user set the defaults using a plugin settings page? In order to set the first and last name defaults, we need a form where the user can type in what they want and then save what the user types in. Saving the user input requires us to use the WordPress database. So, we’ll do a POST to our form when the user clicks the Save Changes button. If a POST occurs (which it should), it will call another function, sig_options_update() to save the values to the WordPress database. Let’s see what this all looks like:

function sig_contents() {

    if ( $_POST['update_sigoptions'] == 'true' ) {
        sig_options_update();
    }
    ?>

    <div class="wrap">
    <h2> Signature Plugin Settings </h2>
    <form action="" method="POST">
        <input type="hidden" name="update_sigoptions" value="true" />
    <h4> Change the default first and last name used: </h4>
    <table>
    <tr>
    <td><label for='firstname'> First name: </label></td>
    <td><input id='firstname' name='first' size='40' type='text' value='<?php echo get_option("first_name"); ?>' /></td>
    </tr>
    </tr>
    <td><label for='lastname'> Last name: </label></td>
    <td><input id='lastname' name='last' size='40' type='text' value='<?php echo get_option("last_name"); ?>' /></td>
    </tr>
    </table>
    <br>
    <p><?php if (!empty($_POST['first])) { echo '<h4 style="text-align:center;"> The first and last name that will be used as the default signature is: ' . $_POST["first"] . " " . $_POST["last"] . '</h4>'; } ?></p>
        <?php submit_button() ?>
    </form>
</div>
<?php
}

function sig_options_update() {
    update_option('first_name', $_POST['first']);
    update_option('last_name', $_POST['last']);
}

Phew, that was a lot of code, but it’s all easy stuff. We’re simply providing input boxes for the first and last names, then saving those values in the database once a POST has been called via the submit button.

Now that we can set default values for the first and last names and save them in the WordPress database, we need to use those values! And so we must modify our code for our plugin that we wrote earlier.

Modifying The Signature Plugin

If you’re not using attributes

To use our saved database values, all we need to do is modify the add_signature() function, like so:

function add_signature() {

    // Gets values from the WordPress database.
    $first = get_option('first_name');
    $last = get_option('last_name');

    // If we don't have something saved in the database for the first name, we need to give it some value…in this case, "Firstname".
    if (empty($first)) {
        $first = "Firstname";
    }

    if (empty($last)) {
        $last = "Lastname";
    }

    return '<p> Sincerely, ' . $first . ' ' . $last '</p>';
}

After adding this new code, you’ll need to rezip and install your updated plugin into WordPress. If you’re using WordPress locally through something like XAMPP, just copy the updated PHP file into wordpress/wp-content/plugins/signature folder you made previously.

If you are using attributes

This may be some ugly code (sorry!), but we need it in order to check for certain conditions. Are there default values stored in the database? If not, we need to provide something. Were there attributes? If so, let’s use those instead. So, our new add_atts function looks like this:

function add_atts($first, $last) {
    $name1;
    $name2;

    // Gets values from the WordPress database.
    $data_first = get_option('first_name');
    $data_last = get_option('last_name');

    if (empty($first)) { // If no first name attribute was provided
        if (empty($data_first)) { // If no  default first name is saved in the database
            $name1 = "Firstname"; // Firstname = "Firstname"
        } else {
            $name1 = $data_first; // If a default first name is saved, use it.
        }
    } else {
        $name1 = $first; // If a first name attribute was provided, use it.
    }

    if (empty($last)) {
        if (empty($data_last)) {
            $name2 = "Lastname";
        } else {
            $name2 = $data_last;
        }
    } else {
        $name2 = $last;
    }

    return $name1 . " " . $name2;
}

After adding this new code, you’ll need to rezip and install your updated plugin into WordPress. If you’re using WordPress locally through something like XAMPP, just copy the updated PHP file into wordpress/wp-content/plugins/signature folder you made previously.

Testing And Troubleshooting

When I first made a WordPress plugin, I got an error when I installed and activated it…a warning about headings appeared. If this is your first time making a plugin and you’re not familiar with coding in PHP, you might not know that leaving spaces after the end of a block of PHP code creates this odd heading error in WordPress. Just make sure that there is no extra line or lines after the ?> at the end of your file. This should clear that error up.

Second, you might want to dive into the WordPress database and see for yourself if you’ve set the first_name and last_name options! Since we didn’t use arrays to save our values, you can actually see them (values saved in an array show up as SERIALIZED…not very helpful). Login to WordPress and after wp-admin/ add options.php. This shows you every value saved in the WordPress database. If you haven’t played around with your settings page yet, first_name and last_name won’t be in there. But if you have, they will be there in the list as well as their associated values.

Final Thoughts

Now you know how to make a short code plugin (with or without attributes) and a settings page for it that saves values in the WordPress database. I’ve tried to show you how to do this as simply as possible with descriptions that explain exactly what we’re doing and why. Hopefully, you can now use this knowledge to create your own plugin and have it do what you want. Happy coding!

WordPress Short Codes for Dummies

My most recent project as a junior developer intern was to create a WordPress short code and an admin settings page for it. I thought WordPress was supposed to be simple to work with, but as I found out, the resources out there on the subject of short codes and creating settings pages are quite murky if you’ve never done WordPress development before. So, in this post, I’ll teach you the basics of making a short code plugin.

Create A Short Code

The first thing you need to know about making a short code plugin is that WordPress requires a commented heading at the very top of the file and uses it to display information about your plugin when you install/activate it. For this short tutorial, let’s say you want to add a signature to the end of your posts, just a nice little “Sincerely, Firstname Lastname” for a personalized touch. So, create a new PHP file and create the heading:

<?php
/*
Plugin Name: Signature    
Plugin URI: http://ifyouhaveone.com
Description: Adds a simple signature to your posts and pages.
Version: 1.0
Author: YOU!
Author URI: http://ifyouhaveone.com
License: GPL or None or Whatever
*/

Now, we create the HTML to add a signature by adding a PHP function in our new file with the nice heading:

function add_signature() {
    return '<p> Sincerely, Firstname Lastname </p>';
}

Wow, that was simple. Good. Next, we initialize the short code that will execute this function by calling the WordPress function add_shortcode. This function requires two parameters. The first one is what will be what you want users to type inside short code brackets to run your code. The second is the function to call to actually add the signature. Like so:

add_shortcode('sig', 'add_signature');

In this case, typing [sig] on a WordPress post or page will add our signature by calling the add_signature function we just wrote.

Your plugin is almost ready! Feeling adventurous? Want to learn how to make this short code take attributes? Then click here.

Otherwise, you probably want to see your plugin in action, just to check if I’m totally off my rocker and leading you astray. So, let’s finalize our PHP file by adding ?> on the very last line. Finally, zip your PHP file in your file manager or via command line for you fancy people out there.

Installing Your Short Code

Log into your WordPress account. From the left-hand menu, select Plugins –> Add New. Under the Install Plugins header, click on Upload. Click on Choose File, find your zipped short code file on your system, then click install now. If you have the ability to activate your short code after successful installation, do so. Otherwise, from the left-hand menu, select Plugins –> Installed Plugins. Find the Signature plugin and click Activate. Great! Now, you can use it!

If you are running WordPress locally (such as through XAMPP), the above directions will not work. In this case, simply copy your PHP file and paste it into your WordPress/wp-content/plugins folder. Then from your WordPress account, select Plugins –> Installed Plugins and activate it.

To use your new short code, simply add [sig] where you’d like your signature to appear on a page or post. If you used attributes, you now know the other ways to customize your signature via the short code macro. Congrats!

Adding Attributes To Your Short Code

Attributes are a nice way to customize your plugin on the fly. For our example, let’s say you don’t always want your signature to simply be Firstname Lastname. What if you could change that within each post, depending on your mood? Well you can–with attributes!

In order to allow and get attributes, we need to modify our add_signature function. We need our function to take in an $atts parameter and extract from it some attributes. In our case, we probably want to set the first and last name that’s displayed. So, we’ll do that by adding attributes to our short code and processing them in a new function we’ll call add_atts.

Let’s take a look at our new and improved add_signature function:

function add_signature($atts) {
    extract(shortcode_atts(array(
        'first' => '',
        'last' => '',
    ), $atts));

    return '<p> Sincerely, ' . add_atts($first, $last) . '</p>';
} 

Oh, nice! Inside the array, we declare each possible attribute we could set - either the first name(‘first’) or the last name(‘last’). These attributes can now be used as the variables $first and $last, which we pass as parameters to the function add_atts. Let’s see what that function looks like:

function add_atts($first, $last) {
    $name1;
    $name2;

    if (empty($first)) {
        $name1 = "Firstname";
    } else {
        $name1 = $first;
    }

    if (empty($last)) {
        $name2 = "Lastname";
    } else {
        $name2 = $last;
    }

    return $name1 . " " . $name2;
} 

What does this function do? Well, if we don’t specify a first or last attribute in our short code, it will print a default value, in this case “Firstname” and “Lastname” respectively. If we specify one or both of them, our attribute values will show up. In other words,

  • [sig] will return Sincerely, Firstname Lastname
  • [sig first="Happy"] will return Sincerely, Happy Lastname
  • [sig last="Gilmore"] will return Sincerely, Firstname Gilmore
  • [sig first="Happy" last="Gilmore"] will return Sincerely, Happy Gilmore

Ahh, that’s exactly what we wanted! And it’s really rather simple! So, now it’s time to install this plugin and get it up and running. So, let’s finalize our PHP file by adding ?> on the very last line. Finally, zip your PHP file in your file manager or via command line for you fancy people out there. Now head over to Installing Your Short Code.

Final Thoughts

So now that you’ve made a short code plugin, there’s a few other things I should tell you. If you want to publish your plugin with WordPress Plugin Directory, you need a README file with much of the same information as the comments on the top of your PHP file. If you want more on creating short codes, I highly recommend this site for additional help.

Soon, I will show you how to create a plugin settings page. Stay tuned!