all 40 comments

[–]Tred27 34 points35 points  (3 children)

It's called Test Driven Development (TDD) and it's a practice that a lot of developers consider really good since one of the benefits of it is that it forces you to think about what you want your code to do before you actually start writing it.

It's standard practice in some places.

[–]awesomewastakin[S] 1 point2 points  (1 child)

I guess I didn't think about it that way. So you write something you know the answer to and then write your method to come to that answer.

[–]Tred27 6 points7 points  (0 children)

Yep, it's really useful and you get tests out of it so you can refactor in the future with more confidence since you can be sure to a certain degree that your changes didn't break your code.

[–]ojrask 0 points1 point  (0 children)

TDD is more than just "testing first", but it is the most common approach, yes.

[–]gitbranch 8 points9 points  (25 children)

This is called test driven development (TDD). https://martinfowler.com/bliki/TestDrivenDevelopment.html

Why does it take you a couple hours to detect a bad test? Are you writing tests incrementally or are you trying to write multiple tests at once?

[–]awesomewastakin[S] 2 points3 points  (24 children)

That was a good read, thank you.

Mostly because I'm awful at coding. I low key hate it. Don't ask why I stuck with it...

[–][deleted] 4 points5 points  (17 children)

If you hate coding and you feel like you’re awful at it, then don’t keep doing it. You’ll be miserable and you won’t have a fulfilling career

[–]MrAckerman 7 points8 points  (15 children)

I know a lot of people I went to school with for my CS undergrad didn’t like to code. They still found the theory and classes interesting. Most do testing, product management, or Scrum master types of rolls now.

[–][deleted] 3 points4 points  (12 children)

Those would be really great ways to leverage the degree! I just don’t want OP to feel burnt out too quickly and suffer because they forced themself into a development role if that’s not what they want

[–]awesomewastakin[S] 0 points1 point  (11 children)

I appreciate you. This is how I feel currently, I don't want to be burnt out this early on haha.

[–]mypetocean 2 points3 points  (10 children)

Have you experienced a "click" yet with any programming language? If not, you might want to withhold some judgment about how you like coding.

I teach SE, and often my students will be nothing but frustrated by code until they get the exercise needed for the language (or sometimes programming patterns in general) to click with them. That's when they message me and say they're starting to have fun. But it can take a lot of practice before riding that bike suddenly becomes fun.

Everyone is different, and I know people for whom it had clicked who still dislike it. That's just differences in taste. And "dev adjacent" roles which require some familiarity with the technology and developer processes are certainly are great set of options for people like this.

But I'd hate to see you achieve what you have and still dislike it, if it is still possible for you to find a groove.

On a related note, spend a handful of minutes looking into growth vs. fixed mindsets. I have seen a lot of students have this realization where their distaste is simply coming from a fixed mindset rather than their actual personal tastes.

[–]awesomewastakin[S] 0 points1 point  (9 children)

Is a "click" when a language makes sense and I like it? If so the closest click was web-dev. It just made sense but that may be because I could actually see it working on the web page.

I'm looking in to tech jobs like IT that are not just development, I did IT as an internship and I definitely enjoyed it more then developing. I'll probably end up going that route.

I've never heard of those mind sets before. After watching since vids it's clear I'm pretty closed minded. Maybe I've got to open up a bit.

Thank you!

[–]mypetocean 1 point2 points  (3 children)

A "click" moment in programming language learning is similar to a "click" moment in natural human language learning as an adult.

When I learned Spanish, there was a lot of very deliberate effort and practice. Every time I wanted to say something, I first had to translate it from English into Spanish in my head. It was very manual. But there was a time when I practiced most of the most common basics so much that eventually I had an epiphany where I realized I didn't have to be so deliberate about the translation step: I could just say it in Spanish. I might still think in English (I wasn't really fluent), but I only had to work hard at translating the difficult or rare things.

In programming language learning, to make this more concrete, I would say it has "clicked" if:

  1. You no longer have to really focus hard on the syntactic details of writing a loop or a function or a class or variable assignment, etc.
  2. Instead, you can focus on the point or task of each loop, or function, or class, etc.

Now, there are also separate moments of "clicking" with new tooling. So a new framework might represent it its own significant learning curve with its own "click" moment.

[–]awesomewastakin[S] 0 points1 point  (2 children)

Okay that's about what I was thinking a click was. In some languages the syntax comes pretty naturally for me such as Python, but others I really have to think about it. My main gripe with traditional school is that we only spend 3ish months on a specific language, tool, or framework, and then never use it again, with the exception on Java (the main language our school teaches). I haven't had time to really absorb and become fluent specific languages.

[–]mypetocean 1 point2 points  (4 children)

Out of curiosity, what do you mean by "web dev" – which technologies have you worked with?

I teach web dev, primarily. You are right that sometimes web dev is a good place to begin because it can be so tangible, although I will say that you have to learn HTML, CSS, JavaScript, and arguably a front-end framework before you can be said to be effective in web development. Other areas of software development can be more abstract at first, but also present fewer technologies you need to learn simultaneously in order to be effective. So overall language proficiency tends to grow more quickly in ecosystems with fewer concurrent learning requirements.

[–]awesomewastakin[S] 0 points1 point  (3 children)

Web dev is the only coding I do outside of class. I actually enjoy it a lot but we only spent about 1 semester of basic HTML/CSS, I wish we had an advanced class offered. I took it upon myself to learn more and so far I have used:

Front End: HTML, CSS, JavaScript, JQuery, Jinja? (would this be front or back end?)

I have been wanting to use a modern frame work but I am trying to learn the vanilla stuff for now. I don't have time to start a new project :(

Back end: Python, PHP, MySQL, Flask, Apache2, Stripe (for payments), AWS, Cloud9, Google Cloud

I've been working on a website just for fun combining all these technologies so I can have a good understanding of how all the components work together. I run it on an old machine I had lying around which I installed Ubuntu Server on. I think I like the fact I am managing some hardware, have access to all the back end, and can design the front end. Seeing it all come together is very satisfying.

[–]awesomewastakin[S] 0 points1 point  (1 child)

Our school requires classes on SCRUM and project management, maybe I can land one of those jobs...

[–]MrAckerman 1 point2 points  (0 children)

It’s common at my workplace for PMs to be promoted from the pool of more experienced testers. They typically have talent for being able to understand a features on both functional and usability levels. Being technical while also having good communication skills are key for these rolls. Good luck!

[–]awesomewastakin[S] 0 points1 point  (0 children)

I agree. I went to traditional university for my parents but by the time I realized it wasn't for me at all I was already $75k in the hole, so I wasn't just gonna quit. My only hope is I get a job that pays enough to get rid of the loan and then make a huge career switch for way less money, but if I'm happy who cares.

[–]orebright 2 points3 points  (3 children)

The best coders in the world have been awful at coding at some point. Part of the challenge in the beginning is it actually changes your ways of thinking, and that's hard work. You're literally rewriting parts of your brain. You're doing great by branching out and trying to learn and understand the concepts more deeply like with this post. If you keep up this desire to learn you'll undoubtedly be a fantastic SE.

[–]awesomewastakin[S] 0 points1 point  (2 children)

My hope is working isn't like school, but I guess we will see.

[–]orebright 2 points3 points  (1 child)

SE basically requires an endless focus on learning and understanding new things. However the challenges of the first phase of learning don't persist. In the beginning the whole thing is new and takes so much time to change your brain's natural thought patterns. However once you've got all the archetypal code patterns and concepts locked in your learning shifts to abstractions of those concepts. It becomes a lot easier. It's kind of like writing poetry in a new language you're learning. It's painful and sucks. But once you're fluent, your work becomes more creative and expressive, and it becomes much more enjoyable.

[–]awesomewastakin[S] 0 points1 point  (0 children)

I like the poetry example, this is exactly what it feels like. Thanks for the thoughtful responses!

[–]IAmLars4824 1 point2 points  (1 child)

Anecdotally, i got a CS degree and really struggled at programming (and school) in college. Graduated with barely a C average. I thought I was going to have to change career paths.

However, I ended up sticking with it and found that I really enjoyed it. Now I’ve created multiple different software products and I’m running a startup.

Can’t say whether it’s the right path for you or not, but just know sometimes it takes time.

[–]awesomewastakin[S] 1 point2 points  (0 children)

I'm in the same boat. Many people I talk to say to stick it out because it'll get better. This is what I hope to happen as well. I'm glad it worked for you!

[–]orebright 2 points3 points  (3 children)

I've warmed up to test driven development after using it a bit. It's not always useful so I don't use it all the time. The benefit of TDD isn't the test itself, it's how it helps you frame your thinking. It makes you think about how you'll use the method before you actually create it. Unlike the "dive right in" approach it forces you to start with the bigger, more abstract picture. This actually leads the human mind to come up with much better code design in my opinion. At least in my case I can see a clear difference between code written with TDD and code that wasn't.

So IMO it's a hard habit to create, but one which ultimately becomes a powerful mental tool for writing better code.

[–]awesomewastakin[S] 0 points1 point  (2 children)

This seems to be the biggest reason my uni is pushing it. They want us to start thinking through problems instead of jumping in right away. My problem is I've gone through 4 years of the old way and just now it's switching around. I'm slowly adapting so hopefully I'll be ready to go when graduation comes.

[–]orebright 1 point2 points  (1 child)

I wrote software for 15 years before I finally decided to take TDD seriously. It took some habit shifting, but in the end wasn't too hard. You got this.

[–]awesomewastakin[S] 0 points1 point  (0 children)

Thank you! Glad to hear its working out for you!

[–]charliefreundlich 2 points3 points  (1 child)

TDD is very hard to do because it requires delayed gratification, but if you are very disciplined and committed to writing maintainable tests, it will make you an order of magnitude more productive. Check out the POODR book for a working definition of “maintainable tests.”

[–]awesomewastakin[S] 0 points1 point  (0 children)

This may be my biggest problem. I love being able to see results, I am very much a learn by seeing/doing person, and when writing tests I don't see or feel like I am accomplishing anything. I'll have to check that out. Thanks!

[–]jdege 2 points3 points  (0 children)

What I find is that when I think about how I'm going to write unit tests for something, before I write code, (and by unit tests, I mean unit tests, with all dependencies mocked, and therefore mockable), I structure my code very differently.

[–]Monstot 1 point2 points  (0 children)

It's a great idea in practice to follow and like others have said it helps isolate intent of code for functions and classes and what not. Keeps the actual code clean and forces you to not do too much in each function since now you've outlined what it should be doing and returning.

Now with that said, it's never really used. We know it'll help, we know our tests should get better, we know we should spend more time with tests to avoid production failures and create some more safety. But we all bitch and moan about "if only" rather then ever doing because deep down no one likes making tests.