5 ms·
Business logic happens line by line between interfaces. Coding may be all ifs and for loops, but when it comes to implementing a new feature, having chosen car
by gorgoiler 5y ago
Business logic happens line by line between interfaces. Coding may be all ifs and for loops, but when it comes to implementing a new feature, having chosen carefully where to draw the line between, say, your model and your view can be the difference between a 10 line patch and a complete rewrite.
If you don’t have a culture of code review then maybe the rewrite will fly, bugs and all, through to production. If however you have the ability to reason logically about the salient changes diff by prescient diff — where by definition each prescient diff represents nothing but the salient changes — then you at least stand a fighting chance of version N+1 having fewer bugs than version N while also moving your business forwards.
Anything else is a quagmire that will never converge on stability and it all starts with there being a 1:1 mapping between what you think and what you write. Java is particularly unforgiving for code where ones thoughts are unclear.
As a complete aside: buy your dev team a fountain pen and a pad of paper for Christmas. Writing meaningfully is everything.
- thewarrior 5y agoThe line “coding is just if statements” really annoys me. I used to think this earlier in my career. It’s technically true but it means that you haven’t really grasped what makes programming hard. The real challenge of programming is how you organize a million if statements in a way that the system can be understood and evolved predictably and cheaply over time. And any tool that takes away the control of how you organize your code and allows for the creation of complexity without proper version control, debugging, testing and code review is doomed to failure. No code is just code at a higher level of abstraction. No code works when you don’t need a lot of code to solve the problem to begin with. Which is kind of a mind bender.
- randomdata 5y agoCoding is just if statements, more or less. Programming and coding are different words with different meanings, though. What is the reason to conflate them?
- codebje 5y agoBecause 'coding' is just slang for 'programming'.
- randomdata 5y agoThat is not true, though. Coding is about writing code, whereas programming is the thought process that goes into writing code. The original comment establishes the same distinction, so it is not exactly a novel separation. The question was why then conflate them when they were already recognized as being different?
- lokedhs 5y agoSince this is HN, and pedantic corrections are popular, I feel the need to point out that "coding" is the original term. I've seen very old references where creating instructions for a machine to execute was referring to "coding". We're talking Jacquard Mills or Babbage machines here.
- tshaddox 5y ago> It’s technically true but it means that you haven’t really grasped what makes programming hard. It’s roughly as useful as pointing out that constructing a skyscraper is really just applying forces to masses.
- devoutsalsa 5y agoObligatory XKCD reference: https://xkcd.com/435/ https://xkcd.com/435/
- ElFitz 5y agoReminds me of this: - http://www.geeksworld.org/strip_982.html http://www.geeksworld.org/strip_982.html - http://www.geeksworld.org/strip_984.html http://www.geeksworld.org/strip_984.html
- wruza 5y agoIn case you missed this thread: https://news.ycombinator.com/item?id=29442307 https://news.ycombinator.com/item?id=29442307
- isoprophlex 5y agoIt's a joke, yo https://pbs.twimg.com/media/FFue_fIVUAMrSu1?format=jpg&name=large https://pbs.twimg.com/media/FFue_fIVUAMrSu1?format=jpg&name=...
- unbanned 5y agoHow unfortunate to be slap bang in the middle of the bell curve https://twitter.com/nice_byte/status/1466940940229046273 https://twitter.com/nice_byte/status/1466940940229046273
- nyanpasu64 5y ago> Java is particularly unforgiving for code where ones thoughts are unclear. Why is Java bad that way? Overly complex classes? In my experience, C++ is particularly awful, since careless programming can lead to memory corruption, use-after-free, and nonlocal malfunctions and crashes.
- VHRanger 5y agoAt this point the issues with Java are cultural, but they used to be evolutions of constraints of the rigid "everything must be a class" model. If nothing in the architecture can just be a free-floating procedure, not even a pure function, the system architecture will evolve around this
- oh-4-fucks-sake 5y agoKotlin has been a godsend when it comes to breaking free of Java dogmatic thinking. The effort to write good functional code is so much less. That's not to say that classes are useless. I try to limit class usage to data structures that do no more than: - Store data - Simple convenience functions that tell me about its state - Side-effect-free mutations (or data massaging) that have no external dependencies other than function params - Simple validation, if there are no external dependencies Everything else goes in a service/function.
- VHRanger 5y agoClasses manage something stateful. One anti-pattern/code smell I often see is finding classes in a service which should just be a functionally pure pipeline (eg. no internal state is managed)
- oh-4-fucks-sake 5y agoAgreed. Exception here is when you're making the trade-offs to buy into a DI framework--which you could argue is a descendent need from the "everything is a class" worldview. Pure/dependency-free util functions can very naturally live outside of all of this. But, the minute you have functions that depend on inherently stateful infrastructure (e.g. datasource connections--so, most applications), then those functions become inherently stateful--which makes them less natural to exist as pure utils and starts to make DI more attractive--which leads us back to placing pipeline code within classes. Alternatively, you could expose only the stateful pipeline code within singletons, but at some point you start to fight the community patterns--which means you start to lose out on community goodies. To be clear, this is all only based my experiences and I'm not dogmatic at all about any of this. Times change/everything-old-is-new-again. I'm sure classes will make a comeback, and then go out of favor again--as is life.