11 Matching Annotations
  1. Nov 2019
    1. Instead of using the empty_data option – which is only called if we create an object, but not if we update it – we will implement a custom data mapper. Symfony's data mappers are responsible for mapping the data of a form to its fields and back. For our MoneyType, Symfony's default data mapper will call the following methods when we display a form with an existing Money instance: $form->get('amount')->setData($money->getAmount()); $form->get('currency')->setData($money->getCurrency()); The properties of the Money are copied to the form simply by calling the appropriate getters. When we submit the form, the data mapper inverts that behavior: $money->setAmount($form->get('amount')->getData()); $money->setCurrency($form->get('currency')->getData()); That's where the data mapper fails. The setters setAmount() and setCurrency() don't exist. To create a custom data mapper we need to implement DataMapperInterface. Let's look at this interface: namespace Symfony\Component\Form; interface DataMapperInterface { /** * Maps properties of some data to a list of forms. * * @param mixed $data Structured data. * @param FormInterface[] $forms A list of {@link FormInterface} instances. */ public function mapDataToForms($data, $forms); /** * Maps the data of a list of forms into the properties of some data. * * @param FormInterface[] $forms A list of {@link FormInterface} instances. * @param mixed $data Structured data. */ public function mapFormsToData($forms, &$data); } These methods correspond to the two previous code blocks. The method mapDataToForms() calls setData() on all passed forms by reading the passed $data. Conversely, mapFormsToData() updates $data by reading the data of the passed forms.

      This is so important & useful, when working in DDD & immutability, where setters are avoided.

  2. Oct 2019
    1. This can become messy when you have a lot of configurations in your Entity. Another issue is that your annotations are coupled to your source code. Your database implementations details, or any other configurations are coupled to your domain object. This goes against the guidelines of clean code. Your domain object (Entity) should only have one reason to change.

      Thank you for saying that loud.

  3. Sep 2019
    1. è un’umanità alla deriva che contrasta con la cosmesi del nostro mondo, che ha rimosso la malattia, la povertà e la morte come ombre di un passato oscuro, di una preistoria della civiltà. Tutti i veri medici che si ribellano e accettano la sfida dell’accoglienza non fanno soltanto una scelta etica di giustizia, ma scelgono di riconoscere la loro stessa condizione di fragilità, di precarietà nei naufraghi, che portano la cruda verità della condizione umana, che non può essere oscurata dalle mille luci del finto benessere occidentale. Ciò che di inquietante portano con loro i migranti è quello straniero residente, come sostiene Donatella DI Cesare, che ciascuno di noi è, e che scuote dalle fondamenta l’illusione che ciascuno di noi coltiva, di possedere qualcosa e di essere realmente abitante di un luogo in maniera permanente e stabile.

      😲

    2. Bartolo e Rieux sono dei revoltés, dei rivoltosi, e nella natura del revolté non c’è soltanto la resistenza ma qualcosa di più. E’ lo stesso Camus che chiarisce la figura del revolté in uno dei suoi saggi più controversi. L’uomo in rivolta è l’uomo che dice No, lo schiavo che si ribella, il proletario che non vuole più essere sfruttato, l’uomo che non accetta di essere umiliato. Ma nel momento in cui l’uomo pronuncia il No, perché un confine è stato superato, accede a un piano di vita superiore, perché l’uomo in rivolta si rivolta per combattere un’ingiustizia, ma lo fa in nome di un valore che trascende la sua persona. L’uomo in rivolta combatte per l’uomo e per la sua dignità e da quel momento la sua battaglia diventa collettiva, ed è per questo che Camus può riscrivere la formula cartesiana penso dunque sono, in mi rivolto dunque siamo.

      Epica!

  4. Aug 2019
    1. so there won’t be a blinking bunny, at least not yet, let’s train our bunny to blink on command by mixing stimuli ( the tone and the air puff)

      Is it just that how we all learn and evolve? 😲

  5. Jul 2019
    1. our sum of squares is 41.187941.187941.1879

      Just considering the Y, and not the X. Calculating the residuals from the average/mean Y.

    1. However using the proposed syntax it's easy to see how big components could have logic broken up into smaller reusable pieces, moved into separate files if necessary, leaving you with small, easy-to-understand functions and components.

      Benefits are evident and good, imho. A big improvement in code organization and separation of concerns.

      Just, I think the new syntax suffers from the loss of, as you said, that easy-to-understand-separation-by-type, that is appealing and clearer to newcomers and people that deal with pretty simple components. The component code is divided in three different sections (State, Computed, Methods) that are easy to scroll and to keep conceptually segregated.

      That's one appealing aspect for beginners, helping them to grab the main concepts and organization of Vue. Also helps giving some simpler view to who not too confident with JS and its patterns. With this "separation by function" the beginner is more disoriented since has to import state & computed as functions to place in specific points. Places that they need to know/remember, rather than just filling up the three object provided in module.exports (and I suppose there are packages that build a basic .vue template for you; maybe vue-cli itself too, that people get used to blindly use).

      So in the end the new syntax gives in my opinion a lot more power in modelling, but requires to accept some compromises with the somehow more verbose syntax (const everywhere; return & export providing private/public but necessarily longer to write) and with the slightly higher shadiness of its main concepts.

      Still, a good & efficient & clear documentation, as it was on Vuejs.org until today, will for sure easily compensate to these drawbacks and bring the most out of this new -more OOP- approach. For me also class could be use here, but I like trying to stay compatible using the prototypical approach (maybe also less overhead? Dunno, I'm not so deeply in the JS world).

      I am actually pretty curious to see how it is gonna evolve. And I am glad I didn't engage with Vue too much yet... 😜

  6. Feb 2019
    1. It also provides the interviewer with an opportunity to feel smart and validate that “they’ve still got it” and that they aren’t themselves an imposter, by critically examining the work of an outsider who wants in.

      That's the point. How can one interviewer assume to be more competent than the interviewed or assume to be able to judge objectively some other's work?

      Interviewers should start from a place of humbleness and understand they can't spot a person quickly.

      Getting to know and trust somebody is a process that requires time; that's true for any kind of human relationship. It can just start with faith, plus a trial period. There's no shortcut that can keep the same judging reliability of a judgment during time.

  7. Nov 2018
    1. code-smell1: In OO, the use of instanceof ( typeof) is a code smell, use double dispatch.

      The use of double dispatch is a code smell; goto code-smell1