Pages

Wednesday, October 5, 2016

Intro to Variable Fonts in Web Design

There's been talk for years of creating fonts that come with adjustable sizes by default. And for years this was just a pipe dream. But it seems that variable fonts are finally here and they'll only gain support over the coming years.

Designers around the world have been discussing the possibilities and excitedly clamoring over the future of webfonts. What do variable fonts means for the future of CSS3 webfonts? And how will font foundries design fonts to suit the needs of web designers?

In this post I'll bring you up to speed on variable fonts and what these mean for the web. This is an exciting new technology and even though it may be years before this is commercially viable, that leaves designers plenty of time to prepare.

What Is A Variable Font?

The idea of a variable font format has been around for years. But early concepts in the 1990s never gained traction, nor was the web ready for these types of fonts.

But the official release of variable fonts is a very new thing this time around. And thankfully it's being done the right way.

Four big tech companies Adobe, Apple, Microsoft and Google have agreed on a new name for this format: OpenType Font Variations.

This update comes packaged with the new OpenType 1.8 spec and it's fully supported in OpenType files. Each .otf file may now contain a variable set of data points for adjusting letter widths, descender lengths, and x-height values(among other similar features).

A variable font is one font file that contains many different styles or displays of that font.

Variable fonts can make distribution easier but they were never intended for the web. Now with the popularity of responsive design this topic of variable webfonts has been tossed around much more frequently.

This new OpenType Font Variation was officially announced at the Warsaw ATypI conference in 2016. The announcement spurred a detailed blog post by pro type designer John Hudson.

Here's a quote from his post with more technical details:

An OpenType variable font contains one or more axes that each provide particular variation between different extremes of a typeface design. The format also allows for the possibility of intermediate designs, for the whole glyph set or for individual glyphs, to provide finer control over the design as it changes across the variations design space.

If you're a web/UI designer then you probably won't be creating many fonts from scratch. So these technical details aren't as useful if you just want to use variable fonts on commercial projects.

But let's delve a bit deeper into how they work before looking at their applications on the web.

How Do These Work?

Right now installing a Google font is super easy. You visit the page, select what you want, and copy the import URL. But each Google Font comes with only one weight and glyph set.

This means that Oswald can be installed as regular, bold, or both. However adding both styles requires more HTTP data since both styles must be loaded individually.

Variable fonts would contain all of this information together in a single file. But they even go one step further.

Variable fonts can be adjusted on the fly in a web browser so you can make subtle changes to weight or other features like descender length or x-height. The options for customization are controlled by the font designer so there's a lot of flexibility.

Here's a quote from John Hudson's post explaining how these work in greater detail:

A font may contain a set of glyph outlines that correspond to the regular weight and width of a typeface, and the lighter, heavier, narrower, and extended designs will be expressed in the font data as movements of outline nodes relative to that outline.

In less technical speak this boils down to a malleable grid for shaping letters. Think of interpolation where data points define the “grid” of each letter. The default points are called the master style/master font, and these points can be adjusted to create different font styles.

You might be asking why this is even necessary. What's the purpose of manipulating a font style on the fly?

There are actually many good reasons:

  • Updating font style based on screen size
  • Adjusting weight to improve kerning
  • Adjusting letter width for thicker font families
  • Changing the baseline or letter height in large text(eg. headers vs paragraphs)
  • In a design program like Photoshop you have controls to directly manipulate font variations. But what about web fonts? How would you customize these on the fly using CSS?

    Right now that hasn't been officially decided. The W3C has a CSS3 spec for this module and it needs to be updated to support variable settings.

    There is no set timeline so I can't guarantee anything at the moment. But rest assured the teams at these big four tech companies are hard at work trying to create a standard for OpenType Font Variations.

    Variable Fonts On The Web

    These OpenType variable fonts are basically made for the web because they're not as valuable in the print world. Yes they can make smoother dynamic fonts and reduce file sizes, and yes this is very handy for print layouts.

    But on the web these variable font files can reduce HTTP requests and offer more variety than the current form of web fonts. They would be a complete game changer.

    The single biggest hurdle at the moment is browser support.

    CSS3 has a custom rule called @font-face which allows developers to import fonts and render them live on the web. This rule supports a variety of formats like TTF, SVG, and of course OTF.

    The problem is modern browsers haven't agreed on how to implement these variable .otf files.

    The same can be said about the W3C which needs to modify the CSS3 specs to help browsers support these variable fonts.

    And beyond CSS3 support there's also the problem of rendering engines. Fonts need a rendering engine to display properly, and browsers need to support that rendering engine with consistency.

    In my estimate we're at least a couple years away from gaining traction for variable webfonts. But having large tech companies advocate for OpenType Font Variations is a huge deal.

    The practical value of variable fonts on the web should be obvious. They're much smaller, easier to work with, and they offer much more customization without quality loss.

    But the timeline to their viability is still a huge question, and it's a question I hope we can answer soon.

    The Future Ahead

    You can already create and structure OpenType Font Variations if you know how to use font production software. This post goes over all the terminology including variation tables and adjustment deltas for typefaces.

    But that guide is very detailed and really targets advanced type designers. So what does the future hold for people besides type designers?

    It's too early to set dates for full browser support, but the future looks good. This spec was developed by four leading tech companies: Adobe, Apple, Google, and Microsoft. All four have major sway in the industry and many font foundries have even agreed to contribute their support.

    And the OpenType v1.8 release is just the beginning.

    The free Google Fonts platform is already contemplating how to support variable fonts natively. This includes more font types like TrueType, but also more support from their browser Google Chrome. The FontLab team also plans to fully support OpenType variable fonts as soon as possible.

    For now just understand that variable fonts are an emerging technology and they're gaining support quickly. Your current web workflow may not change much today or even this year. But in the next 3-5 years you may be designing in a completely different world of web fonts.

    Since this topic is so new and still under development it's tough to find quality learning resources. But all the links in this post are fantastic resources to get started. And over time as this specification gains support I guarantee there will be a lot more reading material.

    If you're looking for more technical pointers on variable fonts I recommend starting with these articles:


    Source: Intro to Variable Fonts in Web Design

    Tuesday, October 4, 2016

    Why Redesigning Your Website Is A Good Idea

    Web design standards change every year. Influencers always come up with new ideas, and many of them become "trendy" – customers start to demand fan galleries, hamburger menus, flat buttons, custom typography, or whatever else might be trending in that specific year. For new websites it's easy – they are simply built with the latest trends in mind. But for those with a history in business – and on the internet – this usually means periodical redesigns. It takes time to adapt a website to the latest trends, and it also costs money (unless you have an in-house web design team) – but it's worth it. Here's why.

    It shows dedication

    The Vegas Palms Online Casino has been around for more than 15 years. Launched in 2000, https://www.vegaspalmscasino.com/ has stayed the same for years – it was quite advanced at its launch, and most of its players considered what's inside to be more important. To be honest, the Vegas Palms website wasn't that important back in the day, since its games were mostly played through its downloadable suite. But times have changed, and so has the interest of its players, so the Vegas Palms had to adapt. It has recently abandoned its dated look and feels, undergoing a massive redesign meant to bring it up-to-date with today's standards. Today it looks modern, flat, and has a hamburger menu – it shows that the company behind it truly understands the wants and needs of its visitors, looking its best.

    Redesigning your website, bringing it up to the day's standards, shows that you care about the customers that seek you out online.

    4562183397_b4386e4bd8_z

    It shows that you're still in business

    Working as an outreach operative for an online marketing company has taught me a lot of things about how companies handle the request they receive over the internet. I've seen many that are still living in the past, using their domain name for little more than a descriptive email address. Others – those who understand how important the internet is today – keep upgrading not only the look of their website but also its functionality: they implement shopping carts, complex contact forms, or even live chat to make it easier for their potential customers to ask them questions over the internet.

    When I stumbled upon a website looking like it was built in Frontpage (you know, Microsoft's still-born web authoring software suite) by a 10-year-old, I didn't even bother to send them an email. If you send an email to such a company, you'll most likely get a reply from "MAILER-DAEMON" telling you that there's no such email account present on their servers.

    Keeping your website up-to-date is not only a matter of vanity – with an increasing number of potential customers seeking information online, it has become a matter of life and death for companies.

    Image Source; Image Source

    If you enjoyed this post, please consider leaving a comment and share your opinion, subscribing to our RSS feed or Subscribe to our Weekly newsletter to receive a weekly email with this week's most important news updates, delivered right to your Mail Box.
    Source: Why Redesigning Your Website Is A Good Idea

    Monday, October 3, 2016

    Envision Technology Advisors Announces Acquisition of Crown Web (formerly Embolden)

    Envision has announced the acquisition of Crown Web (formerly Embolden), significantly increasing the company's website design and online communications services through their newly created Digital Innovation & Design division.

    Pawtucket, RI September, 27 2016 – Envision Technology Advisors has announced the acquisition of Crown Web (formerly Embolden) from Crown Philanthropic Solutions.

    Founded by Ann-Marie Harrington in 1998, Embolden has won numerous awards for their digital communications strategy, website design, and software development services. Embolden provides services to success-driven companies both locally and nationally with a specialty in nonprofit organizations and community foundations. Embolden was acquired in 2014 by Crown Philanthropic Solutions LLC.

    This acquisition significantly increases Envision's existing website design and online communications services through their newly created Digital Innovation & Design division. This division will be led by former Embolden employee Megan Knobbe with Nick Merrill serving as the company's Creative Director.

    "Our customers need more than a traditional web services company can offer," says Megan. "Joining with Envision ensures that whether our clients are looking for incremental or transformational change, we'll be there to provide the best possible experience."

    For existing Embolden clients, this acquisition means that they will now be supported by a full-service cloud and IT solutions provider. Envision's customers can look forward to an unprecedented level of analytics, strategy, and services focused on enhancing their digital presence.

    "Culturally and philosophically, I can't imagine a better fit between two companies," says Envision's Founder and CEO, Todd Knapp. "Envision has always been passionate about client service and successful outcomes. Our new Digital Innovation team has that same commitment. The future for our company, and our shared client base, is one of innovation and access to emerging technology. This acquisition is critical step to securing that future."

    The Crown Web/Embolden team will join Envision at their main office in Pawtucket's Hope Artiste Village. The company's popcorn machine and ping-pong table were also acquired as part of this deal and will be taking the titles of "Director of Vending and Entertainment" respectively.

    You can learn more about Envision at www.envisionsuccess.net.

    About Envision Technology Advisors

    Envision Technology Advisors provides a range of technology consulting services to the New England area and beyond. Envision's specialties include cloud and managed services, desktop and data center virtualization, network and infrastructure consulting, and digital communications and design. With offices in Pawtucket, RI and the Greater Boston area, the company has been named a "Best Place to Work" for eight straight years. For more information, visit www.envisionsuccess.net.


    Source: Envision Technology Advisors Announces Acquisition of Crown Web (formerly Embolden)

    Sunday, October 2, 2016

    RESTful Java Web Services

    1 RESTful Java Web Services Jose Sandoval Chapter No. 4 "RESTful Web Services Design"

    RESTful Java Web Services Jose Sandoval Chapter No. 4 "RESTful Web Services Design"

    2 In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter NO.4 "RESTful Web Services Design" A synopsis of the book s content Information on where to buy this book About the Author Jose Sandoval is a software developer based in Canada. He has played and worked with web technologies since the Mosaic web browser days. For the last 12 years he's worked or consulted for various financial institutions and software companies in North America, concentrating on large-scale Java web applications. He holds a Bachelor of Mathematics from the University of Waterloo and an MBA from Wilfrid Laurier University. Aside from coding and writing, he enjoys watching a good soccer match and coaching his son's soccer team. You can learn more about his interests at his website www.josesandoval.com or his consulting firm's website www.sandoval.ca. Or you can reach him directly at jose@josesandoval.com. I would like to thank Renee and Gabriel, for bein g the center and compass of my adventures; my family, for supporting me unconditionally; my friends and colleagues, for challenging me at every opportunity; my clients, for trusting me with their projects; and the entire Packt Publishing team, for helping me throughout the writing of this book.

    In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter NO.

    3 RESTful Java Web Services If you're already familiar with REST theory, but are new to RESTful Java web services, and want to use the Java technology stack together with Java RESTful frameworks to create robust web services, this is the book for you. This book is a guide for developing RESTful web services using Java and the most popular RESTful Java frameworks available today. This book covers the theory of REST, practical coding examples for RESTful clients, a practical outline of the RESTful design, and a complete implementation of a non-trivial web service using the frameworks Jersey's JAX-RS, Restlet's Lightweight REST, JBoss's JAX-RS RESTEasy, and Struts 2 with the REST plugin. We cover each framework in detail so you can compare their strengths and weaknesses. This coverage will also provide you with enough knowledge to begin developing your own web services after the first reading. What's more, all the source code is included for you to study and modify. Finally, we discu ss performance issues faced by web service developers and cover practical solutions for securing your web services.

    RESTful Java Web Services If you re already familiar with REST theory, but are new to RESTful Java web services, and want to use the Java technology stack together with Java RESTful frameworks to

    4 What This Book Covers Chapter 1, RESTful Architectures, introduces you to the REST software architectural style and discusses the constraints, main components, and abstractions that make a software system RESTful. It also elaborates on the details of HTTP requests and responses between clients and servers, and the use of RESTful web services in the context of Service-Oriented Architectures (SOA). Chapter 2, Accessing RESTful Services Part 1, teaches you to code four different RESTful Java clients that connect and consume RESTful web services, using the messaging API provided by Twitter. Chapter 3, Accessing RESTful Services Part 2, shows you how to develop a mashup application that uses RESTful web services that connect to Google, Yahoo!, Twitter, and TextWise's SemanticHacker API. It also covers in detail what it takes to consume JSON objects using JavaScript. Chapter 4, RESTful Web Services Design, demonstrates how to design a micro-blogging web service (similar to Twitter), w here users create accounts and then post entries. It also outlines a set of steps that can be used to design any software system that needs to be deployed as a RESTful web service. Chapter 5, Jersey: JAX-RS, implements the micro-blogging web service specified in Chapter 4 using Jersey, the reference implementation of Sun's Java API for RESTful Web Services. Chapter 6, The Restlet Framework, implements the micro-blogging web service specified in Chapter 4 using the Restlet framework, using two of its latest versions, 1.1 and 2.0. Chapter 7, RESTEasy: JAX-RS, implements the micro-blogging web service specified in Chapter 4 using JBoss's RESTEasy framework. Chapter 8, Struts 2 and the REST Plugin, implements the micro-blogging web service specified in Chapter 4 using Struts 2 framework (version 2.1.6) together with the REST plugin. This chapter covers configuration of Struts 2 and the REST plugin, mapping of URIs to Struts 2 action classes, and handling of HTTP requests using the REST plugin. Chapter 9, Restlet Clients and Servers, extends coverage of the Restlet framework. This chapter looks at the client connector library and the standalone server library. Chapter 10, Security and Performance, explores how to secure web services using HTTP Basic Authentication, and covers the OAuth authentication protocol. This chapter also covers the topics of availability and scalability and how they relate to implementing high performing web services.

    What This Book Covers Chapter 1, RESTful Architectures, introduces you to the REST software architectural style and discusses the constraints, main components, and abstractions that make a software

    5 RESTful Web Services Design The RESTful development process follows traditional development paradigms. However, with RESTful web services, we need to analyze the resource requirements first, design the representation for our resources second, identify the URIs third, and, lastly, worry about implementation technologies. Throughout this book we've talked about creating web services that are noun dependent as opposed to verb dependent. In this chapter we'll look at what that means in terms of the design process. For this, we'll design a blogging application, but we'll leave the implementation for later chapters. Our sample application is a micro-blogging web service (similar to Twitter), where users create accounts and then post entries. Finally, while designing our application, we'll define a set of steps that can be applied to designing any software system that needs to be deployed as a RESTful web service. Designing a RESTful web service Designing RESTful web services is not di fferent from designing traditional web applications. We still have business requirements, we still have users who want to do things with data, and we still have hardware constraints and software architectures to deal with. The main difference, however, is that we look at the requirements to tease out resources and forget about specific actions to be taken on these resources.

    RESTful Web Services Design The RESTful development process follows traditional development paradigms.

    6 RESTful Web Services Design We can think of RESTful web service design as being similar to Object Oriented Design (OOD). In OOD, we try to identify objects from the data we want to represent together with the actions that an object can have. But the similarities end at the data structure definition, because with RESTful web services we already have specific calls that are part of the protocol itself. The underlying RESTful web service design principles can be summarized in the following four steps: 1. Requirements gathering this step is similar to traditional software requirement gathering practices. 2. Resource identification this step is similar to OOD where we identify objects, but we don't worry about messaging between objects. 3. Resource representation definition because we exchange representation between clients and servers, we should define what kind of representation we need to use. Typically, we use XML, but JSON has gained popularity. That's not to say that we can't u se any other form of resource representation on the contrary, we could use XHTML or any other form of binary representation, though we let the requirements guide our choices. 4. URI definition with resources in place, we need to define the API, which consists of URIs for clients and servers to exchange resources' representations. This design process is not static. These are iterative steps that gravitate around resources. Let's say that during the URI definition step we discover that one of the URI's responses is not covered in one of the resources we have identified. Then we go back to define a suitable resource. In most cases, however, we find that the resources that we already have cover most of our needs, and we just have to combine existing resources into a meta-resource to take care of the new requirement. Requirements of sample web service The RESTful web service we design in this chapter is a social networking web application similar to Twitter. Throughout this book, we foll ow an OOD process mixed with an agile philosophy for designing and coding our applications. This means that we create just enough documentation to be useful, but not so much that we spend an inordinate amount of time deciphering it during our implementation phase. [ 70 ]

    RESTful Web Services Design We can think of RESTful web service design as being similar to Object Oriented Design (OOD).

    7 As with any application, we begin by listing the main business requirements, for which we have the following use cases (these are the main functions of our application): A web user creates an account with a username and a password (creating an account means that the user is now registered). Registered users post blog entries to their accounts. We limit messages to 140 characters. Registered and non-registered users view all blog entries. Registered and non-registered users view user profiles. Registered users update their user profiles, for example, users update their password. Registered and non-registered users search for terms in all blog entries. Chapter 4 However simple this example may be, social networking sites work on these same principles: users sign up for accounts to post personal updates or information. Our intention here, though, is not to fully replicate Twitter or to fully create a social networking application. What we are trying to outline is a set of requireme nts that will test our understanding of RESTful web services design and implementation. The core value of social networking sites lies in the ability to connect to multiple users who connect with us, and the value is derived from what the connections mean within the community, because of the tendency of users following people with similar interests. For example, the connections between users create targeted distribution networks. The connections between users create random graphs in the graph theory sense, where nodes are users and edges are connections between users. This is what is referred to as the social graph. Resource identification Out of the use cases listed above, we now need to define the service's resources. From reading the requirements we see that we need users and messages. Users appear in two ways: a single user and a list of users. Additionally, users have the ability to post blog entries in the form of messages of no more than 140 characters. This means that we nee d resources for a single message and a list of messages. In sum, we identify the following resources: User List of users Message List of messages [ 71 ]

    As with any application, we begin by listing the main business requirements, for which we have the following use cases (these are the main functions of our application): A web user creates an account

    8 RESTful Web Services Design Representation definition As we discussed in our introduction to RESTful web services, a representation is a temporal mapping of a resource at the time of a request. Furthermore, a representation is transmitted between clients and servers over HTTP. Because of HTTP's flexibility, any binary stream can be transferred. Nevertheless, we don't recommend choosing just any type of binary representation that requires special code or libraries to consume. We recommend using primarily XML and JSON structures, remembering, of course, that the requirements of the problem we're solving dictate what representation types we must provide. A well-designed RESTful web service needs to provide multiple resource representations. We can't assume that only web browsers will be accessing our public APIs or that only the one type of client we identified in our requirement gathering process will use our services. What are the options available, then? Again, arriving at the i deal representation format is a matter of the design process. We need to take into account what the service is doing and what clients will be using the resources for. The safest representation format is therefore XML. This is what web services are known for: transferring XML streams over web transport protocols. More important, most programming languages already have libraries available to parse XML streams. Finally, we need to account for linkability of representations. Linkability of representation means that the web services provide for resource discoverability, such that resources link to other resources (what's currently being referred to as HATEOS or Hypermedia As The Engine Of State transfer). For example, our URI for a list of users returns a structure of users with each element in the list having a direct URI to each element in the service (a link to a user). XML representations From our analysis, we identified two types of resources: users and messages. As part of the heur istics we outlined earlier, we need to define what our representation will look like. The following representations are the structures that we will have to implement when we actually code the web service. [ 72 ]

    RESTful Web Services Design Representation definition As we discussed in our introduction to RESTful web services, a representation is a temporal mapping of a resource at the time of a request.

    9 Chapter 4 Users We first define a user representation as follows: <user> <username></username> <password></password> </user> As part of a user resource, we store only a username and a password. The username is unique in the context of our system and is used to uniquely identify each user. The link element, which points back to the web service, is either assigned when the resource is created or a representation is built for transport (for our sample service, we let the backend create the link). We now define a list of users as follows: <users> <count></count> <user> <username></username> <password></password> </user>... <user> <username></username> <password></password> </user> </users> This XML structure declares a list of users stored in an XML element <users>. We use ellipses or... to show that we can have more than one user in the list. We can see here the linkability concept at play: with a list of users we can drill down to individual users using the link element's value. [ 73 ]

    Chapter 4 Users We first define a user representation as follows: <user> <username></username> <password></password> </user> As part of a user resource, we store

    10 RESTful Web Services Design Messages We first define a single blog entry or message as follows: <message> <messageid></messageid> <content></content> <user> <username></username> <password></password> </user> </message> A message needs a message id, the body of the message (the content element), and the user who posted the message. Note that depending on what we are doing with the message, we don't pass all the resource's information back and forth. For example, when we are creating a message at the client layer, we don't know what the value for messageid is. Therefore, we still need to pass the message structure to the service, but our web service will know that any messageid value needs to be ignored, because, in our case, it will be created by the storage layer. Finally, we define a list of messages as follows: <messages> <count></count> <message> <messageid></messageid&g t; <content></content> <user> <username></username> <password></password> </user> </message>... <message> <messageid></messageid> <content></content> <user> <username></username> <password></password> </user> </message> </messages> [ 74 ]

    RESTful Web Services Design Messages We first define a single blog entry or message as follows: <message> <messageid></messageid> <content></content> <user>

    11 Chapter 4 This XML structure holds a collection of messages, and each message holds the user who posted the message. We use the XML representation type for input and output. Input in this case means that we send a resource representation to create and update the resources at the web service layer in the form of an XML object. Output means that a client requests an XML representation of a resource. JSON representations We use the same key names for our JSON representation, and we still have only two types of resources: users and messages. Again, these structures are our specification of what we need to return for each request. Users We define a user representation as follows: {"user":{"username":"john", "password":"password", "link":"/users/ john"}} And we define a list of users as follows (we use the... characters to show that there is more than one user in the array): {"users-result":{"count":"6", "users":[{"username":"john", "password":"password", "link":"/users/john"},...,{" username":"jane", "password":"password", "link":"/users/jane"}]}} The array for all users as a JSON structure, looks as follows: "users":[{"username":"john", "password":"password", "link":"/users/ john"},...,{"username":"jane", "password":"password", "link":"/users/ jane"}] Once the JSON response has been evaluated with the JavaScript eval() function, similar to what we did in Chapters 2 and 3, we can then access any of the values in the structure. For example, if we need the user name of the first element on the array, we use users-result.users[0].username. Messages We now define a message representation as follows: {"message":{"messageid":"some-id", "content":"some content", "link":"/messages/some-id", "user":{"user":{"username":"john", "password":"password", "link":"/users/john"}}} [ 75 ]

    Chapter 4 This XML structure holds a collection of messages, and each message holds the user who posted the message. We use the XML representation type for input and output.

    12 RESTful Web Services Design And a list of messages as follows: {"messages-result":{"count":"6", "link":"/messages", "messages":[{"messageid":"some-id", "content":"some content", "link":"/messages/some-id", "user":{"username":"john", "password":"password", "link":"/users/john"}},...,{"messageid":"someid2", "content":"some content", "link":"/messages/some-id2", "user":{"username":"jane", "password":"password", "link":"/users/ jane"}}]}} Each message element in the array has a user structure embedded as follows: {"messageid":"some-id", "content":"some content", "user":{"username":"john", "password":"password", "link":"/users/ john"}} Once the JSON response has been evaluated with the JavaScript eval() function, we can then access the first element on the list with messages-result.messages[0]. content; if we want to get the user name of the user who posted the message, we access the value with messages-result.messages[0].user.username. Note that during implementation we'll use JSON representations only as response streams. This means that we won't use JSON structures to create or update resources at the web service layer. Although we could use XML and JSON to update resources at the service layer, we'll omit JSON for the sake of brevity. URI definition The next step involves the definition of URIs. This is a crucial step, as the URIs define our API and it's likely that we want to make our web service public. We strive to make our APIs logical, hierarchical, and as permanent as we can. We must emphasize these three tenets, as we may have many developers depending on the services we make available. Therefore, a good API is one that doesn't change too often and is unambiguous to use. Furthermore, the idea of RESTful APIs is that we maintain URI uniqueness and reliability of service. (For a complete discussion about this topic, see http://www.w3.org/provider/style/uri.) The first thing we need is a web address. In our case, we assume that we're using our developm ent machine running on http://localhost:8080/. [ 76 ]

    RESTful Web Services Design And a list of messages as follows: {"messages-result":{"count":"6", "link":"/messages",

    13 Chapter 4 It's important to distinguish between a web service and a web application: we use web services to implement web applications, and web services can be, and are recommended to be, independent of web applications. What's more, web applications are meant to be consumed by humans, as opposed to web services that are intended for machine consumption. For example, a RESTful API could live under http://api. restfuljava.com/ and a web application using the API could live under http://restfuljava.com/. Both the API and the web application should be running on independent hardware for performance reasons, but when we get to implement our sample service we run everything on the same server. The nomenclature of RESTful URIs falls under the topic of URI templates and the following conventions are widely used. First, for items or identifiers that don't change, we find the keyword to be part of the actual URI for instance, we use users to be the URI for a list of all users. Second, w e use keys or dynamic keywords to be enclosed in { and }. Applying these conventions, our URI list for users looks as follows: http://localhost:8080/users with the GET method, this URI returns a list of all users; with the POST method, we create a new user and the payload is a user's XML representation; we don't support the PUT method; finally, we don't support the DELETE method for an entire list of users http://localhost:8080/users/{username} with the GET method, this URI returns a representation of a user with a unique identifier username; with the PUT method, it updates a user; and, with the DELETE method, it deletes a user. And for messages, our URI list looks as follows: http://localhost:8080/messages with the GET method, this URI returns a list of all messages from all users; with the POST method, it creates a new message, with the message's XML representation as the payload of the request http://localhost:8080/messages/{messageid} with the GET method, this URI returns a repr esentation for a message with the unique identifier messageid; with the DELETE method, it deletes a message; and we don't support the POST or PUT methods http://localhost:8080/messages/users/{username} with the GET method, this URI returns a list of all message for a user with identifier username; no POST, PUT, or DELETE methods are supported At the time of this writing, the URI Template specification is still under review. For more information, see http://tools.ietf.org/html/ draft-gregorio-uritemplate-03. [ 77 ]

    Chapter 4 It s important to distinguish between a web service and a web application: we use web services to implement web applications, and web services can be, and are recommended to be, independent

    14 RESTful Web Services Design Executing logic with RESTful URIs A question arises when designing RESTful web services that has to do with executing code at the server level. Specifically, how do we execute logic if we limit our client/server interactions to only four CRUD-like calls (POST, GET, PUT, and DELETE)? For this we need to introduce URIs that execute logic on the server, remembering that responses must be in the form of resource representations. In other words, we avoid any RPC style calls and concentrate on the resources only. For our web service, we only offer the ability of searching for a term or a phrase in the blog entries. For example, any user can search for the term "programming" or "software development" using the following URI (note that the URI pattern is arbitrary and you can choose whatever makes sense for the service you are developing): http://localhost:8080/messages/search/{search_item} This URI returns a list of messages that contain the word or words s earch_item this is strictly a GET method call and no POST, PUT, or DELETE method is supported Using URIs to request representation types A RESTful web service is one that adheres to all the constraints we outlined in Chapter 1, RESTful Architectures. However, we have encountered APIs that don't strictly adhere to every constraint. For example, requesting representation types via URIs is something we saw with Twitter's API. We requested three different types of representations with the URI http://twitter.com/statuses/public_timeline. {xml, json, rss}. We said that this is not technically a RESTful web service request, because we don't use the communication protocol HTTP headers to tell the service what kind of representation to get. Even though this is not a RESTful web service, it still works. Nevertheless, the API may be open to interpretation. For example, what does it mean to send an HTTP GET request to the URI http://twitter.com/statuses/ public_timeline.json with an HTTP Accept header value of application/xml? Do we get a JSON representation or an XML representation? A properly designed RESTful web service has to adhere to all REST constraints, and using the protocol to negotiate representations is part of being RESTful. Creating a properly defined RESTful web service, however, ensures that there are no misunderstandings on how to use such services. For example, setting the HTTP method type to GET with an appropriate Accept header value makes it clear that we are requesting a resource of a specific type. In the end, you, as a developer or software architect, need to make a decision as to which style will benefit your users the most. [ 78 ]

    RESTful Web Services Design Executing logic with RESTful URIs A question arises when designing RESTful web services that has to do with executing code at the server level.

    15 Chapter 4 Using this representation request style is a design decision that facilitates it can be argued the writing of clients. For instance, the majority of public APIs are read only, so using a straight HTTP GET request with the type of representation embedded in the URI is easier than instantiating a full HTTP request and modifying the HTTP header Accept each time. Note that neither is hard to implement; however, with the former, we save a couple of lines of code at the client layer. Again, it's a matter of choice. Our sample web service is a canonical application, thus we don't deviate from any of the constraints. This means that we use the HTTP protocol to request a preferred resource representation and not the URI style described in this section. Summary As we've seen, the RESTful design process is resource centric. In addition, we have no arbitrary actions executing on the data we have HTTP method calls that exchange representations using clearly defined URIs. The steps to arrive at a web service that adheres to all REST constraints are similar to traditional web application design. So we can still use all our traditional requirement gathering techniques, but tweak the process to account for proper design of usable URIs and consumable representations. Now that we have our social networking web service specification defined together with a set of RESTful design principles, the next step is implementation. We have four different REST frameworks in the menu, so in the next chapter we begin with Jersey, which is the reference implementation of the Java API for RESTful Web Services Specification, more commonly known as JAX-RS. [ 79 ]

    Chapter 4 Using this representation request style is a design decision that facilitates it can be argued the writing of clients.

    16 Where to buy this book You can buy RESTful Java Web Services from the Packt Publishing website: http://www.packtpub.com/restful-java-web-services/book Free shipping to the US, UK, Europe and selected Asian countries. For more information, please read our shipping policy. Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet book retailers. www.packtpub.com

    Where to buy this book You can buy RESTful Java Web Services from the Packt Publishing website: http://www.packtpub.


    Source: RESTful Java Web Services

    Saturday, October 1, 2016

    9 Tips for Designing a Great Web Storefront

    Five years ago, companies built their online shopping carts with the desktop experience in mind. To meet the needs of smartphone and tablet shoppers, these businesses made minor adjustments or they purchased mobile storefront software that was completely different as compared to the e-commerce experience.

    Today, companies that are designing their first e-commerce websites or completely revamping old websites, must design the mobile experience first and then adjust the desktop experience as needed. "Every element, every piece of content, must be functional on mobile," said Jimmy Rodriguez, Chief Operating Officer (COO) at 3dcart. "If you're starting from scratch, you design for mobile. With responsive design, you can build the website to start on mobile and then bring it to the desktop."

    3dcart, which provides e-commerce software to more than 17,000 customers worldwide, has logged a radical shift in how people shop online. Five years ago, only 5 percent of people were browsing 3dcart websites on smartphones and tablets. Today, that number is 60 percent (including tablets).

    To help you design your e-commerce storefront for both mobile and desktop users, Rodriguez recommends that businesses incorporate the following design elements into their storefronts. However, before making any wholesale changes, Rodriguez cautions readers to A/B test features on specific product pages rather than plugging new features onto the entire website.

    1. Sticky Header Navigation We've all been there. We've scrolled down to the bottom of a product page to read user reviews or to read product details, and now we're ready to leave the page to get back to the menu to continue our shopping journey. Unfortunately, in order to get back to the menu, we've typically had to click the "Page Up" button on our desktop keyboards or tap at the top of the screen on our mobile devices.

    With Sticky Headers, as you scroll down, the menu resizes and adjusts. The menu follows you along your journey to keep the navigation on the screen should you need to quickly jump pages. You can see this in effect on Bose.com. Despite being midway through the page, I'm still able to access the page's main navigation without having to head back to the top of the screen.

    2. Hamburger Menus

    Although Hamburger Menus sound like a feature best-suited for fast food restaurants, they are quickly becoming a must-have for companies that do a lot of business on mobile devices. You've seen them before: Hamburger Menus have become the standard mobile icon for mobile navigation and menus.

    They feature three horizontal lines that, when pressed, offer a drop-down menu of a website's navigation. They are particularly useful on mobile devices where screen real estate is at a premium. But we're starting to see them on desktop websites as well, so consumers have a similar experience on company websites regardless of the device they're using.

    "A lot of people see Hamburger Menus and they know what it means, but they don't know it's basically the new standard," Rodriguez said. "Mobile visitors have learned the meaning of this symbol and websites should embrace it as a standard for mobile navigation."

    You can see a Hamburger Menu on the upper-right hand corner of Target.com and on Target's mobile website. You can also see it pictured below.

    3. Parallax ScrollingLess of a functionality feature and more of a way to improve your website's aesthetics, Parallax Scrolling takes advantage of big banners full of high-resolution imagery to add an artistic flair to your website. By taking advantage of large, full-width images, you can create a displacement effect between your website's background image and the image that's directly in front of your consumer.

    As you can see in the image below from RemmilLondon.com, as you scroll down the page, the website's background images changes. However, the change occurs subtly as the background and foreground images blend into one another. The screengrab below shows the website right at the moment when the background image changes from purple to pink.

    4. Infinite ScrollingInfinite Scrolling sounds more like a torture technique than it does an e-commerce feature. However, this nifty tool lets your users continually view new products without having to click into and load a new page. Here's how it works: When you scroll down to the bottom of an e-commerce page, the page automatically loads more items at the bottom of the page. They're still catalogued as pages on the backend but the visitor doesn't know that.

    You can see a similar feature on UnderArmour.com. Unfortunately, Under Armour requires you to click the "Load More" button to see additional content. Some websites are equipped with an auto-open mechanism that will show you more content without requiring a click.

    5. A Floating "Add to Cart" ButtonSimilar to the Sticky Navigation tool, floating "Add to Cart" buttons allow your consumers to add products to their shopping cart regardless of where they are on the product page. Previously, users would scroll down to user reviews, product details, and other lower-page elements, and, in order to add the product to their cart, they'd have to scroll back to the top of the page. Now, companies such as Diesel.com let you see the product's price, quantity, color options, and image as well as the "Add to Cart" button, regardless of where you are on the product page.

    6. Use Fitts' LawI won't bore you with the mathematics behind Fitts' Law, but it's essentially a theory that the larger and closer an object is to us, the more likely we are to interact with it. The same basic principle can be applied to e-commerce. If you want to guide users to product pages, shopping carts, and promotions, you should make those buttons large, colorful, and as close to the center-middle of the page as possible.

    If you ignore Fitts' Law, and you place tiny, black-and-white buttons along the rails or at the bottom of pages, you may lose out on potential purchasers. Don't make this mistake.

    7. Display Customer Reviews and Testimonials

    You don't want customers coming to your website, viewing your products, and then heading to Amazon to check user reviews. After all, Amazon may sell the product cheaper or the customer may prefer the Amazon shopping experience to your website's.

    If you give your customers the ability to rate and review products, you'll be able to fend off those cautious customers that need the assurance of other consumers before making a purchase. Most e-commerce tools make ratings and reviews easy to implement so don't shy away from this practice.

    8. Breadcrumb Checkout

    When customers check out of your store, they like to know where in the process they are, how far from finishing they are, and how to easily go back without losing all of the data they already entered. Breadcrumb Checkout shows customers exactly where they are in the process by utilizing a linear navigation button design that allows consumers to click forward and backward from sign-in, payment options, shipping options, place order, or continue shopping. Without this layout, consumers may press the back button, see that their information isn't logged, get frustrated, and leave the website.

    9. 360-Degree ViewsEver purchase a seemingly modest jacket online only to realize it's got a bedazzled rhinestone back? Well, when you returned that product, you wasted your own time, the vendor's time, and you cost the company money. Don't worry, it wasn't your fault. More than likely, the vendor only had front- and side-view images of the jacket. Had he or she implemented 360-degree view images, you would have spotted those rhinestones and clicked the cancel button.

    Don't make this same mistake on your own website. In addition to letting customers zoom in on images, give them the option to rotate or view multiple angles of the image. This way, they're not surprised when they open the delivery box and pull out a more complicated product than they were expecting.


    Source: 9 Tips for Designing a Great Web Storefront