Live data from Hacker News

Ask HN: I have a mental block designing software. Time to quit?

news.ycombinator.com

31–40 of 89 posts

Re: Ask HN: I have a mental block designing software. Time to quit?

#31
If the code is tested then refactoring the ideas contained within is the way to go. Do the smallest refactorings possible. Even well-respected programmers who've authored tons of books and given talks do not sit down and 1-shot a program. Elegant programs are the result of refining and designing.

The earlier in the development process you get to the refactoring and isolating minimal testable components, the less of a tangle you have between components to refactor; it's a lot like the wire tangles we're all so familiar with). This not only means less refactoring, but it also means that the existing code is easier to understand.

The tests are code. Treat the tests just like the rest of the code. I prefer test-first but if you want to pull your cart in front of your horse then go for it.

If the code is not tested I'd recommend testing it. There are really only 3 options to go from untested code base to tested code base: - Try to put tests under existing code (often inefficient) - Refactor the system incrementally as time goes on and features are added and bugs are fixed (slow process but over time test coverage grows) - Throw it out and start over (ouch but... greenfield; if you do this you should _NOT_ add any new features to the live/production system or you'll end up in a rat race between the two forever)

Also if you're able to take any time away (preferably measured in days) the fresh perspective might help too. Sometimes that little bit of total separation is enough to come back and read a method name and wonder why the hell it's even in that particular class. This scenario could be an early warning for burnout too, take care of yourself!

Re: Ask HN: I have a mental block designing software. Time to quit?

#32
I recently hit a wall like this as well after designing many apps and enterprise systems.

It was a problem that seemed simple at first, but I just kept banging my head against it. I did exactly what some people described here, switched to a functional language, but that didn't help. I started doubting myself.

I'm though it now, and I like the solution, although it could be better. Here are some points that I've picked up along the way:

- Remind yourself that you are not only generating value when you actually write code. When you take a walk and think about the problem, draw stuff on paper and so on, this is still work. You are still doing exactly your job.

- This gets hard when coming up with a design takes longer than usual. It's likely that you have run into a complex problem without knowing it. Endurance & patience is key here.

- Attack from different angles, don't consider the time wasted if you try something and then end up throwing it away, you will have learned something, even if it just eliminating one possible design option.

After you are through it, you might end up cherishing the experience.

Re: Ask HN: I have a mental block designing software. Time to quit?

#33
post #23

Everyone's style is going to be differ on the high-level stuff - and you are surely well beyond the point where any random blog post blabbing about software architecture can guide you. Keep walking back to the user and business requirements when you're in doubt. In senior technical positions, you aren't focused on immediate issues in the code, so much as on developing the right processes to attack those problems. Sof…

> When you know the requirements, model the data first. Data comes first because data lasts longer than code. Flexible data lets you do more with less code. And if the data is very well defined you can usually use fewer language features, too - which is a bonus to maintenance later. Think of features in data terms first and lifecycles later.

Boy am I SO GLAD to see someone say that! I think of my approach as "Data-Driven Development", rooted in my days of scientific programming. The data is what matters. On my largest project to date (8 months, entire business system) I spent 25% of the time just on the data store schema. Needless to say it worked & evolved without issue over 5 years.

Yet (at least in the PHP community) the fad is currently Domain-Driven Development, BDD, and architectures ("another travesty of reflection and classes-on-top-of-classes").

> The maintainers will feel like geniuses because they'll keep finding clever ways to use the existing data better

Oh yes, that's how my oldest systems are. Spaghetti code in parts, but the data keeps on giving.

Thank you for taking the time to write this, you've ignited a small flame of enthusiasm in me and reminded me why I enjoyed doing what I do!

Re: Ask HN: I have a mental block designing software. Time to quit?

#34
How exactly does the "mental block" look like? Does it mean that you see several possible approaches and struggle to decide which one to use? Do you feel the pressure of the "into something maintainable that will run for 5+ years" requirement?

If the answer to 2nd and/or 3rd question is "yes", your description sounds like a specific phase in the process of your professional development.

A lot of people grow with their competences (be it knowledge or skills) to the moment when they start to realize the limitations of their competences. The moment when they see a bigger picture of their work, the broader consequences of a possible error, they feel bigger responsibility etc. It's a moment when doubts start to creep in and self-esteem plummets. The paradox of this phase is that objectively such people are very competent and capable to solve the problems they face. But they become paralyzed by the pressure and self-doubt.

If this reminds you your situation (at least partially) then the solution is called coaching - a method created to help competent people who lost their faith in own competences, overcome the difficulties and grow further.

Other (often proposed, even here) solutions like switching a job, going to some seminar, being more controlled by your boss or taking a vacation do not solve this specific problem, and quite often lead to bigger decrease in self-esteem.

Hope it was helpful and coherent - it's quite complicated subject to present in a short comment.

Re: Ask HN: I have a mental block designing software. Time to quit?

#35
post #20
post #16

jaredhalpert says take a break and he's right. eigenrick says shake things up a bit and learn a new language he's also right. Sebastienconcpt says get a fresh pair of eyes, he is also right. You just need a jolt. If it's feasible take vacation and build something fun in a brand new language that is really different from anything else you've ever used. Set goals like I'll work on this no longer than X hours a day wher…

> And pick a language with a welcoming but passionate community that can give your feedback on your code. Any recommendations? The PHP community (where my commercial work is done) is not that. And far too fad driven. > And when it comes to your money earning work don't discount the Just Works outcome. You're not the first person to say that to me. I should start listening! > Having an outlet to write more elegant stu…

>The PHP community (where my commercial work is done) is not that. And far too fad driven.

If you have the insight to recognize this, I think you are doing fine.

I would recommend Python as it's community seems to be a bit better. It sure is not as 'design pattern' infested. If you have a lot of time to spare and tenacious enough, you can also try Haskell. Although you should not feel disheartened about not understanding 90% of things being said in the irc chat room even after wrestling half year with the language. But I think it is worth giving a shot. I have already ported my side project which was in PHP to Haskell using a framework called Spock and PostgreSQL as backend..

Also, I think the php thing might be causing you this conflict. As I myself have gone through a similar stage. (8 years of professional PHP experience). When I started python 3 and after a while I unlearned certain things from PHP. Things became quite a lot simple.

For example, this is the same static site generator I wrote in PHP and Python3.

PHP - https://bitbucket.org/sras/vodka

Python - https://bitbucket.org/sras/feni

Writing a bit complex stuff using PHP is so damn tiring, but it only became clear that the problem was PHP after I started programming in Python and unlearned enough PHP stuff...

Re: Ask HN: I have a mental block designing software. Time to quit?

#36

What you're describing to me is you've built a very solid structure for reasoning about programs, but it is too rigid, and too focused. I would heartily recommend learning a new language. You need to shake things up a bit. Two reasons: 1. https://www.wikiwand.com/en/Linguistic_relativity - Our language shapes our thought. This is true for spoken and programming languages. 2. You cannot properly understand a language…

> ... you've built a very solid structure for reasoning about programs, but it is too rigid, and too focused.

When I read "focused", I thought about deconcentration-of-attention.com . I don't know if it will solve porker's problem, but it is a very interesting read.

The idea of the text is that by doing deconcentration of one's attention, it is easier to notice specific details in the whole area the attention is spread over. Meaning, if one deconcentrates one's attention over a whole painting for example, one can more easily find a specific detail on said painting. The alternative to deconcentration of attention would be to scan through the painting with effort. Deconcentration of attention is essentially the reverse of the tunnel effect.

Re: Ask HN: I have a mental block designing software. Time to quit?

#37
post #19

> it's getting from what needs to happen to how to decompose into classes/methods/libraries Perhaps the problem doesn't fit into an object oriented solution. You could try learning a functional language and see if you find it fitting better. I struggled for years with OO and was never happy with my solutions. Learning functional was my road to Damascus experience. If you have to go OO, there have been plenty of peopl…

I would add

- Object Oriented Software Construction (2nd. Bertrand Meyer)

I would recommend Eiffel if you want to elevate OO design. The issue with the GOF book that I have is that there is a slant towards composition as opposed to inheritance. When done right inheritance does result in compact code. Multiple inheritance cannot be avoided (Scala proves this by trying to bring in traits). Repeated inheritance actually helps reduce the code size as one could inherit the same method twice to implement a doubly linked list from a single linked list.

Note: In functional paradigm (Haskell) composition over inheritance makes sense, though in object oriented languages choosing an approach that has a compositional bias can impose some constraints that could be avoided otherwise.

Re: Ask HN: I have a mental block designing software. Time to quit?

#39
post #20
post #16

jaredhalpert says take a break and he's right. eigenrick says shake things up a bit and learn a new language he's also right. Sebastienconcpt says get a fresh pair of eyes, he is also right. You just need a jolt. If it's feasible take vacation and build something fun in a brand new language that is really different from anything else you've ever used. Set goals like I'll work on this no longer than X hours a day wher…

> And pick a language with a welcoming but passionate community that can give your feedback on your code. Any recommendations? The PHP community (where my commercial work is done) is not that. And far too fad driven. > And when it comes to your money earning work don't discount the Just Works outcome. You're not the first person to say that to me. I should start listening! > Having an outlet to write more elegant stu…

It's hard to say without knowing what's already in your current toolbox. But a partial list might be:

* Erlang - Novel approaches to fault tolerant system design. Fail fast and recover somewhere else. Functional without the Type wizardry so you learn about immutability, pattern matching, and the typical functional language tools like folds, maps and so on.

* Clojure - A lisp that runs on the JVM. Learn about Code as data and how that empowers meta-programming. Also a functional language with interesting takes on how to share data in an immutable by default world. Lazy collections of a sort so you can learn about laziness.

* Haskell - Don't let the Category theory stuff scare you. Very interesting type system that can open your eyes to new ways to abstract things. Speaking of abstraction Haskell takes abstraction to a whole other level. Sometimes you can't see the program for all the abstraction going on. Militantly functional.

* Forth - Stack based programming, very small and compact. Radically different than anything else.

* Rust - Maybe you want to go a little bit closer to the metal for a change? Forces you to think about exactly how you share data in a multithreaded world. Targets the same world as C++ but perhaps with an easier to enter community.

* Python - Cleaner more elegant language in the same family as PHP with a very welcoming community. Batteries included so it's easier to get started than any of the others.

* Go - Concurrency done right. Lots of tooling builtin to the distribution toolchain.

Re: Ask HN: I have a mental block designing software. Time to quit?

#40
post #3

Earlier quoted context omitted.

Good advice & I'd like to, my challenge is I work freelance/direct and don't have other programmers around to ask. I think paying for code reviews and some mentoring is the only way I can get this feedback.

Why pay for review though? If you're working on open-source stuff you can try http://codereview.stackexchange.com/ for help, or reach out to some trustworthy people in your network as a fresh pair of eyes.

> My current project is choreographing 3 enterprise systems to work together

Well, don't think that's going to be open source.

Post reply on HN