Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/phillvancejr/stars

Star Field graphical app in C++ and Ada to compare them
https://github.com/phillvancejr/stars

ada cpp field graphical star stars

Last synced: about 2 months ago
JSON representation

Star Field graphical app in C++ and Ada to compare them

Awesome Lists containing this project

README

        

## Star Field C++ & Ada
Simple graphical starfield program comparing C++ and Ada, ports of [Benny's Software Rendering Tutorial #4](https://www.youtube.com/watch?v=v7nrzvd9A5c&list=PLEETnX-uPtBUbVOok816vTl1K9vV1GgH5&index=5) video. This is my third project comparing Ada and C++ and Ada is pretty interesting, but ultimately as has been the case before the C++ version is shorter and simpler. I think maybe for concurrency Ada would be better because Ada's tasking system is very nice, however if you want to write highly concurrent software Go is probably the best option. The things that are cool about Ada like super strong typing and tasking aren't actaully that helpful for graphical applications which is what I'm primarily interested in making. Additionally Ada allows you to define arrays using custom define ranges, however most of the checks on the range (and most of Ada's useful checks) are at runtime, which means you may not see the problem until the app is/has been running, which is strange for a statically typed language

#### added Nim
I also added a Nim version as it is influenced by Ada and has some of its features like ranges. However Nim's ranges don't work the same way Ada's do with exceptions. I'm not sure exactly why but when I wrote the same code in Nim usings Bounds types to constrain the x and y positions, when an invalid value was assigned the except handler wasn't called in the same way Ada's was and resulted in stars flying in from the sides. Because the bounded range type didn't work the same way in Nim, I just ported the simpler C++ version in Nim, manually checking the bounds. The Nim version ended up being shorter than the C++ one, however its pretty much the same so there is no reason for me to use Nim since I am happy with C++ and Nim doesn't bring anything new in terms of wasy of programming unlike Ada.

![](demo.gif)