Getting Shit Done takes a combination of language proficiency, problem solving and google-fu. Take a look at how I briefly review topics of interest to help everyday programmers gain quick, simple and fundamental knowledge of not-so-simple programming concepts.
Saturday, December 30, 2017
URN vs. URL vs. URI
Uniform Resource Identifier (URI) : Identify
A compact sequence of characters that identifies an abstract or physical resource. Encompases URN's and URL's (and URC's).
Example: "www.google.com", "http://www.google.com"
Uniform Resource Name (URN) : Uniquely name
Identifies a resource by a unique and persistent name, but doesn't necessarily tell you how to locate it on the internet.
Example use: 6e8bc430-9c3a-11d9-9669-0800200c9a66
Unified Resource Location (URL) : Locate
Contains information about how to fetch a resource from its location. URL's ALWAYS start with protocol.
Example use: "http://www.google.com"
So if I want to be 'that guy', when should I use which terms?
Use URI's for most everything, unless it includes protocol ('http://', 'https://', etc) in which case be 'that guy' and say it's a URL.
Source
https://danielmiessler.com/study/url-uri/
Dependency Injection
What is Dependency Injection
A technique of 'injecting' the dependencies of one object to another.
Not this:
function a (id) {
return b(id)
.then(response => response.json())
}
This:
function a (b, id) {
return b(id)
.then(response => response.json())
}
Why use it?
It's more explicit, easier to read and provides more control over inputs...but practically speaking, it makes it easier to unit test your application. There are many ways to test your application, but dependency injection is a common and well known design pattern, well documented and can (for the most part) be implemented with most languages.
Source
https://www.youtube.com/watch?v=0X1Ns2NRfks
https://en.wikipedia.org/wiki/Dependency_injection
A technique of 'injecting' the dependencies of one object to another.
Not this:
function a (id) {
return b(id)
.then(response => response.json())
}
This:
function a (b, id) {
return b(id)
.then(response => response.json())
}
Why use it?
It's more explicit, easier to read and provides more control over inputs...but practically speaking, it makes it easier to unit test your application. There are many ways to test your application, but dependency injection is a common and well known design pattern, well documented and can (for the most part) be implemented with most languages.
Source
https://www.youtube.com/watch?v=0X1Ns2NRfks
https://en.wikipedia.org/wiki/Dependency_injection
Subscribe to:
Posts (Atom)