The Ends do not Justify the Means: The Necessity of Code Review

Hopefully this post does not sound like just a rant as I admit that this post has come up from my frustrations from using other people’s work, but I think this is particularly symptomatic of areas where there are not always IT experts, as is the case with many libraries. I also do not boast that I always know what I’m doing, but that’s why I think it’s invaluable to have some kind of code review process.

Making it Simple

As a general rule, better to make things as simple as possible rather than using complex methods if they both achieve the same things. I’ve been told that simple and clean code is the best kind of code.

There may be efficiency concerns involved, but then that seems to be left behind in the cases I’m talking about anyway. (Case in point, our website had 5+ CSS files, not all which had clear purposes, many of which were overwriting each other’s classes, which I had to rework into two files.)

Document and Comment

While some of the simple things might be obvious and self-explanatory, I don’t think I’ve ever seen anything over documented/commented in the ‘real world’ (as opposed to school work), so more is (generally) better. I think it’s doubly important where the creation of a product/tool might be outsourced, but the maintenance of it is done in house (as frequently seems to happen), that the code can be understood by a new/beginner programmer-type person.

Too often I have looked at code recently and thought “what does this do?” or “how many pages does it affect?” While I admit that it’s not always easy to know what or how much needs to be documented, because you don’t always know who will look at it in the future and things you write yourself tend to make sense, but do at least a minimal amount of documentation and commenting.

On a side note, do not name files or functions after yourself (one former student’s name is now unforgettable for that reason and this was created months before I started).

Get Feedback

Ideally, there is someone who is an actual programmer on your team or in your unit who you can ask to take at least a quick look over what you’ve done and give you feedback on whether you’ve done it correctly. If there’s no one ‘inside’, consider asking someone on the ‘outside’.

Within a team or unit, if there is more than one programmer-savvy person, consider establishing a Review/Feedback step in the process as you typically see before code commits (if this doesn’t already exist of course).

If you really can’t get feedback from someone else, then much like editing your own writing, step back from it (for, preferably, a couple of days) and look at it with fresh eyes and ask yourself some of the important questions, but namely:

would someone else be able to step in and easily understand what your code does?

Supervising Students

I believe that all the above points apply when working with students too. It’s okay if you’re not a programmer. At least take a brief look at the code, see if commenting is done, ask about the general process/framework, ask if they think a beginner programmer would be able to understand their code easily, etc. If you ask, it will at least make him/her think about it!

My Point

The end product does not mean it is what you want. Other people also need to be able to maintain and customize/modify. This all seems so obvious, but I think it bears reminding sometimes.

Ryerson Going Google with Google Apps: The Run Down

UPDATE: See my more recent blog post if you’re looking for my supplement materials (to the Ryerson Google site) on sync’ing Google Apps.

I attended a session to address concerns with privacy and security concerns in adopting Google apps at the university. Half of the session was actually a general how to protect your own information and your responsibilities as a user. I’ll focus more on the project itself than the second half since there’s a ton of resources about protecting your information already out there.

Google Apps

For the implementation, Sada Systems will be dealing with the actual implementation and migration. Roll out will be done in stages starting with the first four, and the rest will have to go through the evaluation process first.

  • mail
  • calendar
  • docs/drive
  • contact
  • chat
  • mobile
  • sites
  • app engine
  • plus
  • video

Options

  • Faculty and students will have an opt-in option for mail.
  • Staff, however, will be migrated (i.e. not optional).
  • Everyone will be moved to calendar in order to be rid of Groupwise (yay!).
  • Everyone will still keep their @ryerson.ca so there is no change in the email address itself.

Timeline & Next Steps

In a nutshell, there is none, and that’s because the legal agreement hasn’t actually been signed yet.

Once it does get signed, then alpha testing will be done with the CCS group (central IT) and then beta testing with a larger community group. They’re still hoping for a fall rollout though.

Legal Concerns

Most privacy and security concerns revolved around lawful access and warrantless searches with storing data in the US. It was explained that basically, it doesn’t make a difference. Canada has similar legislation and the Mutual Legal Assistance Treaties (with many countries) is a binding agreement to share information under lawful access or warrantless searches, which means the same thing will happen if your data is stored in any of the countries part of the agreement.

Privacy & Data Protection

To alleviate some concerns, the organizing group assured everyone that a Privacy Impact Assessment is done using the international standard, Privacy in Design and ensures that there are no breaches to:

Additionally,

  • all incoming mail goes through the university servers first
  • not opting in means that email stays on the university servers
  • opting in means the emails are then sent and stored on Google servers
  • students emails will not be visible in the global (internal?) address list
  • minimum identifying information (username, name) is used for authentication
  • drives/docs is private by default
  • calendars display only free/busy by default (as in Groupwise right now)

As I mentioned, in the second half of the presentation, we were all reminded that most email/information/data breaches are due to users, not email systems or hardware, and that email is not secure (although they’re looking into encryption for sensitive information). We got the usual spiel on our responsibilities not to include sensitive information in emails, having secure passwords, being careful of phishing, making sure websites use https, etc.

We’ll see how quickly they get things going, but I’m sure many staff will be happy to get rid of Groupwise (which likes to crash at least a couple of times a week and cancels shut down) at the very least.

For more updates, there is a dedicated blog for project updates.

OLITA Digital Odyssey 2012: Outside-In – Approach to Inclusiveness

The presenter spoke quite quickly,and there was a lot of points on the slides, so I didn’t catch everything. I also focused more on design aspects than anything else.

Defining Inclusive Design

  • design that is inclusive of the full range of human diversity with respect to ability, language, culture, gender, age, and other forms of human difference
  • designing for diversity

Digital Exclusion

  • access to online systems no longer an option
  • estimated social and economic cost of digital exclusion
  • required for government, commerce, education ,etc.

Bridging the Gap

  • developers design for the typical or average user
  • Assistive technology (AT) is intended to bridge the gap to reach anyone that requires alternative access systems
  • this bridge is inadequate: only some disabilities and only reaches a few countries

Specialized Assistive Technology

  • 28% of the world
  • rising in cost
  • decreasing in availability

Accessibility Legislation

  • necessary foundation for systematic change
  • AODA groundbreaking approach to legislating accessibility
  • but currently
    • hard to update
    • hard to keep current
    • accessibility requirements seen to constrain innovation
    • fear of implementing new technologies
    • one-size-fits-all solution

Global Consensus

  • need new approach
  • especially with an aging population, which needs more alternatives as they grow older

True Accessibility

Need New Approach

  • more inclusive of full diversity of learners
  • more relevant to educational demands
  • more timely and continuously renewable
  • contextualized or embedded in learner’s context

Putting It All Together: Creating a WordPress Theme Options Page Resources

There are some good theme option tutorials already out there, but I found a lot of them either too elaborate for my needs or incomplete. As a result, I thought I’d break it down how I used various tutorials in order to complete my page.

Loading Your Theme File

To actually load your theme options page, make sure that it is loaded as part of the theme setup. If you’re using an existing theme, you should see a:

add_action( ‘after_setup_theme’, ‘themename_setup’ );
This or something similar tells WordPress to load the themename_setup function more or less as the theme is being loaded/applied. Refer to the function reference page if necessary.

Somewhere in the function that is called, themename_setup, add a line to load your theme options:

require( get_template_directory() . ‘/inc/theme-options.php’ );
Refer to the PHP Manual require page if necessary.

All the code talked about in the tutorials would go in this one file. If a theme-options file already exist, consider whether you would rather make a new one or simply modify the existing one. If you only have 1-2 options, also consider adding options to existing options, such as Writing, Discussion, etc. if appropriate.

Recommended Create a Theme/Plugin Options Page Tutorials

Make your options page: Presscoder’s Tutorial (second half of post) or Otto’s Tutorial (simpler, less to read through, but less complete)

One thing in particular, I preferred Presscoder’s validation code.

The one thing I’ve been having problems with is setting the default options, and some other people I have found also have problems with the register_activation_hook, in which case, try using add_action as explained by Chip Bennett.

At the bottom of Otto’s post, he also briefly explains how to add options on existing pages instead of making a new one.

First half of Presscoder’s post gives a good overview of the WordPress functions and easy copy/paste example code for the various types of form options (e.g. textarea, checkbox).

A full example of an options page can also be found on Presscoder’s post near the bottom (just above “In Summary”).

To get the “Options/Settings Updated” box when a user has submitted/saved their options: Search for “Settings Updated Notice” on page 3 of Chip Bennett’s tutorial.

Displaying Your Options

Obviously, this depends on what kind of options you had (textbox, checkbox, etc.). The simplest example is if you have a textbox or textarea and you want to simply output the user’s input. In the appropriate place, insert:

<?php $array_name = get_option(‘option_name’); echo $array_name[‘key’]; ?>
Refer to get_option function reference if necessary.

More Resources

Chip Bennett obviously wrote much more than what I just refer to, but it goes into much more complex options than I cared to and covers how to implement multiple tabs on one settings page. If you’re interested in more functionality, I definitely recommend his tutorial.

If you prefer to have a prebuilt helper, Olly Benson has created a sort of template or framework with reusable code. Read more on his blog (though I haven’t actually tried using it).

For more, the WordPress Settings API page has a list of tutorials.

Ryerson Faculty Conference: Students’ View on Academic Social Media Use Panel

Some notes from the panel, which consisted of three presenters/moderators and a group of 5 students.

Some Statistics on Technology Use Among RU Students

  • 42% smartphone users used their devices for academics
  • 78% own smartphone
  • 20% integrated seamlessly into classroom environment
  • 50% institution uses technology effective
  • 39% institution needs more technology

Above averages over all students in survey (except the last, which is below).

What Social Media Do You Use for Class Work?

The theme seemed to be convenience in many comments:

  • Use Facebook for IM + file exchange
  • always there, goes straight to smartphone
  • In FB, easy to separate people into groups
  • use Google Apps for docs, calendar, etc.
  • Twitter more convenient than email
  • email is the easiest way to submit assignments

Why do you prefer Social Media outlets instead of the CMS?

  • doesn’t crash
  • user friendly
  • more real world
  • connect outside of classroom
  • inconsistent look and functions e.g. discussion not always enabled
  • habit – already using Twitter/FB before entering university

What Changes Would You Like To See?

  • more consistent use of CMS
  • possible integration into social media
  • possible notifications (though some consider it to just add to the “noise”)
  • automated audio/video capture to be posted for later reference

Faculty also expressed concerns not only on the time commitment needed in an attempt to engage students with different social media outlets, but also privacy. Students, however, said they were more likely to use the CMS if it was more user friendly, had more options, more consistently used, and most importantly, that expectations were clearly outlined.