Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Smalltalker Works

How Smalltalker Works

第71回Smalltalk勉強会(ビアバッシュ)の資料。Smalltalk三昧だった1年。Smalltalkに何か還元します。

http://www.smalltalk-users.jp/Home/gao-zhi/dai71kaismalltalkbenkyoukai

https://atnd.org/events/60115

newapplesho

December 25, 2014
Tweet

More Decks by newapplesho

Other Decks in Programming

Transcript

  1. H o w S m a l l t a

    l k e r W o r k s S m a l l t a l k ࡾ ດ ͩ ͬ ͨ Ұ ೥ ˏnewapplesho
  2. 2 0 1 4 ೥ 5 ݄ h t t

    p : / / w w w. s o r a b i t o . c o m SORABITOͷ্ཱͪ͛
  3. ։ ൃ ݴ ޠ 5% 5% 14% 5% 29% 43%

    Smalltalk Ruby Java PHP Perl FileMaker
  4. 2 0 1 4 ೥ 7 ݄ ࢼ ݧ ӡ

    ༻ 2 0 1 4 ೥ 9 ݄ ਖ਼ ࣜ ެ ։ h t t p s : / / m i k a t a c l o u d . c o m Serviceͷ্ཱͪ͛
  5. L O V E I T O R L E

    AV E I T. I L O V E S M A L LTA L K . SmalltalkΛ࠷΋׆༻ͨ͠೥
  6. ࠷ ΋ ษ ڧ ձ ͷ ৘ ใ Λ ࠷

    ΋ ׆ ༻ ͯ͠ ͍ Δ ਓ ͔ ΋ ͓ ͦ Β ͘ ɾ ɾ ɾ http://www.smalltalk-users.jp
  7. α ʔ Ϗ ε ঺ հ Ͱ શ ࠃ Ί

    ͙ Γ Smalltalkͷ͓͔͛Ͱ৭ʑ͋Γ·ͨ͠
  8. ε ς Ω ͳ ͱ ͜ ΖͰ ൃ ද ͠

    · ͠ ͨ ɻ I L O V E S M A L LTA L K Smalltalkͷ͓͔͛Ͱ৭ʑ͋Γ·ͨ͠
  9. ઒ ʹ ౤ ͛Β Ε ͨ Γ ͠ · ͠

    ͨ Smalltalkͷ͓͔͛Ͱ৭ʑ͋Γ·ͨ͠
  10. ύΠ Λ ͳ ͛Β Ε ͨ Γ ͠ · ͠

    ͨ Smalltalkͷ͓͔͛Ͱ৭ʑ͋Γ·ͨ͠
  11. ͦ Μ ͳ S m a l l t a

    l k ʹ ؐ ݩ ͠ ͨ ͍ ͍ ͪ ͝ Ҏ ֎ Ͱ ৄ͘͠͸ୈ42ճSmalltalkษڧձ
  12. S m a l l t a l k A

    d v e n t C a l e n d a r 2 0 1 4 ʹ ௅ ઓ • 10೔෼୲౰͠·ͨ͠ • ਖ਼௚େมͰͨ͠ • ౤ߘ஗Εͯ͢Έ·ͤΜ http://qiita.com/advent-calendar/2014/smalltalk
  13. A W S S D K f o r S

    m a l l t a l k M E R RY C H R I S T M A S
  14. ࠓ ճ ެ ։ ͢ Δ ΋ ͷ ࢓ࣄΛ࡞੒ͨ͠΋ͷ͸αʔϏεʹಛԽͤͯ͞࡞ͬͯ͠·ͬ ͨΊɺۀ຿֎ͷ࣌ؒΛ࢖ͬͯ੾Γग़ͯ͠Ұൠެ։Ͱ͖Δ

    ΋ͷΛ४උ͠·ͨ͠ʢ͍ͣΕ͸SDKશͯΛެ։͠· ͢ʣɻ https://mikatacloud.com/ AWS SDK for Smalltalk
  15. A W S S D K f o r S

    m a l l t a l k M E R RY C H R I S T M A S DynamoDB
  16. N o S Q L ͬͯ ૉ ఢ ͩ ͚

    Ͳ ɾ ɾ ɾ • গ਺ϝϯόʔͰӡ༻͢Δͷ͸େมͩͬͨΓ͢Δ • ྫ͑͹Mongo Replica SetsΛߏ੒͢Δʹ͸࠷௿֤DC κʔϯʹ̍୆ͣͭɺArbiter̍୆ɺܭ̏୆Ϛγϯ͕ඞཁ • ϝϞϦ΍σΟεΫI/Oʹࠨӈ͞ΕͨΓ͢Δ
  17. A m a z o n D y n a

    m o D B • ΩʔɾόϦϡʔܕͷNoSQLσʔλϕʔεαʔϏε • ؅ཧෆཁͰ৴པੑ͕ߴ͍σʔλϕʔε • σʔληϯλʔؒͷࣗಈಉظϨϓϦέʔγϣϯ • ߴ଎ͳΞΫηε͕Մೳ • SSDΛར༻͍ͯ͠Δ • ετϨʔδ༰ྔ੍ݶ͕ͳ͍ • ϓϩϏδϣϯεϧʔϓοτ͚ͩΛࢦఆ͢Δ͚ͩ • APIʢSDKʣܦ༝Ͱར༻Ͱ͖Δ
  18. ࠓ ճ ެ ։ ͢ Δ ΋ ͷ • AWSͷ΄ͱΜͲͷαʔϏεʹΞΫηε͢ΔͨΊͷ

    Signature V4 • DynamoDBͷ઀ଓΫϥΠΞϯτʢ௿Ϩϕϧ APIɺΤ ϥʔॲཧ͸ະ࣮૷ʣ • DynamoDBͷ؆қΞΫηε൛ʢະ׬੒ʣ
  19. α ϙʔ τ ͢ Δ σ ʔ λ ܕ (

    S U P P O R T S D ATA T Y P E S ) AWS SDK for SmalltalkͰରԠ͢Δσʔλʔܕ͸ҎԼ * εΧϥʔσʔλܕ - จࣈྻɺ਺஋ * ଟ஋ܕ - จࣈྻηοτɺ਺஋ηοτɻ Amazon DynamoDB for Smalltalk supports the following data types: * Scalar types – Number, String. * Multi-valued types – String Set, Number Set. ͦͷଞ΋࣮૷த
  20. ͩ ͬͯ ଞ ʹ΍ Ε Δ ͜ ͱ ͕ ͳ

    ͍ ͔ Β Ͷ ͱ͍͏͜ͱͰ DynamoDB࢖͏͔͠ͳ͍ʂ
  21. D y n a m o D B L o

    c a l http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ Tools.DynamoDBLocal.html ͱΓ͋͑ͣࢼ͍ͨ͠ਓ͸DynamoDB Local
  22. H o w t o i n s t a

    l l The AWS SDK for Pharo Smalltalk enables Smalltalk developers to easily work with Amazon Web Services with Amazon DynamoDB. You can get started in minutes using Metacello and FileTree. ͝ΊΜͳ͍͞ɻؒʹ߹͍·ͤΜͰͨ͠ɻޙ΄Ͳ ผ్ผͷࢿྉΛ༻ҙ͠·͢
  23. C re a t e Ta b l e s

    dy := DynamoDBRawClient new. operationName := #CreateTable. requestBody := '{ "AttributeDefinitions": [ { "AttributeName": "id", "AttributeType": "S"} ], "TableName": "dmodeltest1", "KeySchema": [ { "AttributeName": "id", "KeyType": "HASH"}], "ProvisionedThroughput": { "ReadCapacityUnits": 10, "WriteCapacityUnits": 10} }'. resp := dy operationName: operationName entityContents: requestBody. Used DynamoDB Local Sample
  24. L i s t Ta b l e s dy

    := DynamoDBRawClient new. dy awsConfig accessKeyId:'YOURACCESSKEY'. dy awsConfig secretKey:'YOURSECRETKEY'. dy awsConfig useSSL: false. operationName := #ListTables. requestBody := '{}'. resp := dy operationName: operationName entityContents: requestBody. Json readFrom: (resp contents) readStream. Used DynamoDB Local Sample
  25. P u t I t e m ( J a

    v a ) client = new AmazonDynamoDBClient(credentials); String tableName = "dmodeltest1"; Map<String, AttributeValue> item = new HashMap<String, AttributeValue>(); item.put("Id", new AttributeValue().withS("babe2d60c42a45fca9120d1c111d8844")); PutItemRequest putItemRequest = new PutItemRequest() .withTableName(tableName) .withItem(item); PutItemResult result = client.putItem(putItemRequest);
  26. P u t I t e m dy := DynamoDBRawClient

    new. uuid := UUID new primMakeUUID hex. operationName := 'PutItem'. json := JsonObject new at:'TableName' put:'dmodeltest1';yourself. d:= DModelTest1 new. d id:uuid. mapper := DynamoDBMapper new. c := (mapper convertItem:d). json at:'Item' put: c . requestBody := json asJsonString . resp := dy operationName: operationName entityContents: requestBody. Used DynamoDB Local Sample
  27. G e t I t e m operationName := 'GetItem'.

    json := JsonObject new at:'TableName' put:'dmodeltest1';yourself. d:= DModelTest1 new. d id:uuid. mapper := DynamoDBMapper new. c := (mapper convertItem:d). json at:'Key' put: c . requestBody := json asJsonString . resp := dy operationName: operationName entityContents: requestBody. result := Json readFrom: (resp contents) readStream. mapper loadItem: (result at:'Item') . Used DynamoDB Local Sample
  28. Q u e r y operationName := 'Query'. json :=

    JsonObject new at:'TableName' put:'dmodeltest1';yourself. d:= DModelTest1 new. d data at:#id put:uuid. mapper := DynamoDBMapper new. c := (mapper convertItem:d). c := JsonObject new at: (c keys first) put: ((JsonObject new at:'AttributeValueList' put: (Array with: c anyOne); yourself ) at:'ComparisonOperator' put:'EQ'; yourself); yourself. json at:'KeyConditions' put: c . json at:'Select' put: 'ALL_ATTRIBUTES'. requestBody := json asJsonString . resp := dy operationName: operationName entityContents: requestBody. result := Json readFrom: (resp contents) readStream. (result at:'Count') > 0 ifTrue:[ ^ (result at:'Items') collect:[:v | mapper loadItem:v ]. ] . Used DynamoDB Local Sample
  29. D e l e t e I t e m

    operationName := 'DeleteItem'. json := JsonObject new at:'TableName' put:'dmodeltest1';yourself. d:= DModelTest1 new. d id:uuid. mapper := DynamoDBMapper new. c := (mapper convertItem:d). json at:'Key' put: c . requestBody := json asJsonString. resp := dy operationName: operationName entityContents: requestBody. result := Json readFrom: (resp contents) readStream. Used DynamoDB Local Sample
  30. D e l e t e Ta b l e

    operationName := #DeleteTable. requestBody := JsonObject new at:'TableName' put:'dmodeltest1'; asJsonString . resp := dy operationName: operationName entityContents: requestBody. Json readFrom: (resp contents) readStream. Used DynamoDB Local Sample
  31. P u t I t e m uuid := UUID

    new primMakeUUID hex. d:= DModelTest1 new. d id: uuid. d save. Used DynamoDB Local Sample DynamoDBModelΛܧঝͨ͠ModelΛ࡞੒ DynamoDBModelͷDictionaryͷΠϯελϯεม਺dataʹ ΞΫηεͯ͠ModelΛ࡞੒͢Δ͚ͩ
  32. G e t I t e m "ݕࡧΩʔΛ࡞੒" keyData :=

    DModelTest1 new. keyData id: uuid. result := d getItem: keyData. Used DynamoDB Local Sample
  33. ࠓ ޙ • DynamoDBվྑ൛ • S3 • EC2 • Elastic

    Transcoder 2015೥ެ։༧ఆ ͨͩ͠ࢲͷϙέοτϚωʔͱ ૬ஊͩͬͨΓ͢Δ Amazon EC2 DynamoDB Amazon Elastic Transcoder S3 Bucket
  34. དྷ ೥ ͷ ։ ൃ ݴ ޠ 20% 15% 5%

    15% 45% Smalltalk Ruby Java PHP Perl FileMaker Scala