Archive

Archive for January, 2017

Redesign v15 Notes

January 6th, 2017 No comments

Little redesign around here. As ever, it’s just a start. It will ebb and flow in the weeks, months, and years to come.

There are bugs! There are little differences that might take a tiny bit of getting used to! You’re always welcome to contact us and report bugs or let us know what you think. You know how a lot of people are all like “all websites are the same!”, well, some things are different here quite on purpose.

Dedicated Area for the Newsletter

It feels much better to have a web archive of the newsletter. Since it’s hand-written, I’d hate for that content to be lost in email-only-land. This is just a simple v1, I’m sure we can make these archives even more usable moving forward.

Card-based Layout with Featured Images

What I like about card-based layouts is that you can limit the width of the card such that the line-length isn’t too wide and images aren’t too enormous, then arrange the cards any way you like. Many of the pages use CSS columns to lay out the cards.

Cards can make for fun browsing.

It’s already confused a number of people how the next chronological card is below the top left one instead of to the right. I understand the confusion, but I’m not particularly concerned. Not all pages are chronological. I’m not sure how much chronology matters, especially when dates are clearly presented and the content is relevant. I like how it gives slightly-older articles a new chance to shine at the top of the next column.

On mobile, the cards stack on top of each other.

Which has also been confusing for some folks. The thinking is: cards are always excerpts. The stacking (and thus hiding of some text) says: click/tap this to keep reading it.

Expanding Images and Pens

The main content area is exactly centered, which differs from the last few designs. It’s also slightly narrower. I prefer the narrowness for text, but I was a little bummed that it made images and embedded Pens smaller. So I made images expandable!

Which is pretty much Dave’s thing.

Plus we made the Pens expand both ways:

Oh, plus, code, too, if it needs it:

Tagging

We’ve been tagging content for the last few years, but haven’t meaningfully exposed it. This design is our first crack at it.

Commenting

Comments are sticking around, and we want to continue encouraging discussion via comments, but we also want to have clear expectations for commenting behavior. Here’s the latest stab at that:

Think of it like a letter to the editor.

In other words: more moderation. Which isn’t just keeping out the bad, it’s giving lots of super rad stars to the good!

Fluid Type

I just can’t get enough.

The Lodge Combined with Videos

The Lodge was always just video screencasts anyway, and since we no longer charge for it, we squished them together. All these series are still available in there.

Performance

As ever, there are improvements to be made. But…

500ms for the DOM and 1.16s for full load on 3G ain’t bad.

I was able to do some performance optimizations on the front end like the removing of some libraries, removing of some images, lazy loading others…

Header

For the curious, the weird moving backgrounds are SVG that is pseudo-randomly generated points of a . Here’s the stripped down code for it:

See the Pen CSS-Tricks Header by Chris Coyier (@chriscoyier) on CodePen.

New Areas

None of these are ready yet, but the main motivator for me to mess around with a redesign was to bring to live some new areas. Here’s a sneak peak at just one page of one area.


Redesign v15 Notes is a post from CSS-Tricks

Categories: Designing, Others Tags:

Inkscape 0.92, New Version of the Free Vector Graphic Editor

January 6th, 2017 No comments

Is there a web developer, or ambitioned page owner that still doesn’t know the free vector graphic project Inkscape? Inkscape is the vector counterpart to the free pixel editor Gimp and has been established for years now. In the past few days, the current version 0.92 with plenty of changes has been released after two years of development.

SVG and CSS: Inkscape is Moving Closer Towards the Standard

Inkscape is distributed under the GPL, making it an open source software to the core. It’s not developed by a company but is kept alive by free contributions of many voluntary developers. For years now, the commitment has been on an oddly high level.

Financed by donations, the project is able to send out a representative to the W3C SVG Working Group. This is the council that is supposed to further develop the standard Scalable Vector Graphics (SVG). This way, some new ideas out of Inkscape are considered for the expansion of SVG, which makes the project especially attractive for developers. As to be expected, the standard file format of Inkscape is SVG.

Standards compliance is a particular priority of Inkscape. To meet the CSS standard, for example, the default resolution was raised from 90 to 96 dpi. The software provides different conversion options when trying to open an older Inkscape file.

Overall, the developers have focused on correctly displaying many SVG2, and CSS3 elements within the program. However, the user interface doesn’t allow you to alter all of these elements. Under Inkscape 0.92, the usage of complex mesh gradients doesn’t require any tricks anymore but is provided by default.

Inkscape is Still Available for Windows, macOS, and Linux

Designers will be especially happy about the new path effects, which allow for very creative designs via interactive deformations. Watch the following video to get an overview of the new functions:

As usual, Inscape 0.92 is available for the three dominant operating systems Windows, macOS, and Linux. Since we’re talking about open source, you can also compile your own build, but you don’t have to. The developers aimed for an easy distribution and brought you these installation packages. Under Linux, you’ll usually get to the current Inkscape using your default package manager.

If you want to gather detailed information on the current version’s feature set, read the entire changelog. The official announcement can be found here.

Categories: Others Tags:

Introducing the Payment Request API

January 6th, 2017 No comments

As I understand it:

  • It’s the early days for a standards-based JavaScript API for payments on the web. As in, var payment = new PaymentRequest(methodData, details, options);
  • For users, it means potentially better UX. Payment methods are stored by the browser, and work with those browsers existing proprietary payment systems (e.g. Microsoft Wallet). That means users aren’t filling out payment forms nearly as often, they are just selecting payment methods.
  • For developers, long term, it means not having to create those payment forms and validating data and all that work. You get the UI and UX of a payment flow for free. Although for now, the best you can do is progressively enhance to this, so it’s more work in the meantime.
  • Microsoft has docs for it, and so does Google.

Direct Link to ArticlePermalink


Introducing the Payment Request API is a post from CSS-Tricks

Categories: Designing, Others Tags:

Becoming A Better Facilitator

January 6th, 2017 No comments

Facilitation in the broadest sense means helping or enabling people to achieve a positive outcome. It’s an important and often under-appreciated skill for designers and other UX professionals to gain. It’s especially important as more teams embrace lean UX practices, which shift emphasis away from big deliverables toward facilitating outcomes such as continuous discovery and shared understanding.

Any kind of working session or meeting in which design decisions are being shaped needs a facilitator. The authors of Sprint, the popular book about running five-day design sprints, compare the facilitator’s role to Brad Pitt’s character in Ocean’s Eleven: The facilitator “keeps the heist running.” But you don’t need to run a week-long workshop to benefit from facilitation skills.

The post Becoming A Better Facilitator appeared first on Smashing Magazine.

Categories: Others Tags:

The Narrative Browser Using Articulate.js

January 5th, 2017 No comments

Many sites with lots of written content employ specially crafted print style sheets. That way, a user can print out the relevant content without wasting paper on navigation, ads, or anything else not germane.

Articulate.js, a jQuery plugin, is what I consider the narrative equivalent. With as little as one line of code, it enables developers to create links that allow users to click, sit back, and listen to the browser read aloud the important content of a web page. In some ways, it can turn a thoughtful essay or article into a mini podcast. And because it uses built-in JavaScript functionality, no browser extensions or other system software is needed.

I thought I would share how I went about creating Articulate.js with the hopes that it could provide the reader with ideas on how to apply this technology in different ways.

The Speech Synthesis Interface

Articulate.js uses the Speech Synthesis interface of the Web Speech API. It is currently supported in all the major browsers, including the latest versions of Edge, Safari, Chrome, Opera, Firefox, iOS Safari, and Chrome for Android.

There are two window objects of the Speech Synthesis interface that are used to enable the browser to speak: SpeechSynthesis and SpeechSynthesisUtterance. The first step is to create an instance of the SpeechSynthesisUtterance object and designate the text you would like spoken. If desired, you can set additional properties such as the rate, pitch, volume, and voice.

To begin speaking, this object is passed as a parameter to the SpeechSynthesis.speak() method. Other playback functionality, such as pausing, resuming, and cancelling, are all methods of the SpeechSynthesis object. A useful demo from Microsoft lets you play around with these features.

At the end of this article, there are many resources listed that walk you through the intricacies of this functionality and provide additional examples.

Getting Started

The lightweight Articulate.js plugin allows you to leverage the powerful selector options of jQuery to specify which parts of the website to speak. For example, depending on how the page is organized, a single line of code, like the following, can direct the browser to speak the entire contents of an article or blog post:

$('article').articulate('speak');

Here’s an example that targets only the primary headers and paragraphs:

$('h1, h2, p').articulate('speak');

Internally, Articulate.js clones the matched set of elements and all their descendant elements and text nodes. It then parses this clone using a default set of rules, deciding what should be spoken and ignored, then adding the appropriate pauses to make everything sound more like a narrative.

These are the basic methods along with a CodePen example:

Function Description
$(selector).articulate('speak'); Speaks aloud the specified DOM element(s) and their descendants
$().articulate('pause'); Pauses the speaking
$().articulate('resume'); Resumes the speaking after it has been paused
$().articulate('stop'); Stops the speaking permanently

See the Pen Articulate: Basic Functions by Adam Coti (@adamcoti) on CodePen.

You can only have one SpeechSynthesisUtterance instance active at a time, which is why a jQuery selector is not needed for pausing, resuming, or stopping. As mentioned before, these methods act upon the SpeechSynthesis object.

Also, the browser will only stop speaking when there’s no more text to be read or when a “stop” call is executed. If the speaking is paused, it must be resumed or stopped before anything else can be spoken.

Adjusting the rate, pitch, and volume can be done. By using an input slider, adjustments can give the user some added control. While the system default rate is 1, after much testing, I bumped it up slightly to 1.1 as that seemed to provide a more natural speaking speed. That’s subjective, of course, and can be overridden.

Function Description
$().articulate('rate',num); Sets the rate of the speaking voice
Default = 1.1
Range = [0.1 – 10]
$().articulate('pitch',num); Sets the pitch of the speaking voice
Default = 1.0
Range = [0 – 2]
$().articulate('volume',num); Sets the volume of the speaking voice
Default = 1.0
Range = [0 – 1]

See the Pen Articulate : Voice Parameters by Adam Coti (@adamcoti) on CodePen.

There are many more options available to the developer, but let’s talk for a moment about what happens under the hood when Articulate.js is asked to speak something on the page.

The Articulate.js Algorithm

The Speech Synthesis interface that Articulate.js leverages will read aloud, in a most literal fashion, any string of text it’s provided. Some symbols it will enunciate (e.g. it will say “percent” when it encounters “%”); others, it will ignore (e.g. the quote symbol is left unspoken). Its cadence is dictated primarily by commas, which elicit a small pause, and periods, whose pause is slightly longer.

With that in mind, quite a bit of manipulation is needed to prepare a web page for speaking. Unfortunately, one simply can’t concatenate all the selected text nodes in the DOM as that would result in a lot of run-on text (e.g. lists), include content that isn’t appropriate for reading aloud in a coherent fashion (e.g. tables), and ignore items that should be described (e.g. images).

Articulate.js handles this by applying, among others, the following rules to the DOM elements specified in the jQuery selector:

  • Delete HTML tags that may contain text nodes, but shouldn’t be spoken, such as
    and . A list of 21 tags are designated to be ignored as the default.
  • Find instances of

    through

    ,

  • , and
    tags and append each with either a period or comma. This is to ensure that a pause occurs when spoken since these elements are often visually represented without punctuation.
  • Insert descriptive text gathered from the alt attributes of images,
    tags from tables, and
    tags from figures.

After this is completed, what’s left is converted to a long text string that now requires further manipulation, including:

  • Find tags and pairs of smart quotes and insert the text “quote” at the start and “unquote” at the end to distinguish them when spoken.
  • Add starting and ending text to designate lists and block quotes.
  • Find em dashes and insert a comma in its place to elicit a short pause.
  • Remove remaining HTML tags and comments.
  • Remove remaining line breaks and carriage returns as well as lingering HTML special characters.

At this point, the string of text is ready to be sent to the Speech Synthesis interface to be spoken by the browser. If you were to look at this string, you would see instances of multiple periods, commas, and spaces — that’s OK — as it won’t affect how it sounds. That is, one or more commas or periods grouped together won’t create even longer pauses.

Customization

By using JavaScript and HTML data attributes, Articulate.js can be customized to optimize the user experience. As the following CodePens demonstrate, you can:

  • Specify HTML tags to be spoken that would otherwise be ignored, and vice versa.
  • Perform a search and replace within the text, which is helpful for abbreviations. For example, you can specify that all instances of “i.e.” to be spoken as “that is”.
  • Specify blocks of text to be ignored. For example, a sentence that reads “click here for more information” does not need to be spoken.
  • Specify words to be spelled out.
  • Specify copy in specially crafted comment tags to be spoken that is otherwise hidden on the screen.

See the Pen Articulate: Text Manipulation by Adam Coti (@adamcoti) on CodePen.

See the Pen Articulate: HTML Data Attributes by Adam Coti (@adamcoti) on CodePen.

Browser Consistency

You will notice that the Speech Synthesis interface is subtly different across browsers and operating systems. For example, the default rate of speech will sound somewhat faster on an iPhone as opposed to its desktop implementations. Developers can provide input sliders or radio buttons for users to fine-tune their experience.

In addition, depending on the operating system and device, browsers expose different voices to the Speech Synthesis interface. As seen in the demo from Microsoft mentioned earlier, these voices can be selected to override the default “native” voice. But, for simplicity sake, Articulate.js only uses the default voice — later versions will allow that parameter to be modified as well.

Some Final Thoughts

The inspiration for Articulate.js came from the idea that with a simple click, I can enjoy having articles read to me when it’s not convenient or desirable to be staring at a screen — particularly when using my phone. Maybe when lying in the park with my eyes closed or while I’m preoccupied with preparing dinner. The goal was to allow developers to make the appropriate customizations so that it sounds less like a screen reader and more like a friend is reading the web page to you.

Articulate.js can be used as a voice option for anything on the web page, from enunciating a single word to conveying content not displayed on the screen. If you’re interested, download the source code and experiment. And, most importantly, have fun with it!

Download and Documentation

The commented source code and minified versions of Articulate.js can be downloaded at its Github home. Full documentation can be found there as well.

Resources


The Narrative Browser Using Articulate.js is a post from CSS-Tricks

Categories: Designing, Others Tags:

3 web design errors that just won’t die

January 5th, 2017 No comments

Web design has come a long, long way since the 1990s, when things like GeoCities and AOL dominated the Internet. Design itself has evolved, along with a deeper understanding of principles like usability and the user experience. There certainly hasn’t been a lack of studies examining everything from typography and site speed, to content above versus below the fold.

The Nielsen Norman Group is one of the premier user-experience consultations on the planet. It’s been in business for decades, conducting study after study on design, usability, and UX. In one of its earliest studies from all the way back in 1996—when “Friends” and “The X-Files” were still on TV—they identified 10 web design errors that were hugely problematic back then, in the very early days of the web.

You’d think that, 20 years later, as design has gotten more sophisticated and information about design has become much more accessible, designers would learn to avoid design mistakes, but a recent, large-scale usability study from 2016 by the NN Group found just the opposite to be true.

Instead of learning from past mistakes, designers have been continually repeating them throughout the decades. In fact, if there’s one thing that’s certain in web design, it’s that these errors continue to persist because designers keep forgetting the basics:

  • Enabling users to find information
  • Enabling users to read that information
  • Enabling users to understand where to click and where the destination is

A lack of clarity

One of the most stubborn errors designers continue to make on websites is not sympathizing with the need of users to clearly and easily understand what the site or its elements is about.

The study identified these mistakes surrounding a lack of clarity:

  • Unexpected locations for content
  • Competing links and categories
  • Hidden fees and prices

The study revealed how too many designers put content in places that users aren’t familiar with based on ordinary browsing habits. For instance, inaccurate or inappropriate category names that failed to match the expected content within the categories was a recurring problem.

Another issue was navigational categories or links that sound similar to each other, which hampers users from finding the information they want. In such a case, your users will likely end up leaving your site and going somewhere else, where content is sorted much more clearly.

Hidden fees and prices will also hurt your conversions because no shoppers want to feel like they’re being treated dishonestly. When it comes to money, your users want to know about everything they’ll have to pay for up front, at the beginning of a transaction. This refers to prices, subscription fees, convenience fees, and anything else where money is involved. From a pure design perspective, it’s a huge mistake if hiding fees and prices causes a loss of customers and transactions.

Overstock is a great example of full disclosure: note how big and bold its pricing information for products is.

UX problems

How easy your site visitors find that it is to actually use your site is integral to whether or not your site has good UX or not.

The NN Group’s study found these UX-related design mistakes that just won’t go away:

  • Islands of information
  • Link repetition
  • Stranding users on microsites
  • Inadequate search results
  • Flawed filters and facets

Two big design errors are isolated pockets of information on any given page that fail to link to other, related information on different pages and forcing users to repetitively click on what amounts to the same types of links to get specific information. Both design errors inconvenience your users by failing to provide them with the information they’re looking for in context.

Many sites feature subsites (think Yahoo). The problem is that some of these subsites provide users with no way of returning to the main site, creating a headache for them and stranding them where they don’t want to be. Yahoo is actually an excellent example of a main site and subsites done right, as users are never stranded and can always click on the home button to return.

On the issue of search, unfortunately, a lot of sites still either fail to search the entire site for search terms or return results that fail to even match users’ search terms in the first place.

And while filters and facets (essentially filters for various attributes of objects in a set of content) are well-intentioned, they’re much of the time either tagged incorrectly or are insufficient, thereby creating confusion.

Information architecture foul-ups

Information architecture should, in many ways, be the heart and soul of good design. Essentially, it’s what helps users understand your site environment and content quickly, so they find what they want. It involves labeling, organizing and structuring your content in the clearest way possible.

The usability study again found stubborn, repeated mistakes designers still make in this area, just as they did 20 years ago. These include:

  • Overwhelming users with excessive information
  • Presenting users with hidden links

Studies show that users don’t really read web content; it’s more like they skim or scan said content instead. That’s why content should be chunked, in small and short paragraphs, and broken up with everything from bullet points to enumerations for better reading. The last thing you want to do is put huge blocks of text before your users.
Wayfair.com is a case in point for how to present information to visitors. Note how its content is easily digestible, as it’s efficiently broken up.

On the problem of hidden links, you’d be surprised at how many times designers hide links to relevant site content—for example, the menu of a restaurant—in the same column as ads leading to external links. The long and short of it is that most users won’t be able to find such relevant links amidst all the ads, which makes considering the placement of relevant links extremely vital to design.

Will it get better soon?

Part of the problem is that many designers just aren’t usability experts, but that’s no excuse. When you’re designing, you have to be obsessed with providing your users with a superb UX. Otherwise, your site’s usability, conversions, on-page time, and sales simply drop—and no client will tolerate that.

It will be interesting to see if, in another 20 years, we still see studies like these, talking about how design errors from decades ago are still haunting our web-design community.

LAST DAY: Woodford Bourne PRO Family of 18 Vintage Grotesque-Style Fonts – only $15!

Source

Categories: Designing, Others Tags:

Designing A Responsive Music Player In Sketch (Part 1)

January 5th, 2017 No comments

Sketch is known for its tricky, advanced facets, but it’s not rocket science. We’ve got you covered with The Sketch Handbook which is filled with practical examples and tutorials that will help you get the most out of this mighty tool. In today’s article, Christian Krammer gives us a little taste of all the impressive designs Sketch is capable of bringing to life. — Ed.

Music plays a big role in my life. For the most part, I listen to music when I’m commuting, but also when I’m exercising or doing some housework. It makes the time fly, and I couldn’t imagine living without it.

However, one thing that has always bothered me is that the controls of music apps can be quite small and hard to catch. This can be a major issue, especially in the car, where every distraction matters. Another issue, in particular with the recent redesign of iOS’ Music app, is that you can’t directly like tracks anymore and instead need to open a separate dialog. And I do that a lot — which means one needless tap for me.

The post Designing A Responsive Music Player In Sketch (Part 1) appeared first on Smashing Magazine.

Categories: Others Tags:

Peekier: This New Search Engine Protects Your Privacy

January 5th, 2017 No comments

As all of us should know by now, searching on the web is not anonymous. Especially the top dogs of the search branch store lots of data regarding your search requests and even beyond that. Peekier doesn’t do that.

Huh!? Search Engines Know a Lot More About You Than You Think

Due to the pooling of useful services into one Google account, the search engine giant from Mountain View is the service that almost knows more about you than you do. Only if you own, and use, a Google account, that is. In your Google account, the data from all the different services is pooled, which allows for detailed evaluations.

But even if you only make use of the Californian search engine, while picking alternatives to the other services, you’re already disclosing a lot about yourself. Google uses cookies in order to be able to recognize you each time you visit. Google determines your preferences according to your search requests, and displays respectively fitting ads.

Should you be logged in while searching, you’ll obviously give the operator a lot more information than you would if you simply searched. Nonetheless, you’re still revealing your IP address, as well as the used browser, and your search requests are also stored.

The owners of the pages you clicked on in the search results also gain data from you. They know where you come from, and what you looked for. Now, they immediately place their own cookie, and a basic profile has been created.

Peekier Thwarts the Data Collection Frenzy

The brand new search engine Peekier has a very different way of handling the mentioned aspects. First off, it doesn’t place cookies, and doesn’t save your IP address or any other information.

The results are mainly taken from Bing, which is why you can actually consider Peekier as a true alternative to Google, just by looking at the quantity and quality of the search results. The search keywords are not saved, and aggregrated into a history either. However, they are stored for service purposes, but in a way that prevents them from being assigned to a user.

The data protection focus continues on the search result page. In contrast to other providers, Peekier gives you a preview of the website that you may want to visit. If you were to check the listed pages on Google, looking for specific information, you would have to call them up one by one, spreading your data on the web with a watering can, although, in most cases, the accessed page won’t even contain the information you were looking for.

This is different on Peekier. Here, you click the preview. Now, an overlay with the scrollable page content, which the search result would lead to, is opened. This is where you get to check if the page is actually relevant. Within the preview, all links are deactivated, preventing you from accidently jumping somewhere you didn’t want to go to.

The search results can be refined even more by clicking one of the tags that Peekier integrates into the search bar, as soon as the search results are set. As usual, Peekier suggests keywords as soon as you start typing in the search bar.

If you decide that you want to call up a particular search result, this is done via the link above the preview window. At that point, the accessed page will know where you’re from, but not what you looked for.

On top of all the data protection features, Peekier simply looks good. The entirely flat design makes Peekier look more elegant than other search engines. Subtle animations show that the system is alive, and are visually pleasing. The search result page is displayed as a configurable grid, reminding me of Pinterest in a way.

Due to its card-based design, Peekier looks great on both desktop, and mobile devices. Even the detail preview works fine on mobile devices, allowing you to check out the page before actually visiting it.

See for yourself. The discussion on Peekier over at Hacker News is interesting as well.

Categories: Others Tags:

From Sass to PostCSS

January 4th, 2017 No comments

Tyler Gaw documents his process of moving off Sass and onto PostCSS, but keeping most of the code the same. That meant making sure he was using PostCSS plugins that would replicate most of Sass’ functionality, like nesting and mixins and whatnot.

Tyler is sold. I find it an interesting experiment, and it’s cool to know it’s basically possible, but I’m definitely not sold yet.

Now instead of just having Sass as a dependency, which is an active healthy project, you have a whole bunch of plugins with different authors as dependencies. And for what? Assuming you use libsass, you don’t get any speed. If you like some particular PostCSS plugin, using Sass doesn’t prevent you from using that also. One thing I definitely wouldn’t recommend is preprocessing those custom properties, as those are not interchangeable things.

Direct Link to ArticlePermalink


From Sass to PostCSS is a post from CSS-Tricks

Categories: Designing, Others Tags:

My Journey Of Learning Programming Through Flatiron School #5

January 4th, 2017 No comments

My name is Mason Ellwood and I’m currently working on Flatiron School’s Online Full Stack Web Development Program. Each week, I’ll be writing about my experience, what I’m learning, and tips on learning to code.

When going through this school, I want to stress how important it is to take VERY elaborate notes. It has saved me immense time while completing lessons that I have encountered so far. So here is my book unveiled to you for the first time ever: A Comprehensive Guide to Flatiron School’s Online Web Developer Program.

My very unspecific title, I know. But while writing my “book”, I have learned how to better teach myself. I have included basically every concept that was new to me and serves as a review of what I know now. And when I say comprehensive I mean….

I currently am on page 60 of my book, and am not sure if it will make it on the “Opera Book of the Month Club”, but it serves its purpose. Enough about that, and let’s get into it! Like I said in the last post, I will be skipping ahead quite a bit, so I can catch up to where I am currently within the school.

Puts and Prints

Puts or “out*put s*tring” and print are used to display the results you write within the console. Without this and by default ruby will not display any output. It is a way to specifically display data you want to the console. The main difference between these two are puts adds a new line after executing and print does not. Remember you can test this with the IRB workspace.


A
return value is the data returned to the program by the execution of a method. By default, every method in Ruby returns a value, which is the outputting of the last statement in the method.

As you can see by this, there is the assumption that is should output b, c, and d. But by specifying return will disrupt the execution of your method.

Methods and Arguments

When writing your own methods you will encounter arguments that need to be met, so your method will pass. This is created by adding an argument list to the end of your method name by using ().

This allows you to place a user dependent variable within your method, making it dynamic. The above code allows the user to replace x with whatever we want x to equal. X in this example is considered a bare word within the argument list. Allowing us to puts “hello” x amount of times. Once the method has been defined, you now NEED to pass a variable to the bare word when calling the method or else the method will fail and you will receive an argument error.

Which basically says, not all arguments have been met in order for the method to pass. You can also add as many arguments as you would like, by separating them with commas. Arguments create a local variable that can be used within the method when you name an argument, you are then defining what bare words you want to use to access that data

This concept allows you to create dynamic reusable code, remember to work towards the concept of DRY (don’t repeat yourself).

You can also add default arguments to your bare words, try to always use optional or default arguments within your methods. Using the equal sign within your argument list next to each bare word you would like to assign, you can create a default argument making your code more dynamic. But you must place bare words with default values at the end of the argument list. This is considered good practice or your code can return unexpected values.

By default the above method, only outputs the phrase created by the user one time, but can be reused and retold to display phrase as many times as you would like. Remember though, if you set your bare word default to an integer it does not need quotes, if the default is a string it needs to be specified as such with quotes.

Read More at My Journey Of Learning Programming Through Flatiron School #5

Categories: Designing, Others Tags: