68 Matching Annotations
  1. Jul 2019
    1. 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

  2. May 2019
  3. aws-amplify.github.io aws-amplify.github.io
    1. 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

  4. May 2018
  5. Aug 2017
  6. developer.apple.com developer.apple.com
    1. 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

    1. You can designate a portion of a view as stretchabl

      Similar to UIImage

    2. If you do change the content, you notify the system that the view has changed

      Important

  7. Mar 2017
  8. Jan 2017
    1. Can only use artifacts produced in a previous stage

      Job

    2. Defines the artifacts that the build will produce

      Job

    3. Collects the requirements of individual tasks in the job, so that these requirements can be matched with agent capabilities

      Job

    4. May produce artifacts that can be made available for use by a subsequent stage

      Stage

    5. Specifies how the build is triggered

      How Plan works i Bamboo?

    6. Processes a series of one or more stages that are run sequentially using the same repository

      How Plan works i Bamboo?

  9. Dec 2016
    1. 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?

  10. Nov 2016
    1. 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.
    1. the context owns the queue and manages all the details for you

      NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType

    2. 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 vs performBlockAndWait

    3. 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

    1. This alternative ``fully expand and then reduce'' evaluation method is known as normal-order evaluation

      Expand until you have basic operations

    2. (define (<name> <formal parameters>) <body>)

      General form of a procedure definition

    1. It's an internal class used to implement the operators, that receives events and processes them.

      What is Sink?

    1. If one sequence terminates with error, then all of the dependent sequences will terminate with error

      How errors work in RxSwift

    1. 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

    2. 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
    3. 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); }

    4. 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); }

    1. The request() method returns a Cancellable, which has only one public function, cancel(), which you can use to cancel the request

      About MoyaProvider

    2. 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

    1. Providers map Targets to Endpoints, then map Endpoints to actual network requests
    1. Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. Join them; it

      Notka

    1. Because the content view underlaps the navigation bar in iOS 7 and later, you must consider that space when designing your view controller content
    2. 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

    1. 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)

    1. 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

    2. 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

    3. 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

    1. 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

    2. 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

    3. 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

    1. They can’t be mocked, and are a smell that you’ve got a method without a home

      About statics

    1. 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)

    2. 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 if isValid:

      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);

      }

    3. 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.
    1. 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."
    2. 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

    3. 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
  11. Oct 2016
    1. 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

  12. Sep 2016
    1. 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

    2. It allows us to specify a variable to be of an abstract (protocol) type, instead of a concrete (class) type

      What is polymorphism?

    3. 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

    4. 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

    5. 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

    6. 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?

    7. What is the Dependency Inversion Principle? Why is it important? What makes it possible? What benefits does it provide?
    8. 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

    1. 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

  13. Jan 2016
    1. 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

    2. 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
    3. This is where you maintain the shape of the chord (same interval structure) and move it under the melody

      Technique called "Planing"

    4. It is handy to think of the 9th as replacing the tonic.
    5. 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
    6. There are a few ways to harmonize this F, but the most common method (and my default) is to use a ‘passing diminished.’