- Qual é o problema com a arquitetura das aplicações atuais?
- Um projeto, na maioria das vezes, é começado pequeno, por uma pessoa e sem saber como será a sua evolução.
- Pode acontecer de novas pessoas entrarem no projeto e não conhecerem as regras que guiam a aplicação.
- Um dos princípios de organização é o MVC ou Model View Controller.
- No MVC a regra de negócio fica na Model, os templates na View e a mediação é feita pelo Controller.
- O MVC não é suficiente para manter uma aplicação com código compreensível durante muito tempo.
- A ideia de utilizar MVC veio de frameworks e a maioria das aplicações estão acopladas de alguma maneira a frameworks.
- Um projeto é iniciado normalmente (1) escolhendo um framework, (2) instalando um esqueleto, (3) removendo códigos de demonstração, (
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:bytebank/models/transfer.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:scoped_model/scoped_model.dart'; | |
import '../../main.dart'; | |
import 'file:///C:/git/mo20-082020/bytebank/lib/screens/transfer/form.dart'; | |
class TransfersList extends StatefulWidget { | |
final List<Transfer> _transfers = List(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(BytebankApp()); | |
class BytebankApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
// theme: ThemeData.dark(), | |
home: Scaffold( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
o = { user: { name: 'foo' } } | |
const get = key => obj => obj[key] | |
const set = key => (x, obj) => | |
({ ...obj, [key]: x }) | |
Identity = v => ({ | |
value: v, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.App.Mixfile do | |
use Mix.Project | |
def project do | |
[ | |
app: :my_app, | |
version: "0.0.1-#{sha()}", | |
... | |
def sha do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Worker = ({ databaseURL, store }) => { | |
return ( | |
<> | |
<Job name='chargeUsers' run={() => chargeUsers()} store={store}> | |
<SyncedCron at='every day at 8am' /> | |
</Job> | |
<Job name='sendEmail' run={sendgridSendEmail} store={store} /> | |
</> | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random, signal,sys, time, heapq | |
from PIL import Image | |
size = int(sys.argv[1]) | |
maze = [[0 for x in range (size)] for y in range(size)] #maze é glob | |
def createmaze(): | |
image = Image.new("RGB", (size,size)) | |
pixels = image.load() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -x | |
set -e | |
MNTDIR="/tmp/lol/mnt" | |
TEMPDISK="/tmp/lol/tempdisk.img" | |
SSH_PUB="${HOME}/.ssh/id_rsa_$(hostname).pub" | |
TEMPDIR="$(dirname "${TEMPDISK}")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fibsync = n => { | |
if (n <= 1) return 1 | |
const a = fibsync(n - 1) | |
const b = fibsync(n - 2) | |
return a + b | |
} | |
const fibasync = async (n) => { | |
if (n <= 1) return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Functor<T> { | |
map<U>(f: (x: T) => U): Functor<U> | |
} | |
class Box<T> implements Functor<T> { | |
value: T | |
constructor(x: T) { | |
this.value = x | |
} | |
map<U>(f: (x: T) => U): Box<U> { |
NewerOlder