TECH |
Engadget Japanese |
机でもありバッグでもある。テレワークに最適な「デスクエニウェア」|ベストバイ2021 |
https://japanese.engadget.com/deskanywhere-bestbuy-230043629.html
|
関連 |
2021-12-25 23:00:43 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 年始に新調するもの 「靴下」や「タオル」を抑えた圧倒的1位は? |
https://www.itmedia.co.jp/business/articles/2112/26/news014.html
|
itmedia |
2021-12-26 08:15:00 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
vs code で goのdebugを実行するとエラーになる |
https://teratail.com/questions/375576?rss=all
|
vscodeでgoのdebugを実行するとエラーになる環境osnbspnbspwindowsnbsphomegonbspnbspgonbspのscriptをvisualnbspstudionbspcodeでデバッグ実行しようとすると下記のようなエラーになります。 |
2021-12-26 08:41:25 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Python2年生 P62 LESSON7 画像ファイルを読み込んで保存 ができません |
https://teratail.com/questions/375575?rss=all
|
コードをテキストどおり以下のとおり入力してrunを実行しても画像ファイルが書き出されません。 |
2021-12-26 08:10:27 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Ruby 3.1で発生する「プロを目指す人のためのRuby入門 改訂2版」との差異について |
https://qiita.com/jnchito/items/bbabb21a1ce3f4799b52
|
RubygtxygtypxgtpygtRubyで導入されたその他の新機能についてこの記事では「プロを目指す人のためのRuby入門改訂版」と関連が深い変更点をリストアップしましたが、Rubyではこのほかにも様々な新機能があります。 |
2021-12-26 08:20:03 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【SAP-C01試験対策】デプロイ方式のまとめ |
https://qiita.com/jellyk405/items/59359626a6c2f9438583
|
【SAPC試験対策】デプロイ方式のまとめはじめにAWSのデプロイ方式について公式ドキュメントを参考に学習したので内容をまとめます。 |
2021-12-26 08:41:43 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
dockerでTypeScriptの環境構築 |
https://qiita.com/samurai_se/items/3f5c88719902124b6546
|
初めてのTypeScriptファイルを作成このフォルダは好みでいいと思います。 |
2021-12-26 08:39:32 |
海外TECH |
DEV Community |
The Brain**** interpreter I made is on Sololearn. |
https://dev.to/baenencalin/the-brain-interpreter-i-made-is-on-sololearn-15of
|
The Brain interpreter I made is on Sololearn The Brain interpreter I made in my other post How to make a simple Brainf k interpreter using ParseJS CW Light profanity is now on SoloLearn for anyone and everyone to play around with Even on mobile Here s the URL |
2021-12-25 23:24:32 |
海外TECH |
DEV Community |
Elixir SOLID Principles - Examples |
https://dev.to/lgdev07/elixir-solid-principles-examples-2db5
|
Elixir SOLID Principles ExamplesBuilding an application can be hard depending on how you do it as our career passes and the knowledge we get more information and good practices we use for creating and improving the software we maintain Some good practices are in SOLID Principles a mnemonic acronym for five design principles intended to make software designs more understandable flexible and maintainable Is good to be clear SOLID has been created with Object Oriented Programming in mind so we are adapting to Elixir a functional programming language we are going to see that the benefits do not depend on the programming paradigm Example Animals moduleTo explain better how we use the solid principles on elixir I am gonna create a module and for each principle we refactor it the module is called Animals and is responsible to create an animal adding some customization getting and sending a picture of it The example below is the first version defmodule Animals do def create mammal do create an animal of type mammal def create carnivorous do create an animal of type carnivorous def add hat animal do add a hat to the animal def add shirt animal do add a hat to the animal def get picture animal do get picture from the animal def send picture email picture email do send the picture to email def send picture whatsapp picture number do send the picture to whatsappendiex gt ok animal Animals create mammal iex gt ok animal customized animal gt Animals add hat gt Animals add shirt iex gt ok animal customized gt Animals get picture gt Animals send picture email email example com if you noticed that this is not maintainable or scalable you are right in the first moment that could work but responsibilities are mixed in a single module and are confusing The first principle that we are going to use is Single Responsibility modules must be separated by their context Single Responsibility Principle There should never be more than one reason for a class to change defmodule Animals do def create mammal do create an animal of type mammal def create carnivorous do create an animal of type carnivorousenddefmodule Animals Clothes do def add hat animal do add a hat to the animal def add shirt animal do add a hat to the animalenddefmodule Animals Pictures do def get picture animal do get picture from the animal def send picture email picture email do send the picture to email def send picture whatsapp picture number do send the picture to whatsappendiex gt ok animal Animals create mammal iex gt ok animal customized animal gt Animals Clothes add hat gt Animals Clothes add shirt iex gt ok animal customized gt Animals Pictures get picture gt Animals Pictures send picture email email example com Now is more clear what each module does but if we get the Animals Pictures and try to add one more sending method it starts to be a little repetitive and we break Open Closed principle because we are modifying an entity Open Closed Principle Software entities should be open for extension but closed for modification FROMdefmodule Animals Pictures do def get picture animal do get picture from the animal def send picture email picture email do send the picture to email def send picture whatsapp picture number do send the picture to whatsappend TOdefmodule Animals Pictures do def get animal do get picture from the animal def send picture data email do send the picture to email def send picture data whats do send the picture to whatsappendiex gt ok animal Animals create mammal iex gt ok animal customized animal gt Animals Clothes add hat gt Animals Clothes add shirt iex gt ok animal customized gt Animals Pictures get gt Animals Pictures send email example com email In that way we just create a new function send without modifying the entity Another thing that can be improved is the module that creates the animals currently it has a general proposal which is not extensible because we are changing the interface at each modification sometimes is better to have a specific module that uses the same interface Interface segregation principle Many client specific interfaces are better than one general purpose interface FROMdefmodule Animals do def create mammal do create an animal of type mammal def create carnivorous do create an animal of type carnivorousend TOdefmodule Animals Mammal do def create do create an animal of type mammalenddefmodule Animals Carnivorous do def create do create an animal of type carnivorousendiex gt ok animal Animals Mammal create iex gt ok animal customized animal gt Animals Clothes add hat gt Animals Clothes add shirt iex gt ok animal customized gt Animals Pictures get gt Animals Pictures send email example com email Now they are using the same interface and it is easy to extend each specific module without changing the interface that creates a new animal The Liskov principle states that a superclass object should be replaceable with a subclass object without breaking the functionality of the software and makes heavy use of inheritance and polymorphism but for a functional programming language we have to deal with it in another way elixir has behaviours so all the modules that use the defined behaviour must implement their functions Liskov substitution principle Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it FROMdefmodule Animals Clothes do def add hat animal do add a hat to the animal def add shirt animal do add a shit to the animalend TOdefmodule Animals Animal do type t type String t name String t defstruct w type name aenddefmodule Animals Clothes Clothing do callback add Animals Animal t Animals Animal tenddefmodule Animals Clothes Hat do behaviour Animals Clothes Clothing def add animal do add a hat to the animalenddefmodule Animals Clothes Shirt do behaviour Animals Clothes Clothing def add animal do add a shirt to the animalenddefmodule Animals Clothes do spec apply Animals Animal t String t def apply animal hat do Animals Clothes Hat add animal def apply animal shirt do Animals Clothes Shirt add animal endiex gt ok animal Animals Mammal create iex gt ok animal customized animal gt Animals Clothes apply hat gt gt Animals Clothes apply shirt iex gt ok animal customized gt Animals Pictures get gt Animals Pictures send email example com email We have defined the Animals Clothes Clothing behaviour and for instance the Animals Clothes Hat must use the add callback so in this way we guarantee that all the modules that implement it have the same action without breaking the functionality Now if we look at the Animals Clothes module we are explicitly declaring witch module has to be used depending on function parameters this is incorrect accordingly with Dependency inversion principle the correct way to fix this is to abstract the apply function to receive a module in its arguments and use the function of that module because we have the type definition Dependency inversion principle Depend upon abstractions not concretions FROMdefmodule Animals Clothes Clothing do callback add Animals Animal t Animals Animal tenddefmodule Animals Clothes do spec apply Animals Animal t String t def apply animal hat do Animals Clothes Hat add animal def apply animal shirt do Animals Clothes Shirt add animal end TOdefmodule Animals Clothes Clothing do type t module callback add Animals Animal t Animals Animal tenddefmodule Animals Clothes do spec apply Animals Animal t Animals Clothes Clothing t def apply animal clothing do clothing add animal endiex gt ok animal Animals Mammal create iex gt ok animal customized animal gt Animals Clothes apply Animals Clothes Hat gt gt Animals Clothes apply Animals Clothes Shirt iex gt ok animal customized gt Animals Pictures get gt Animals Pictures send email example com email With the type definition we can abstract the inner implementation to depend on the module itself and we know what the module does because of the behaviour that it uses If we look for the difference between the first implementation and the final result it is more verbose but much more readable maintainable and extensible FROMdefmodule Animals do def create mammal do create an animal of type lion def create carnivorous do create an animal of type dog def add hat animal do add a hat to the animal def add shirt animal do add a hat to the animal def get picture animal do get picture from the animal def send picture email picture email do send the picture to email def send picture whatsapp picture number do send the picture to whatsappend TOdefmodule Animals Mammal do def create do create an animal of type mammalenddefmodule Animals Carnivorous do def create do create an animal of type carnivorousenddefmodule Animals Pictures do def get animal do get picture from the animal def send picture data email do send the picture to email def send picture data whats do send the picture to whatsappenddefmodule Animals Animal do type t type String t name String t defstruct w type name aenddefmodule Animals Clothes Clothing do type t module callback add Animals Animal t Animals Animal tenddefmodule Animals Clothes Hat do behaviour Animals Clothes Clothing def add animal do add a hat to the animalenddefmodule Animals Clothes Shirt do behaviour Animals Clothes Clothing def add animal do add a shirt to the animalenddefmodule Animals Clothes do spec apply Animals Animal t Animals Clothes Clothing t def apply animal clothing do clothing add animal endiex gt ok animal Animals Mammal create iex gt ok animal customized animal gt Animals Clothes apply Animals Clothes Hat gt gt Animals Clothes apply Animals Clothes Shirt iex gt ok animal customized gt Animals Pictures get gt Animals Pictures send email example com email I appreciate everyone who has read through here if you guys have anything to add please leave a comment This post was inspired by andreichernykh solid elixir accba |
2021-12-25 23:11:36 |
Apple |
AppleInsider - Frontpage News |
Year-end Apple deals: 2021 MacBook Pro sale, MacBook Air $200 off, Mac mini $150 off, more |
https://appleinsider.com/articles/21/12/25/year-end-apple-deals-2021-macbook-pro-sale-macbook-air-200-off-mac-mini-150-off-more?utm_medium=rss
|
Year end Apple deals MacBook Pro sale MacBook Air off Mac mini off moreAfter Christmas deals are hitting Apple products ーand even new inch and inch MacBook Pros are heavily discounted Save up to on retail and upgraded configs with our exclusive promo code plus up to off AppleCare End of year Mac dealsBusiness owners students and home users alike can save hundreds of dollars on a new Mac with coupon code APINSIDER when shopping through this cost saving activation link using these step by step instructions Read more |
2021-12-25 23:26:28 |
海外TECH |
CodeProject Latest Articles |
Fixes to LINQ to SQL Explicit Client Evaluation which Causes Poor Performance |
https://www.codeproject.com/Tips/5319859/Fixes-to-LINQ-to-SQL-Explicit-Client-Evaluation-wh
|
client |
2021-12-25 23:48:00 |
ビジネス |
東洋経済オンライン |
34歳で死に直面「大久保利通」襲った想定外の事態 実務能力の高さをいかんなく発揮した矢先の恐怖 | 近代日本を創造したリアリスト 大久保利通の正体 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/478948?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
中心人物 |
2021-12-26 08:30:00 |
コメント
コメントを投稿