Tuesday, July 18, 2017

How to Register & Use Laravel Service Providers

If you've ever come across the Laravel framework, it's highly unlikely that you haven't heard of service containers and service providers. In fact, they're the backbone of the Laravel framework and do all the heavy lifting when you launch an instance of any Laravel application.

In this article, we're going to have a glimpse of what the service container is all about, and following that we'll discuss the service provider in detail. In the course of this article, I'll also demonstrate how to create a custom service provider in Laravel. Once you create a service provider, you also need to register it with the Laravel application in order to actually use it, so we'll go through that as well.

There are two important methods, boot and register, that your service provider may implement, and in the last segment of this article we'll discuss these two methods thoroughly.

Before we dive into the discussion of a service provider, I'll try to introduce the service container as it will be used heavily in your service provider implementation.

Understand Service Containers and Service Providers

What Is a Service Container?

In the simplest terms, we could say that the service container in Laravel is a box that holds various components' bindings, and they are served as needed throughout the application.

In the words of the official Laravel documentation:

The Laravel service container is a powerful tool for managing class dependencies and performing dependency injection.

So, whenever you need to inject any built-in component or service, you could type hint it in your constructor or method, and it'll be injected automatically from the service container as it contains everything you need! Isn't that cool? It saves you from manually instantiating the components and thus avoids tight coupling in your code.

Let's have a look at a quick example to understand it.

As you can see, the SomeClass needs an instance of FooBar to instantiate itself. So, basically, it has a dependency that needs to be injected. Laravel does this automatically by looking into the service container and injecting the appropriate dependency.

And if you're wondering how Laravel knows which components or services to include in the service container, the answer is the service provider. It's the service provider that tells Laravel to bind various components into the service container. In fact, it's called service container bindings, and you need to do it via the service provider.

So it's the service provider that registers all the service container bindings, and it's done via the register method of the service provider implementation.

That should bring another question on the table: how does Laravel know about various service providers? Did you just say anything? I've just heard someone saying that, Laravel should figure that out automatically too! Oh boy, that's too much to ask: Laravel is a framework not a superman, isn't it? Kidding apart, that's something you need to inform Laravel explicitly.

Go ahead and look at the contents of the config/app.php file. You'll find an array entry that lists all the service providers that will be loaded during the bootstrapping of the Laravel application.

So, that was the service container at your disposal. From the next section onwards, we'll focus on the service provider, which is the main topic of this article!

What Is a Service Provider?

If the service container is something that allows you to define bindings and inject dependencies, then the service provider is the place where it happens.

Let's have a quick look at one of the core service providers to understand what it does. Go ahead and open the vender/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php file.

The important thing to note here is the register method, which allows you to define service container bindings. As you can see, there are three bindings for the cache, cache.store and memcached.connector services.

Basically, we're informing Laravel that whenever there's a need to resolve a cache entry, it should return the instance of CacheManager. So we're just adding a kind of mapping in the service container that can be accessed via $this->app.

This is the proper way to add any service to a Laravel service container. That also allows you to realize the bigger picture of how Laravel goes through the register method of all service providers and populates the service container! And as we've mentioned earlier, it picks up the list of service providers from the config/app.php file.

And that's the story of the service provider. In the next section, we'll discuss how to create a custom service provider so that you can register your custom services into the Laravel service container.

Create Your Custom Service Provider

Laravel already comes with a hands-on command-line utility tool, artisan, which allows you to create template code so that you don't have to create it from scratch. Go ahead and move to the command line and run the following command in your application root to create a custom service provider.

And that should create the file EnvatoCustomServiceProvider.php under the app/Providers directory. Open the file to see what it holds.

As we discussed earlier, there are two methods, boot and register, that you'll be dealing with most of the time when you work with your custom service provider.

The register method is the place where you define all your custom service container bindings. On the other hand, the boot method is the place where you can consume already registered services via the register method. In the last segment of this article, we'll discuss these two methods in detail as we'll go through some practical use cases to understand the usage of both the methods.

Register Your Custom Service Provider

So you've created your custom service provider. That's great! Next, you need to inform Laravel about your custom service provider so that it can load it along with other service providers during bootstrapping.

To register your service provider, you just need to add an entry to the array of service providers in the config/app.php file.

And that's it! You've registered your service provider with Laravel's scheme of things! But the service provider we've created is almost a blank template and of no use at the moment. In the next section, we'll go through a couple of practical examples to see what you could do with the register and boot methods.

Go Through the Register and Boot Methods

To start with, we'll go through the register method to understand how you could actually use it. Open the service provider file app/Providers/EnvatoCustomServiceProvider.php that was created earlier and replace the existing code with the following.

There are two important things to note here:

  • We've imported App\Library\Services\DemoOne so that we can use it. The DemoOne class isn't created yet, but we'll do that in a moment.
  • In the register method, we've used the bind method of the service container to add our service container binding. So, whenever the App\Library\Services\DemoOne dependency needs to be resolved, it'll call the closure function, and it instantiates and returns the App\Library\Services\DemoOne object.

So you just need to create the app/Library/Services/DemoOne.php file for this to work.

And here's the code somewhere in your controller where the dependency will be injected.

That's a very simple example of binding a class. In fact, in the above example, there's no need to create a service provider and implement the register method as we did, since Laravel can automatically resolve it using reflection.

A very important note from the Laravel documentation:

There is no need to bind classes into the container if they do not depend on any interfaces. The container does not need to be instructed on how to build these objects, since it can automatically resolve these objects using reflection.

On the other hand, it would have been really useful if you had bound an interface to a certain implementation. Let's go through an example to understand it.

Let's create a very simple interface at app/Library/Services/Contracts/CustomServiceInterface.php.

Next, let's create two concrete implementations of this interface. Basically, we just need to create two classes that extend the CustomServiceInterface interface.

Create the DemoOne class in app/Library/Services/DemoOne.php.

Similarly, DemoTwo goes in app/Library/Services/DemoTwo.php.

Now, instead of binding a class, we'll bind an interface. Revisit EnvatoCustomServiceProvider.php and change the code as shown below.

In this case, we've bound the App\Library\Services\Contracts\CustomServiceInterface interface to the DemoOne implementation. Hence, whenever the App\Library\Services\Contracts\CustomServiceInterface dependency needs to be resolved, it instantiates and returns the App\Library\Services\DemoOne object. Now it makes more sense, doesn't it?

Let's quickly revise the controller code as well.

As you may have guessed, the $customServiceInstance should be the instance of App\Library\Services\DemoOne! The beauty of this approach is that you can swap the DemoOne implementation with the other one easily.

Let's say you want to use the DemoTwo implementation instead of DemoOne. In that case, you just need to make the following changes in the service provider EnvatoCustomServiceProvider.php.

Find the following line:

And replace it with:

Similarly, find this one:

That should be replaced by:

The same approach can be used should you want to replace any core implementation with your own. And it's not only the bind method you could use for your service container bindings; the Laravel service container provides various ways of binding into the service container. Please check the official Laravel documentation for the complete reference.

The next candidate is the boot method, which you could use to extend the core Laravel functionality. In this method, you could access all the services that were registered using the register method of the service provider. In most cases, you want to register your event listeners in this method, which will be triggered when something happens.

Let's have a look at a couple of examples that require the boot method implementation.

You want to add your own custom form field validator to Laravel.

Should you wish to register a view composer, it's the perfect place to do that! In fact, we could say that the boot method is frequently used to add view composers!

Of course, you want to import a facade Illuminate\Support\Facades\View in your service provider in the first place.

In the same territory, you could share the data across multiple views as well!

It can also be used to define explicit model bindings.

These were a few examples to demonstrate the usage of the boot method. The more you get into Laravel, the more reasons you'll find to implement it!

And with that, we've reached the end of this article. I hope you've enjoyed the topics that were discussed throughout this article.

Conclusion

It was the discussion of service providers that was the center attraction of this article, although we began our article with the service container as that was an important ingredient in order to understand the service provider.

Following that, we developed a custom service provider, and in the latter half of the article we went through a couple of practical examples.

For those of you who are either just getting started with Laravel or looking to expand your knowledge, site, or application with extensions, we have a variety of things you can study at Envato Market.

If you've any queries or comments, just shoot it using the feed below!


by Sajal Soni via Envato Tuts+ Code

3 Ways to Generate Leads Using YouTube

Want to generate more leads and conversions with YouTube? Looking for organic tactics to help boost the performance of your existing video content? In this article, you’ll discover three effective ways to turn YouTube viewers into leads. #1: Drive Website Traffic With YouTube Cards YouTube cards are a marketer’s dream come true because they let [...]

This post 3 Ways to Generate Leads Using YouTube first appeared on .
- Your Guide to the Social Media Jungle


by Rikke Thomsen via

RegExpBuilder – Create Regular Expressions Using Chained Methods

RegExpBuilder integrates regular expressions into the programming language, thereby making them easy to read and maintain.

Regular Expressions are created by using chained methods and variables such as arrays or strings.


by via jQuery-Plugins.net RSS Feed

Monday, July 17, 2017

How to Make Money as a Social Media Marketing Expert

Ever since their inception, social media platforms have been quite transformative not only for how we communicate but also for how we do business and market products. If you are not already making money through social media, or if you want to maximize on what you are already making through social...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by DIW via Digital Information World

Transcript: A Chat with Don Norman

As Luke mentioned in a recent post, our UX Mastery book club has been reading Don Norman’s The Design of Everyday Things.

Last week we were lucky enough to have the opportunity to interview Don in a Google Hangout.

Here is a full transcript of the session:

Luke: Hello there, I’m Luke Chambers. Welcome to a special edition for UX Mastery book club members. I’m humbled and excited to be joined today by Don Norman – widely regarded for his expertise in the fields of design, usability engineering, cognitive science, for being a prolific advocate for human centred design, for his gentle humour, and for the orientation and inspiration that he provides for designers.

With a rich and varied career and amongst his many other roles, which makes it difficult to do justice with only a short introduction, Don is currently the Director of the Design Lab at the University of California, San Diego, and co-founder and consultant with the Nielsen Norman Group.

He is here to chat with us about his seminal book on design – and our current book club focus – the book with the masochistic teapot cover, The Design of Everyday Things. Thank you so much Don and welcome to our book club. How are you?

Don: Thank you. Hey, that’s the old book!

Luke: It is, but I have an even older one here. The old old one.

Don: The Psychology of Everyday Things! The newer version, the one published in 2013 does have new material and different examples.

Luke: Yes. We have a few questions about that. I know people are keen to know about that. We’re joined in this hangout by a selection of UX Mastery book club members who all have some questions. Welcome to you – we’ll come back to you in a minute.

But to begin, Don – the warmth and approachability in your writing is an inspiration to many of us who read your work. Can you start off today’s discussion by telling us a little bit more about what’s behind your excitement and advocacy for HCD and how that feeds into your process and thinking, and indeed emotion, when you’re writing.

Don: Well I started off as a geek. I was an electrical engineer – I got two degrees in electrical engineering – and I firmly believed that if only people would get out of the way then our stuff would work much better.  Then by freak accident – actually most of my life has been accidental – and what I’ve learned to do is take advantage of these accidents and go into whole new fields and explore new territories.

So by freak accident I got attracted by the newly revived Psychology Department in Pennsylvania where the new Chair was a physicist and they were hiring people who had no background really in psychology and so I went and talked to the Chair who said “You don’t know anything about psychology – wonderful!” And so I joined the psychology department and brought in information processing to psychology, which was really quite foreign in those days.

And after I graduated my first job was at Harvard where George Miller had set up something called the Centre for Cognitive Studies (I didn’t even know what the word cognitive meant) and my real education in psychology came when I was at the centre at Harvard.

After a short stint there I went to the newly founded university at San Diego and got there before any students had graduated, so it was just populated by very senior professors and a few Nobel Laureates and our graduate students. Over the years I worked in the psychology department doing things in memory and learning and attention and looking at how people do actions, and I got quite interested in human error and the kinds of errors that we make.

That got me called in to investigate our major nuclear power accident at 3 Mile Island and there I discovered, along with a group of other people on this committee – we were trying to determine why the operators had made the errors that they made. We decided that the operators were really quite intelligent and sensible and everything they did was sensible except that the design was so bad that if you wanted to cause people to make errors, you couldn’t have done a better job.

There were 4000 meters and controls laid out in a neat orderly way, so that you might have a bank of 20 switches and then if you flipped on in the middle wrong, people got mad at you. Yeah! So that made me realise that this background that I had in both engineering and psychology was really a good combination to look at human behaviour.

That’s when I started first of all working with NASA and aviation safety, and then consulting with the newly developing computer industry. I did a lot of work with what was called Xerox PARC in those days (the Palo Alto Research Centre) and also with Apple. As I did more and more of that I got more and more interested in the activity going on in Silicon Valley so I retired from the university (I retired in 1993) and went up to Apple and became eventually a Vice President of the Advanced Technology Group and that’s where I realised many different things. One of them was the difference between what academics know and what practitioners know.

The joke I like to tell is that in academia there is a lot of deep thinking and very little doing. In industry there is a tremendous amount of doing and very little thinking. So it is actually useful to go back and forth, back and forth. The reason you don’t do much thinking in industry is not because the people can’t do it – they’re really bright, they’re very good people – but there is no time. Everything is a rush. No matter what you’re doing, there’s a rush – a competitive rush. There’s a rush to get out in time for a Christmas break or in time for new years or the start of school or whatever, and it takes 2 or 3 years to do a major project and even so, it’s always a rush.

In fact, in the new edition of The Design of Everyday Things – because the old edition was written before I got to Apple – 25 years ago and I’ve learned a lot. The fundamental principles haven’t changed but I was able to update the examples, which were a bit out of date, and put in two new chapters about life in the real world. I explain the design process and how we first try to solve the right problem – we do design research and then we do rapid prototyping and we test and so on. When you actually come to do that in a product team you are not allowed to. The person in charge (the product manager) will say “Yes, what you are saying is absolutely the right way to do it but I’m sorry we just don’t have the time to do this right now. Next time we’ll do it right.”  But there is no next time.

So I invented Don Norman’s Law which says that the day the product team is put together it’s over it’s budget and it’s behind schedule.

So that’s in a nutshell how I arrived at where I am. I really like working in industry, and working with academics, and going back and forth. When I was pulled out of my second retirement to start this new design lab, first of all I decided that I would not work in a department or a school, I would work across the entire university, and second of all I decided that I would work closely with a lot of industry so that we would work on real problems, instead of the toy problems that most academic work is about. And that’s getting off to a nice start.

Luke: Stephanie had a question. If you could go back and change the book – you had the 2013 edition – we’re coming up to 30 years next year – is there anything about the way design has changed recently that you might consider including additional material for?

Don: Not really. Design is undergoing some rapid change and my book is primarily concerned with the physical components and the way we interact with products. There is very little about services. And also very little to do with the kind of work that I’m doing at the Design Lab. At the Design Lab we decided that we would not start a traditional design department and make traditional products or even traditional services because I thought, you know, there’s lots of really good design schools all around the world and we don’t really need another one.

What we decided to do was work on complex problems and systems. Complex socio-technical systems. We work in education, where we are trying to be ‘self taught’. You go and find a course and you take it. And that will really change the way things are. Instead of going to college for 4 years and then graduate school for another 2 or so on – I guess if you’re British you go to college for 3 years and then 2 years for a Masters – and that’s supposed to last you the rest of your life! Nah! So a lot of us are thinking why even get a degree at all? Why don’t you just take the courses that have the knowledge that you need at the moment and then as you learn and need more knowledge, take those courses!

All the the general purpose knowledge like philosophy and history and literature – if they bore you, don’t take them because as you mature, guess what? You’ll discover that oh, history is actually fascinating, and then you go and learn it. If you learn it when you really want to you’ll learn it so much better and it will matter a lot more.

So we’re doing that and we’re doing healthcare which is a mess because it was monstrous. It was never designed so we ended up with 20, 30, 50 different specialties and a patient goes from one specialist to the next, the next, the next and information is lost all along the way. Medical error is thought of as one of the 3 top causes of death! That’s crazy.

And other things as well. Like automation. And how people react with automation. Some of the stuff that we do there fits into the last couple of chapters of the book. Actually it fits into all of the book, but to treat it properly requires a second book. And I may yet do that.

Luke: You mentioned that in a field that is changing so rapidly, people can do their own learning online. They can take short courses in things that interest them. Are there things that you think that design students should really learn but they wouldn’t of their own initiative? That they might miss out on if they do their own self guided learning?

Don: If we talk about design students, we need to talk about what kind of students. Traditional design students come from art and architecture schools and they basically learn the craft. I think that the work that is done by these types of designers is wonderful and beautiful and it makes my life better and I’m really delighted by these products. The kinds of problems that I’m talking about though require a very different kind of training. We have to know more about the world. And about organisations and about politics.

Why does a designer have to know about politics? Well when you’re talking about complex endeavours, trying to restructure education or healthcare or transportation, they affect large numbers of people. If it’s a big project, no matter what you suggest, people will object. You have to figure out some careful path through all these objections to get everything done. And that’s what politics is about. The good side of politics. It’s the art of compromise, when people with honest differences of opinion meet and then try to figure out a way out – a compromise that satisfies as many as possible.

The bad part of politics is when they refuse to discuss other alternatives or when it’s driven by greed or profit. But we have to deal with all of this because in the real world if I want to change a transportation system or an education system it is amazing how many people will come out objecting. We have to learn how to deal with all that and how to divide the project up into a whole lot of small, meaningful parts that we can handle without getting too much objection. So instead of doing one large solution we do many tiny steps.

Luke: That’s a good segue into some of the questions that our hangout participants have. Dan, you had a really good question about checklists and things to do and not to do.

Dan: Sure. It was an older question but I’ll take it anyway. It was essentially asking a version of what Luke just asked. Do you think there is a problem with lists of dos and don’ts on the internet. Do you think they are lacking a problem to solve, or any context at all?

Don: Yes. Yes. I could say more, but yeah. I mean, come on, every time there is a list of dos and don’ts it’s over simplified. And in fact every time you have a list of fundamental principles, I have a list of fundamental principles, but you have to be careful because they often conflict with each other. I want it to be as easy and simple as possible but I want to do things that fit people’s real needs, but people’s real needs aren’t simple so it’s a question of how I balance that – how do I fulfill the need but still make it understandable?

One of my pet peeves is these devices [holds up iPhone] and I blame Johnny Ive, the lead designer at Apple. He is a brilliant industrial designer but taught as a craftsperson so his stuff is beautiful. His videos always talk about how he could machine the metal to make the body in one piece of metal and the way it feels and the way it looks and the rounded corners and the black screens. Wonderful. But he is completely ignorant about how people interact with these devices. The modern iPhone is getting harder and harder to use. You may not agree but just think about how many times you wonder if you should click one time or two times or three times or do a long tap or a short tap. Is it one finger or two fingers or three fingers. Whether you swipe up or down or left or right. There is no way of knowing. The fundamental principle of discoverability has been lost, even though Apple was one of the companies that invented it. We don’t get that feedback.

How many times do you get your phone and flip through looking for a photo and you want to show somebody and you give it to somebody else and they touch the screen so it’s lost. There is no way to go back. I hate it when I give a talk and people want to take pictures of me. When they have a camera it is wonderful. They take the camera up and go click. If they have a phone they give it to someone else to take the picture and the person touches the wrong thing and loses the camera and then it goes back and forth and back and forth and so on. So what ought to be a 5 second job turns into a minute job and when there are 20 people in line that is a lot of time.

Luke: A lot of the language around usability and UCD contains assumptions that simplicity is the ideal goal for a designer.

Don: I have a book that says just the opposite. People don’t want simplicity. They claim they do but they really don’t – they want things that they can understand. If you give someone something that they understand they’ll say “see how simple it is?” And if you make it simple – it’s just one button! Ah ok, but how many things does it do? Does it do 20 things? How do you make one button do 20 things? It ends up looking simple but it’s incredibly complex to use. So people don’t want simplicity, they want understanding.

Luke: Nalin, did you have a question for Don about the pros and cons of being a UX unicorn?

Nalin: Yes. Don, my question is in a UX career, what are the pros and cons of being a UX unicorn over specialising in a specific thing?

Don: What do you mean by a UX unicorn?

Nalin: What I meant was someone who is up to date and working professionally in research, to design, to testing, across the fields of UX vs specialising in design or research or testing or direction design – just one area.

Don: I think the way we would form that question is whether you should be a specialist or a generalist and the answer to that is it is all up to you. They are different. Some people just love learning more and more about the particular skills and the particular focus on their work. And they are very very important. We need them. There are other people who just like a lot. They like to work on different problems every time. So they know a little bit about lots of areas. So, you’re suddenly thrown into a medical problem or a transportation problem or a banking problem and it’s really exciting because you don’t know anything about it so you have to find the experts – those other people who are the specialists and have them teach you. And put it all together. So you need a team of specialists and a team of generalists and I believe those are different people. It really has to be your choice as to which direction you feel naturally inclined.

Luke: Erin, did you have a question around strategies for convincing companies about the value of UX?

Erin: My question was “Do you have any specific analogies, descriptions or strategies that you use to convince companies or departments that UX is worth their time and investment?”

Don: That’s probably my most frequently asked question.

Erin: Oh no! I was trying to be your least frequently asked question. I was trying to be original. Sorry!

Don: No. When you work in universities you don’t think of that question. When you work in industry it comes up all the time. How do we demonstrate the value of what we do to higher level executives and I believe that designers are their own worst enemies. Let’s look at user centred design or HCD. The fundamental principle is to understand your customer. Understand who you are doing this for. So if you are working in a banking company and you are designing a new financial product, who is your customer?

Erin: Everyone pretty much.

Don: Who is your most important customer?

Erin: I guess stakeholders? I’m not sure.

Don: Your most important customer is your boss or your boss’ boss. If you are working in a design consultancy then your customer is your client. And the way I like to explain it to designers is that your job is to get your client or your boss promoted. So what we say is learn and understand the customer – what they need. So why don’t we try to understand what our client or your boss, not your boss’ boss – your boss probably already knows what you’re doing. It’s the boss or your boss, or their boss. In a company it’s mostly governed by making money, or profit. And profit is not evil. There is such a thing as evil profits, but if you don’t make money then you go out of business and it doesn’t matter how great you are. So what we have to do to convince management of our value, is to talk in a language that they understand. Which is profits, margins, decreased costs.

When you talk to the marketing people – when they say “we must add these three features to the product”, how do they convince management? They don’t talk much about the three features. They show a little spreadsheet and they say “See, we have this! Here is the increased sales and here is the increased profits?” How do they know? How do they know those numbers? And I say how do the marketing people know? And the answer is that they don’t know, they make it up. They lie. And we can make things up and lie just as well as they can. But it’s not quite that simple because the executives that you’re talking to, they’ve done this themselves. They know that you’re making up the numbers. They also know however, that there is no better way. But you have to make it up in a very logical, sensible way so that when they look them over it feels reasonable. But that’s the point. If you want to convince people in a company of your worth, you have to talk to people in the language of what really matters to them, which is increased sales, increased profits, decreased costs, less service calls. And you have to document that.

What you should not do is say “We do beautiful work and the customers tell us how much they love it.” Because what executives will say is “Of course you do, that’s why we hired you! Now goodbye, I have to go back to work.”

Luke: This is an interesting conversation. We are talking about the potential for businesses to – evil profits and the power of business for good. Donna asks if you are familiar with transition design, which is a design approach to wicked problems that proposes designless societal transition to more sustainable futures. It’s a field of HCD that is centred on the solving the wicked problems, like poverty and disease and stuff like that.

Don: Well, we come up with a new term every week so I haven’t heard of transactional [sic] design, no, but what I am doing is just that. I’m working on solving wicked problems and figuring out how we do that. We actually have a paper called Design X in the publication Sagji. It’s an excellent journal that comes from China. From a university in Shanghai. I wrote a very large article called Design X with a friend that teaches in the Netherlands  – about how one should approach these kinds of problems. We were inspired by a story from the Royal College of Art, the joint program they have with Imperial College that looked at the ambulance system in London. They found that it was all backwards. Ambulances stay at the hospital and then when there is a call they have to rush to where the injured person is and then rush them back to the hospital. Why don’t the ambulances be where the injured people are? They should be located throughout the city in places that we know there are likely to be accidents or injuries or difficulties and then they can pick them up and bring them back.

And we should redesign the ambulances with a better assortment of equipment and telecommunication gear so that physicians back at the hospital know exactly what is happening and either can give us advice on the way in or are ready for us when we arrive. This is a very long project. They redesigned ambulances, they redesigned the processes, they redid the hospitals and they won prizes for it. The mayor of London loved it. They gave a talk about this at our Design X conference in Shanghai and I said in the question time “Well that’s really exciting. Now it’s 10 years since that work was done so tell me how it was accepted by the city.” And the answer is that nothing ever happened. It was such a big problem. People loved it and people hated it. The unions hated it. Everyone rose up in opposition and nothing happened. That’s what led us to learn that you have to do things in really small steps.

The other thing that we are looking at is… we call it citizen signs or citizen involvement. There are people all around the world who when they have a problem they start solving it themselves. I was just in Lisbon last week and there is a wonderful group called Patient Innovations where they help patiences to help themselves. One of their favourite stories is about a little boy who lost part of his arm in an accident. People made fun of him and he had clumsy prosthetics but he realised that he could make his own prosthetics. With some help he redesigned an arm and 3D printed it and attached it to his arm and now he says that all his friends are jealous and wish they could have such colourful, wonderful arms. He can change it. He can change the arm like you change your clothes.

Another story is about diabetes. This story will take too long to tell you, but people with diabetes have problems where they always have to be measuring their blood sugar and then they have to decide if they take some insulin or have some candy. Some sugar. To get what’s called an artificial pancreas – a machine that does that for you automatically – we can do that but to receive permission to design and build that takes 5 or 6 years and as much as a billion dollars of clinical testing. The Federal Drug Administration in the US (and the equivalent in the EU or in Britain), well they’re very careful. But what happened was that a bunch of people said “Well hell, we can do this ourselves.” So they found a continuous glucose monitor and they took it apart and figured out how it worked and published it on the internet. You could take those signals and send them out on the internet and you could look and see what your blood level was on your cellphone. And someone else did the same with an insulin pump. And then a whole group of people got together and put together the software that couples the glucose meter with the insulin pump and boom – they’re wearing it. So 200 people now have built their own insulin pumps without the permission and they’re leading really great lives and the medical profession is learning a tremendous amount about this. And what I like about it is that one of the companies that made the continuous glucose monitor – when they discovered that this person had taken it apart and published how it works on the internet, their response was to hire him and say “That’s wonderful work, we want you to keep doing it.”

And I think the fact that people can do their own work is going to change design a lot. There are new, powerful design tools that don’t take a lot to learn to use. There are new, powerful making tools, like 3D printers and laser cutters. 3D printers are changing dramatically. They’re not just these little cheap things that dribble stuff on top. There is laser centering and there are other types of methods. So there are all sorts of fabrication methods that everyday people can use to do wonderful things, but usually they are very crude and they don’t work very well, but they show you the potential. And now the professional designers can come in and can work with the people and make things much more elegant and better, and maybe less expensive and you can learn how to manufacture it in large numbers as opposed to the small ones. But working together with people is a whole new way of doing things.

Luke: Fantastic. We’re about out of time, but one final question before you go Don. What design or psychology books are on your bedside table at the moment?

Don: None. I do a tremendous amount of reading. I’m reading history of technology. I’m really interested in that. Also, economic forecasts of what are we coming to? How is the world going to be changing? Most of my books are business models and I’m very concerned about the rise of artificial intelligence, which, if done wrong, is going to replace us. I am working with people to say look, these learning skills that are done by neural networks, they’re really good at finding something but we have no idea why, or how. We can’t ask them any questions. How do we change that? And so that’s what I’ve been reading about and learning about, and working with people who do it. And the Citizen Science Movement. There is a person at MIT – Eric von Hippel and he has a line of work that he calls Lead User Innovation, so I’ve been reading his works as well.

But I also travel a lot. Like I say, I was in Lisbon last week and prior to that in Madeira. There is this wonderful joint program between the University of Lisbon and Carnegie Mellon University and a few other universities. We have a group of people looking at interesting problems in island economy. Madeira is a really interesting place. It is a small island. It’s Portuguese but it’s really off the coast of Africa and there’s a wonderful migratory fish pattern and climate pattern that can be studied there which will actually influence the whole world. So that’s what I do in my spare time.

Luke: Wonderful. Let’s wrap things up there.

The post Transcript: A Chat with Don Norman appeared first on UX Mastery.


by Sarah Hawk via UX Mastery

A Practical Guide to Planning a MEAN Stack Application

A Practical Guide to Planning a MEAN Stack Application is an excerpt from Manning’s Getting MEAN with Mongo, Express, Angular, and Node, Second Edition. Getting MEAN, Second Edition is completely revised and updated to cover Angular 2, Node 6 and the latest mainstream release of JavaScript ES2015 (ES6). This Second Edition will walk you through how to develop web applications using this updated MEAN stack.

Planning a Real Application

For the purposes of this article, let’s imagine that we’re building a working application on the MEAN stack called Loc8r. Loc8r will list nearby places with WiFi where people can go and get some work done. It will also display facilities, opening times, a rating, and a location map for each place.

Planning the MEAN Stack Application at a High Level

The first step is to think about what screens we’ll need in our application. We’ll focus on the separate page views and the user journeys. We can do this at a high level, not concerning ourselves with the details of what’s on each page. It’s a good idea to sketch out this stage on a piece of paper or a whiteboard, as it helps to visualize the application in its entirety. It also helps with organizing the screens into collections and flows, serving as a good reference point when we build it. As there’s no data attached to the pages or application logic behind them, it’s easy to add and remove parts, change what’s displayed and where, and even change how many pages we want. The chances are that we won’t get it right the first time; the key is to start and iterate and improve until we’re happy with the separate pages and overall user flow.

Planning the Screens

Let’s think about Loc8r. As stated our aim is as follows:

Loc8r will list nearby places with WiFi where people can go and get some work done. It displays facilities, opening times, a rating, and a location map for each place. Visitors can to submit ratings and reviews.

From this we can get an idea about some of the screens we’re going to need:

  1. A screen that lists nearby places
  2. A screen that shows details about an individual place
  3. A screen for adding a review about a place

We’ll probably also want to tell visitors what Loc8r is for and why it exists, and we should add another screen to the list:

  1. A screen for “about us” information

Dividing the Screens into Collections

Next, we want to take the list of screens and collate them where they logically belong together. For example, the first three in the list are all dealing with locations. The About page doesn’t belong anywhere and it can go in a miscellaneous Others collection. Sketching this out brings us something like figure 1.

Planning a MEAN stack application: collections

Figure 1: Collate the separate screens for our application into logical collections.

Having a quick sketch like this is the first stage in planning, and we need to go through this stage before we can start thinking about architecture. This stage gives us a chance to look at the basic pages, and to also think about the flow. Figure 1, for example, shows a basic user journey in the Locations collection, going from the List page, to a Details page, and then onto the form to add a review.

Continue reading %A Practical Guide to Planning a MEAN Stack Application%


by Simon Holmes via SitePoint

Markvis – Make Visualization in Markdown

Markvis is a plugin to generate charts in markdown with few lines of code.


by via jQuery-Plugins.net RSS Feed