Mais conteúdo relacionado Mais de melbournepatterns (20) Dynamic Vs Static1. Discussion
●
Topic: Dynamic vs Static Languages
●
What is this about?
●
What are they?
●
How are they different?
●
When to use?
●
What is this not about?
●
Arguing who's right or wrong
4. Dynamic Typing (1)
private static void printCapitalOf(Country country)
{
System.out.println(country.capitalCity());
}
public static void main(String[] args)
{
Country aus = new Australia();
Country jpn = new Japan();
printCapitalOf(aus);
printCapitalOf(jpn);
}
5. Dynamic Typing (2)
private static void printCapitalOf(Country country)
{
System.out.println(country.capitalCity());
}
public static void main(String[] args)
{
Country aus = new Australia();
Country jpn = new Japan();
printCapitalOf(aus);
printCapitalOf(jpn);
}
6. Dynamic Typing (3)
def printCapitalOf(country)
{
print(country.capitalCity())
}
def aus = new Australia();
def jpn = new Japan();
printCapitalOf(aus);
printCapitalOf(jpn);
8. Summary
Use the right tool for the job!