Tuesday

RAII, Ruby Digraphs, Implementation Comments

 
 Programming
 
 
From Scott Orgera, your About Programming Editor
 
Follow us on:
 
 

So you've completed development on a shiny new mobile app and can't wait to unleash it on the masses.  Not so fast!  Putting your finished product through a thorough testing cycle first is a crucial, although sometimes overlooked, step in the process.  Have no fear, as our Web Design/HTML Expert shows you how it's done.

This week we also explore a number of other interesting topics including when to use GET or POST in Ajax, how to create directed graphs in Ruby, reading and manipulating RSS feeds using Delphi, and much more...

 
 
How to Test Mobile Apps and Web Pages

When you are building Web pages and applications for mobile devices, one of the most important steps you can take is testing. Testing gives you a good idea of what your readers are going to experience when they come to your site, and by fixing the major problems ahead of time, you can avoid issues with your customers later.

Testing a page or application for mobile uses the same checklist as testing for a full-sized browser. You need to check that the page looks good before you post it, and then check it after it's live. But one step that many designers ignore is testing on mobile devices. Even if you donít have a separate page for mobile users, you should test your pages on mobile devices — especially tablets. Tablet devices are growing in popularity every year and it's becoming more and more likely that some of your visitors will be on tablets. Touch screen tablets have some different design requirements, even if you expect them to use your standard full-sized site. READ NOW

Understanding RAII

RAII stands for Resource Acquisition Is Initialization. It's a useful way of handling resources, such as memory, fonts, and files to ensure that they are released when no longer needed or when a process terminates due to an error. Resources are generally tied to objects. A file handling class will probably require a file handle to access a file for opening, reading or writing the file. Once the object is finished with the file, the resource must be released.

The basic problem RAII solves is that if the file handling object terminates, say due to an exception, then the resource must be freed if it has been acquired. After an exception in C++, the only code that can run is the object's destructor. Constructors can fail as well so it makes sense to return an exception. READ NOW

Making Digraphs in Ruby

Digraphs, or "directed graphs," are graphs consisting of nodes with arrows pointing between them. Think of them like flowcharts, each node represents a step in a process and each arrow between them (or "edge") represents a user following that path. Generating digraph images is handled by Graphviz, and interfacing with Graphviz is handled by the graph gem.

First, you'll need to install the graph gem. This is a pure-Ruby gem and doesn't require any compilation. It more or less just generates "dot dot" (named with the .dot extension) files, which are plain text so it's not doing all that much work. The gem itself is more of a domain-specific language for generating dot dot files using Ruby code. READ NOW

Ajax: Get or Post

When you use Ajax to access the server without reloading the Web page you have two choices on how to pass the information for the request to the server. These two options are to use GET or POST.

These are the same two options that you have when passing requests to the server to load a new page with two differences. The first difference is that you are only requesting a small piece of information instead of an entire Web page. The second and most noticeable difference is that since the Ajax request doesn't appear in the address bar there is no noticeable difference that your visitor will see on their screen when the request is made. READ NOW

 
ADVERTISEMENT
Featured Articles
More from About.com
Sign up for Shareables!
An every-morning rundown of the day in history, with headlines and trends produced by your pals at About.com. Click here to sign up! It's free (of course) and we think you'll like it!
Want More From About.com?
Check out our social channels tailored to every interest!
Sign up for more free newsletters on your favorite topics

You are receiving this newsletter because you subscribed to the About.com Programming newsletter. If you wish to unsubscribe, please click here.

If you would like to unsubscribe from all newsletters sent from About.com, please send an email to optout@about.com with "Unsubscribe" as the subject line.

Contact Information:
1500 Broadway, 6th Floor
New York, NY, 10036

Privacy Policy © 2014 About.com