Inspiration

Developers should write clean code. But they're pressured to "take the easy way out" and code faster instead of better. This speeds up development in the short term, but ultimately hurts and slows development in the long term.

Developers need an incentive to write clean code.

Companies provide that incentive - if you write good code you get better offers. Schools provide that incentive - if you write good code you get better grades. But hobbyists, indie developers, startups, etc. don't have much incentive, other than the vague expectation that good code will help them in the long run. And because of this, a lot of hobbyists, indie developers, and startups write bad code.

What it does (what it would do)

A city-building game which provides an incentive to write good code. The better the code, the better the city.

The program analyses your code and tracks the types, documentation, dependencies etc.. Every time you create a new datatype, you get to create a new plot of land. Every time you create a new function, you get to place a new building on the land.

The land and buildings you get to place depend on the type/function's contents. You get more options of land/building types if you write better types/functions.

If your function doesn't have documentation or tests, you'll have to place a sewage plant or factory. If you're function has many dependencies, you need to place its building near the dependencies (for example, you can only place a function on land corresponding to its input/output types). If you're function has duplicate code and causes side-effects, it'll create pollution. And if you need to re-write the code, the land and buildings it represents will break and you'll have to rebuild them, as if you're city was hit by a natural disaster.

On the other hand, if your function has documentation and tests, you can place a nice-looking house or garden. If your function uses generic types you don't need to worry about placing it on the correct type of land. When you write more datatypes and functions, so you get to create more land and buildings in general. The "cleaner" your code according to the program, the "cleaner" your city and the more freedom you have to design it the way you want.

Also, the land and buildings generate "profit". The better the code, the more profit they generate. So if you're not very creative and don't care about the flexibility, you can instead focus on making your city as efficient as possible.

How I built it

I built the program in Swift for iOS. I tried to use good programming practices myself when writing the project - I planned out the "skeleton" of datatypes in YAML, and planned out a roadmap, before I wrote any code. But I still didn't write any tests or documentation...

Challenges I ran into

Unfortunately, I didn't actually get to make the project. I got through development enough so it almost works, I can show simple demos, and I have a good idea of how it would work.

Currently, I've implemented the "city-building" system, which would take the code analysis and use it to determine what buildings the user can place and how much "profit" they generate. I started the UI so the user can place buildings, but it's very incomplete. After I implement the ability to build a city from manually created analysis, I would create a program to actually generate the analyses data.

Accomplishments that I'm proud of

Still, I'm proud of starting this project. I'm proud that I planned it. And I'm proud that, so far, it seems like something which could be done.

What I learned

Cean code is very important, except in Hackathons. I maybe should've taken more shortcuts, or built something smaller.

What's next for ArchiTech

I'll probably work on this more because it's written well enough, and could actually be pretty cool.

Built With

Share this project:
×

Updates