Testing & dev methodology for clean / elegant / maintainable code?

testing
#1

I’m still pretty new to programming. My last project was in Python. The debugging phase ended up taking way too long because of some key mistakes made early in the project.

I want to make sure the next project in Elixir doesn’t make similar mistakes.

So for seasoned Devs, I ask you…

  1. What is the testing & dev methodology you recommend for generating clean / elegant / maintainable code with the least amount of debugging time?

  2. And what are the tools you’re using to create / test that code in Elixir?

Thanks

Emily

2 Likes
#2
  1. For clean code, I would recommend building your app as umbrella app.
  2. For testing application, for me at least, default tests are still good and there was no need to extend something more than that.
3 Likes
#3

Check out this thread Emily:

2 Likes
#4

for testing, hard to tell. I would say, write test for your module.

About dev methodology … I have a couple advice.

  1. Sit down and think about your problem. Pick one end result and go back along the technological solution. You want to write down all the pieces you need. Begin large and fairly generic, then break them into smaller more precise pieces. This is your initial architecture. It will change during the course of your project.

  2. Do not spend a lot of time into what the pieces will do. But try to decide how they will interact with each other. What type of data need to be passed? Does data goes in only one way ? Things like that. By doing that, you are defining the limits of your parts. It can be a fairly small part, it may end up being just a couple of functions.

  3. But the nice thing about this definition of a contract between your parts mean that you can quickly change how one part work, or test and debug that part alone without impacting the rest of your project. This should help you save time.

  4. Another advice : it is ok to delete stuff. It is ok to have “bad” code at the beginning or even at the end if the thing works. Keep in mind that a good motto is “Make it work, then make it pretty, then, if needed, make it fast”.

  5. My best advice for maintainable code is taken from the talk i link at the end of that post. And it is “if you cannot delete it and rewrite it all in a better way in a small amount of time, then you need to define more boundaries”.

Also feel free to ask more questions, or to join other community discussion tools :slight_smile: Asking questions is probably the best way to both learn, and make less mistakes :slight_smile:

4 Likes
#5

And this one: BDD / TDD criticized

2 Likes
#6

The mission to write first project in new stack in clean manner is mission impossible. From the experience, I can tell you that this should be a throw away project.

Switching stacks, learning new conventions and making the thing beautiful and maintainable at the same time - all in first project. I never saw that. You can pick one or two from above, but you’d need to be super human to do all.

1 Like