| 14 | |
| 15 | == Commonalities == |
| 16 | |
| 17 | * High level syntax |
| 18 | * Garbage collected |
| 19 | * Dynamic binding |
| 20 | * Blocks |
| 21 | * Productive languages |
| 22 | |
| 23 | == Differences == |
| 24 | |
| 25 | Cobra has: |
| 26 | * Optional static typing, which |
| 27 | * Adds additional error checking |
| 28 | * Improves performance |
| 29 | * But may by overly restrictive in some cases |
| 30 | * The choice is yours. |
| 31 | * First class support for unit tests |
| 32 | * Very lightweight syntax |
| 33 | * Informative `assert` statement |
| 34 | * A test is co-located with the method it tests for the benefits of |
| 35 | * Easier maintenance |
| 36 | * Documentation |
| 37 | * Less file switching during development |
| 38 | * First class support for contracts |
| 39 | * Lightweight syntax |
| 40 | * Contracts are inherited -- Supports OOP |
| 41 | * Can complement unit tests as a quality control feature |
| 42 | * Programs are compiled even when run in one shot with "cobra myprog.cobra" |
| 43 | * Performance can be up to hundreds of times faster than Ruby depending on the program. |
| 44 | * Native threads |
| 45 | * No thread simulations, interpreter lock, etc. |
| 46 | * Scale up to the number of cores in your machine. |
| 47 | * Strings |
| 48 | * Ruby has mutable strings and immutable symbols |
| 49 | * Cobra has immutable strings and mutable StringBuilder |