SlideShare a Scribd company logo
BEAR.Sunday Meetup #6
April 28 2018
The Birth of FormalBears
A new META for BEAR.Sunday applications
PHP Mentors
Atsuhiro Kubo @iteman
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
The Birth of FormalBears
1.META
2.FormalBears
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
久保敦啓 (Atsuhiro Kubo)
●
Framework / multi-paradigm / learn
architecture / DCI guy
●
A follower of James Coplien @jcoplien
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
久保敦啓 (Atsuhiro Kubo)
●
IT勉強宴会(2010〜)
http://www.benkyoenkai.org/
●
PHPメンターズ(2011〜)
http://phpmentors.jp/
●
マルチパラダイムデザイン読書会(2015〜)
https://github.com/phpmentors-jp/mpdosaka
●
DCI Tokyo(2017〜)
https://twitter.com/dcitokyo
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Open Source Software
●
PEAR/Net_UserAgent_Mobile(2003)
HTTP mobile user agent string parser
●
Piece_Unity(2006)
A Web application framework
●
Workfower(2015)
A BPMN 2.0 workfow engine for PHP
●
FormalBears(2018)
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
META
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
http://www.hearthstonetopdecks.com/hearthstones-best-standard-ladder-decks/
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
The metagame is the mix of
diferent decks that players bring
onto the ladder, that you can
expect to see. If you know what
decks players are bringing, your
deck can be especially good
against ‘the meta’.
― Ben Brode (was Game Director for Hearthstone)
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
META from Hearthstone
●
SPITEFUL DRUID
●
SPITEFUL PRIEST
●
QUEST ROGUE
●
QUEST WARRIOR
●
DRAGON PRIEST
●
BIG DRAGON DRUID
●
…
●
META + (HERO) CLASS
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
META for applications
●
(RESTful) BEAR.Sunday (vanilla)
●
RESTful Symfony
●
(Confgurable) Symfony (vanilla)
●
Confgurable BEAR.Sunday (FormalBears)
●
Workfower Symfony
●
Workfower BEAR.Sunday (FormalBears)
●
…
●
META + FRAMEWORK
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
FormalBears
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Confguration Language
# etc/config/modules/framework.yaml
framework:
imports:
- { app: 'OjizoTracking', host: tracking }
scheme_representations:
page: html
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Security Confguration
# etc/config/modules/security.yaml
security:
role_hierarchy:
ROLE_ADMIN: ROLE_USER
access_control:
page:
login:
path: ^/login
security: false
main:
path: ^/
security:
allowed_for:
- ROLE_USER
authentication_scheme: basic_authentication
app:
main:
path: ^/
security:
allowed_for:
- ROLE_USER
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Doctrine Integration
# etc/config/modules/doctrine_orm.yaml
doctrine_orm:
default_entity_manager: database_entity
entity_managers:
database_entity:
connection: ojizo
mappings:
- { named: ojizo_tracking.mapping_definition }
- { named: ojizo_console.mapping_definition }
proxy:
auto_generate: '%app_meta.development%'
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Doctrine Integration
// ...
class Foo extends ResourceObject
{
private $defaultEntityManager;
private $specifiedEntityManager;
/**
* @param EntityManagerInterface $defaultEntityManager
* @param EntityManagerInterface $specifiedEntityManager
*
* @Named("specifiedEntityManager=database_entity")
*/
public function __construct(EntityManagerInterface
$defaultEntityManager, EntityManagerInterface $specifiedEntityManager)
{
$this->defaultEntityManager = $defaultEntityManager;
$this->specifiedEntityManager = $specifiedEntityManager;
}
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Scheme Representations
# etc/config/modules/framework.yaml
framework:
# ...
scheme_representations:
page: html
app: json
# resource/Page/Foo.php
# ...
/**
* @Representation(“json”)
*/
class Foo extends ResourceObject
{
/**
* @Representation(“xml”)
*/
public function onGet(): ResourceObject
{
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Extension Points (Multiple Bindings)
namespace FormalBearsFrameworkModule;
// ...
class FrameworkModule extends AbstractConfigAwareModule
{
// ...
protected function configure()
{
$this->defineExtensionPoint(RenderInterface::class,
RendererProvider::class);
// ...
$this->registerExtension(RenderInterface::class,
JsonRenderer::class, 'json');
// ...
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Other Features
●
Workfower Integration
●
DCI Support
●
...
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
Currently work in progress…
Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
参考文献
●
Meta - Hearthstone Wiki
https://hearthstone.gamepedia.com/Meta
●
History Of The Meta (Oficial Hearthstone Video)
https://www.youtube.com/watch?v=WZm5v7EEdKQ

More Related Content

The Birth of FormalBears - A new META for BEAR.Sunday applications

  • 1. BEAR.Sunday Meetup #6 April 28 2018 The Birth of FormalBears A new META for BEAR.Sunday applications PHP Mentors Atsuhiro Kubo @iteman
  • 2. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. The Birth of FormalBears 1.META 2.FormalBears
  • 3. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. 久保敦啓 (Atsuhiro Kubo) ● Framework / multi-paradigm / learn architecture / DCI guy ● A follower of James Coplien @jcoplien
  • 4. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. 久保敦啓 (Atsuhiro Kubo) ● IT勉強宴会(2010〜) http://www.benkyoenkai.org/ ● PHPメンターズ(2011〜) http://phpmentors.jp/ ● マルチパラダイムデザイン読書会(2015〜) https://github.com/phpmentors-jp/mpdosaka ● DCI Tokyo(2017〜) https://twitter.com/dcitokyo
  • 5. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Open Source Software ● PEAR/Net_UserAgent_Mobile(2003) HTTP mobile user agent string parser ● Piece_Unity(2006) A Web application framework ● Workfower(2015) A BPMN 2.0 workfow engine for PHP ● FormalBears(2018)
  • 6. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved.
  • 7. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. META
  • 8. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. http://www.hearthstonetopdecks.com/hearthstones-best-standard-ladder-decks/
  • 9. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. The metagame is the mix of diferent decks that players bring onto the ladder, that you can expect to see. If you know what decks players are bringing, your deck can be especially good against ‘the meta’. ― Ben Brode (was Game Director for Hearthstone)
  • 10. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. META from Hearthstone ● SPITEFUL DRUID ● SPITEFUL PRIEST ● QUEST ROGUE ● QUEST WARRIOR ● DRAGON PRIEST ● BIG DRAGON DRUID ● … ● META + (HERO) CLASS
  • 11. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. META for applications ● (RESTful) BEAR.Sunday (vanilla) ● RESTful Symfony ● (Confgurable) Symfony (vanilla) ● Confgurable BEAR.Sunday (FormalBears) ● Workfower Symfony ● Workfower BEAR.Sunday (FormalBears) ● … ● META + FRAMEWORK
  • 12. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. FormalBears
  • 13. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Confguration Language # etc/config/modules/framework.yaml framework: imports: - { app: 'OjizoTracking', host: tracking } scheme_representations: page: html
  • 14. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Security Confguration # etc/config/modules/security.yaml security: role_hierarchy: ROLE_ADMIN: ROLE_USER access_control: page: login: path: ^/login security: false main: path: ^/ security: allowed_for: - ROLE_USER authentication_scheme: basic_authentication app: main: path: ^/ security: allowed_for: - ROLE_USER
  • 15. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Doctrine Integration # etc/config/modules/doctrine_orm.yaml doctrine_orm: default_entity_manager: database_entity entity_managers: database_entity: connection: ojizo mappings: - { named: ojizo_tracking.mapping_definition } - { named: ojizo_console.mapping_definition } proxy: auto_generate: '%app_meta.development%'
  • 16. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Doctrine Integration // ... class Foo extends ResourceObject { private $defaultEntityManager; private $specifiedEntityManager; /** * @param EntityManagerInterface $defaultEntityManager * @param EntityManagerInterface $specifiedEntityManager * * @Named("specifiedEntityManager=database_entity") */ public function __construct(EntityManagerInterface $defaultEntityManager, EntityManagerInterface $specifiedEntityManager) { $this->defaultEntityManager = $defaultEntityManager; $this->specifiedEntityManager = $specifiedEntityManager; }
  • 17. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Scheme Representations # etc/config/modules/framework.yaml framework: # ... scheme_representations: page: html app: json # resource/Page/Foo.php # ... /** * @Representation(“json”) */ class Foo extends ResourceObject { /** * @Representation(“xml”) */ public function onGet(): ResourceObject {
  • 18. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Extension Points (Multiple Bindings) namespace FormalBearsFrameworkModule; // ... class FrameworkModule extends AbstractConfigAwareModule { // ... protected function configure() { $this->defineExtensionPoint(RenderInterface::class, RendererProvider::class); // ... $this->registerExtension(RenderInterface::class, JsonRenderer::class, 'json'); // ...
  • 19. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Other Features ● Workfower Integration ● DCI Support ● ...
  • 20. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. Currently work in progress…
  • 21. Copyright (c) 2018 Atsuhiro Kubo <kubo@iteman.jp>, All rights reserved. 参考文献 ● Meta - Hearthstone Wiki https://hearthstone.gamepedia.com/Meta ● History Of The Meta (Oficial Hearthstone Video) https://www.youtube.com/watch?v=WZm5v7EEdKQ