- Apr 2024
-
blog.maximeheckel.com blog.maximeheckel.com
-
If you step two steps to the right, your sphere will appear to you two steps further to the left.
Fantastic intuition!
-
- Jul 2019
-
medium.com medium.com
-
Signal behaves like a TV feed which is a continuous stream of video and audio. At a given point of time, every observer of the TV feed sees the same sequence of the frame. The observer neither can inject any side effect to TV feed, nor it can start or stop the feed. The observer can only start and stop receiving the feed. On the other hand, SignalProducer is like an on demand streaming service like YouTube. Here, the observer can receive a stream of video and audio, but the sequence of the stream is different for a different observer. Here the observer can start and stop the feed
In a nutshell
-
-
-
It is a simple wrapper around a closure which takes Event as an input
Simple as that
-
- May 2019
-
aws-amplify.github.io aws-amplify.github.ioUsage1
-
Assume Biz Corp has decided to hire Dev Corp to develop its inventory management web portal, and Dev Corp is using the Amplify CLI to speed up the development process.
How to setup development with external team
-
- May 2018
-
developer.apple.com developer.apple.com
-
For example, a tab view controller saves the identity of the selected tab
Identity
-
-
developer.apple.com developer.apple.com
-
handleServerError(response)
We can have no error (no client error), but still have a server error!
-
handleClientError(error)
error is a client error!
-
- Aug 2017
-
developer.apple.com developer.apple.comWindows1
-
If this property is set when the window is loaded from its nib file, UIKit automatically installs the view from the associated view controller as the root view of the window.
In interface builder
-
-
developer.apple.com developer.apple.com
-
You can designate a portion of a view as stretchabl
Similar to UIImage
-
If you do change the content, you notify the system that the view has changed
Important
-
- Mar 2017
-
stackoverflow.com stackoverflow.com
-
Note, saving the child context applies the changes to the parent context. Saving the parent context persists the changes
-
- Jan 2017
-
confluence.atlassian.com confluence.atlassian.com
-
Can only use artifacts produced in a previous stage
Job
-
Defines the artifacts that the build will produce
Job
-
Collects the requirements of individual tasks in the job, so that these requirements can be matched with agent capabilities
Job
-
May produce artifacts that can be made available for use by a subsequent stage
Stage
-
Specifies how the build is triggered
How Plan works i Bamboo?
-
Processes a series of one or more stages that are run sequentially using the same repository
How Plan works i Bamboo?
-
- Dec 2016
-
developer.apple.com developer.apple.com
-
When Core Data fetches an object from a persistent store, it takes a snapshot of its state. A snapshot is a dictionary of an object’s persistent properties—typically all its attributes and the global IDs of any objects to which it has a to-one relationship
What is snapshot and when Core Data takes it?
-
- Nov 2016
-
softwareengineering.stackexchange.com softwareengineering.stackexchange.com
-
Groups of people, groups of programmers especially have conflict. As the team lead, your job in an agile team is more of a referee or catalyst than in waterfall. When the team has conflict about what design to use for example, you'll make sure that people have equal say and stick to arguing over merits. And you end up being the arbiter to which proposed solution the team will go with when the path is not clear.
-
-
stackoverflow.com stackoverflow.com
-
the context owns the queue and manages all the details for you
NSPrivateQueueConcurrencyType
orNSMainQueueConcurrencyType
-
performBlock: will add the block to the backing queue and schedule it to run on its own thread. The block will return immediately. You might use this for long persist operations to the backing store. performBlockAndWait: will also add the block to the backing queue and schedule it to run on its own thread. However, the block will not return until the block is finished executing. If you can't move on until you know whether the operation was successful, then this is your choice
performBlock
vsperformBlockAndWait
-
NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType. If you do anything with one of these context types, such as setting the persistent store or saving changes, you do it in a block
When to use
performBlock
-
-
mitpress.mit.edu mitpress.mit.edu
-
This alternative ``fully expand and then reduce'' evaluation method is known as normal-order evaluation
Expand until you have basic operations
-
(define (<name> <formal parameters>) <body>)
General form of a procedure definition
-
-
-
It's an internal class used to implement the operators, that receives events and processes them.
What is Sink?
Tags
Annotators
URL
-
-
github.com github.com
-
If one sequence terminates with error, then all of the dependent sequences will terminate with error
How errors work in RxSwift
-
-
misko.hevery.com misko.hevery.com
-
Initially, with all dependencies hardcoded we have (–> = “depends on”): UserRepository –> Database LoginPage –> UserRepository After refactoring halfway: UserRepository –> Database LoginPage –> UserRepository AND Database This situation is worse as the number of dependencies has increased for LoginPage. After completing DI we are back to: UserRepository –> Database LoginPage –> UserRepository but the dependencies are now parameterised rather than hardcoded
Good comment
-
LoginPage needs UserRepository. So instead of trying to construct the UserRepository itself, it should simply ask for the UserRepository in the constructor. The fact that UserRepository needs a reference to Database is not a concern of the LoginPage. Neither is it a concern of LoginPage how to construct a UserRepository
-
The issue here is that LoginPage is breaking a the Law of Demeter. LoginPage is asking for the Database even though it itself has no need for the Database
LoginPage(Database db) { repo = new UserRepository(db); }
-
Guess what?! The myth is correct! The code as it stands now is hard to maintain and understand
LoginPage(Database db) { repo = new UserRepository(db); }
-
-
github.com github.com
-
The request() method returns a Cancellable, which has only one public function, cancel(), which you can use to cancel the request
About
MoyaProvider
-
But don't forget to keep a reference for it in property. If it gets deallocated you'll see -999 "cancelled" error on response.
About
MoyaProvider
-
-
github.com github.com
-
Providers map Targets to Endpoints, then map Endpoints to actual network requests
-
-
music.stackexchange.com music.stackexchange.com
-
Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. Join them; it
Notka
-
-
developer.apple.com developer.apple.com
-
Because the content view underlaps the navigation bar in iOS 7 and later, you must consider that space when designing your view controller content
-
You access a navigation controller’s view from its view property. This view incorporates the navigation bar, an optional toolbar, and the content view corresponding to the topmost view controller
Image below
-
-
misko.hevery.com misko.hevery.com
-
In short we move all of the new operators to a factory. We group all of the objects of similar lifetime into a single factory
The image above is worth to study (as the all article)
-
-
misko.hevery.com misko.hevery.com
-
By the way, if the point about being global is that a Singleton can be included in any file and used anywhere in a program, that’s true, but only bad if misused. The Singleton pattern is not inherently bad, it’s misuse is bad
Singletons are not inherently bad
-
If the singleton class is a “utility class” (e.g. FileUtils, StringUtils, etc.), and has no state, then I would say it’s okay. Such a class is not a liar, per se, because there is no unexpected state change or dependency
Constants are ok
-
ccp.chargePurchaseToCard(100,c); since the logic for purchasing will be in the processor anyway, not the card. Cards don’t process anything
Good remark
-
-
misko.hevery.com misko.hevery.com
-
You shouldn’t really be doing this anyway – you should have composed them, possibly via IOC.
Anybody can explain some more his idea?
-
-
misko.hevery.com misko.hevery.com
-
Technically, CheckEngine() might not be violating the principle, but because the explicit dependency is on Context, CheckEngine is really hiding the second-tier reference. That is: this.engine is really this.context.getEngine() even if the dot notation is obfuscating that fact. In that sense, I think Misko is absolutely right, even if it’s more subtle than an explicit violation
Misko is right that passing Context to constructor violates LoD
-
It would violate it if you stored a reference to context instead of the engine and later on referred tried to get the engine. For example: class Mechanic { Context context; Mechanic(Context context) { this.context = context; } bool CheckEngine() { return this.context.getEngine().checkIfBusted(); } }
Violation of LoD takes place if you store a context object and then look op the dependency you really need in the method
-
Every time I have to write a test I have to create a graph of objects (the haystack) which no one really needs or cares for, and into this haystack I have to carefully place the needles (the real object of interests) so that the code under test can go and look for them. I have to create the Context just so when I construct the Mechanic it can reach in the Context and get what it realy needs, the Engine. But context is never something which is easy to create. Since context is a kitchen sink which knows just about everything else, its constructor is usually scary. So most of the time I can’t even instantiate Mechanic, not to mention run any tests on it. The testing game is over before it even started
Consequence of Law of Demeter breaking
-
-
misko.hevery.com misko.hevery.com
-
They can’t be mocked, and are a smell that you’ve got a method without a home
About statics
-
-
blog.ploeh.dk blog.ploeh.dk
-
he allows a concrete implementation of an interface to change the design of the OrderProcessor class
Original Question:
Anybody knows what does it mean? I cannot see a design change in OrderProcessor...
Update:
It's about "concrete implementation of the IOrderShipper interface"
The remark @ploeh makes later in the article is that you can solve the problem without need to change high level design (
OrderProcessor
) to fix low level issue (OrderShipper
) -
His point seems to be that Constructor Injection can be an anti-pattern if applied too much, particularly if a consumer doesn't need a particular dependency in the majority of cases
In short it goes like this, so
shipper
is only used ifisValid
:public OrderProcessor(IOrderValidator validator, IOrderShipper shipper)
{
_validator = validator;
_shipper = shipper;
}
`
public SuccessResult Process(Order order)`{
bool isValid = _validator.Validate(order);
if (isValid)
{
_shipper.Ship(order);
}
``
return CreateStatus(isValid);
}
-
Consumers of OrderProcessor have no static type information to warn them that they need to configure the OrderShipperFactory.CreationClosure static member - a completely unrelated type. This may technically work, but creates a very developer-unfriendly API. IntelliSense isn't going to be of much help here, because when you want to create an instance of OrderProcessor, it's not going to remind you that you need to statically configure OrderShipperFactory first. Enter lots of run-time exceptions.
-
-
www.joelonsoftware.com www.joelonsoftware.com
-
The law of leaky abstractions means that whenever somebody comes up with a wizzy new code-generation tool that is supposed to make us all ever-so-efficient, you hear a lot of people saying "learn how to do it manually first, then use the wizzy tool to save time."
-
A famous example of this is that some SQL servers are dramatically faster if you specify "where a=b and b=c and a=c" than if you only specify "where a=b and b=c" even though the result set is the same. You're not supposed to have to care about the procedure, only the specification. But sometimes the abstraction leaks and causes horrible performance
Abstraction leaks may exhibit as performance issues
-
TCP attempts to provide a complete abstraction of an underlying unreliable network, but sometimes, the network leaks through the abstraction and you feel the things that the abstraction can't quite protect you from. This is but one example of what I've dubbed the Law of Leaky Abstractions
-
- Oct 2016
-
www.objc.io www.objc.io
-
We shouldn’t actually care what the target/action values on the bar button item are. We should only care about what happens when it is pressed. Everything else is an implementation detail
"We should only care about what happens when it is pressed"
We have target and action in the button, so we don't need to test for target and action separately, we can simulate the behavior instead. We shouldnt cae about implementation details
-
- Sep 2016
-
-
Some edge cases may not be obvious until you actually try to implement the features
-
-
-
With the protocol interface abstraction layer, you can swap out ParseService and swap in FirebaseService or MyBackend. This also means you can swap in TestService to run your unit tests
Benefit to unit testing
-
It allows us to specify a variable to be of an abstract (protocol) type, instead of a concrete (class) type
What is polymorphism?
-
Since we also map PFObject to User inside ParseService, PFObject doesn’t spill outside of ParseService
Low level details are encapsulated in low level implementation
-
class ParseService: Service{ func fetchUserWithID(id: String, completionHandler: (user: User?, error: ErrorType?) -> ()) { // Do the fetch // Map PFObject into User // Ivoke completionHandler }}
Low level ParseService relies on Service abstraction. It works with low level data but as a response it maps it to the high level User class
-
protocol Service{ func fetchUserWithID(id: String, completionHandler: (user: User?, error: ErrorType?) -> ())} class Sender{ private var service: Service init(s: Service) { service = s } func doSomething() { service.fetchUserWithID("asdf") { (user: User?, error: ErrorType?) in // Do something with the user } }}
High level Sender class relies on high level Service abstraction
-
Because if you were to change the SpecificReceiver, you would have to change the Sender as well.
Why depending on low level policy is bad?
-
What is the Dependency Inversion Principle? Why is it important? What makes it possible? What benefits does it provide?
-
In this improved version, not only is the SpecificReceiver swappable, you can also reuse SpecificReceiver in a totally different app with different business logic. Both the high level Sender and low level SpecificReceiver can be reused
Inverting dependency makes both components reusable - one by removing it's concrete dependency (tight coupling), another by conforming to reusable protocol
-
-
clean-swift.com clean-swift.com
-
I found refactoring table view data source and delegate methods from the view controller into a separate class is just not that useful. It requires more effort. Reusability is overrated. A super generic, reusable data source class is harder to get it right and maintain
Conclusion
-
-
clean-swift.com clean-swift.com
-
Isolate the dependencies Write the test first Draw the boundary Implement the logic
TDD steps
-
- Jan 2016
-
www.timusic.net www.timusic.net
-
The simplest way is to just have the melody played down the octave. This gives you a strong sound. It’s not the most interesting, but it works
Baritone sax
-
Notice that the interval between the top two voices is always a 3rd or 4th. This is ideal and correct for the traditional style. It is possible to have a major 2nd in this range but I try to avoid it; in the next octave up it may even sound like a mistake. A minor second should be totally avoided if you are going for a traditional sound
-
This is where you maintain the shape of the chord (same interval structure) and move it under the melody
Technique called "Planing"
-
It is handy to think of the 9th as replacing the tonic.
-
There is another option to consider when harmonizing the tonic chords. If you wish to create a really traditional sound, a la Glenn Miller, then use 6th chords instead of major 7th chords
-
There are a few ways to harmonize this F, but the most common method (and my default) is to use a ‘passing diminished.’
-