Live data from Hacker News

Ask HN: How’d you go from a noodler to writing large well structured programs?

news.ycombinator.com

61–70 of 77 posts

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#61
These are not specifically about structuring projects, but I would recommend two books for "thinking like a programmer".

The Pragmatic Programmer, by Dave Thomas and Andy Hunt, is a fairly slim book that aims to cover the unwritten knowledge that experienced programmers have. It came out a long time ago, but it's one of those timeless classics. If you can read this book and everything in it seems obvious, you are probably the equivalent of an intermediate-level software developer.

Similarly, Code Complete, by Steve McConnell, explains how to think like a project lead. In contrast to The Pragmatic Programmer, this is a large book: it aims to cover many concerns. Again, the less that you know, the more value that you will get from it: if you are starting with no training in programming, this book could be immensely valuable.

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#63
In my experience, it's important to architect early an not be afraid of tearing everything down and rewriting it (most of it can be reused).

The structure of a program gets really bad when you continue to pile more and more code on a bad architecture.

Refactor early, refactor often - get to the point where you are comfortable with modifying large chunks. Of course that means you have enough test frameworks at every level.

Matlab as a language itself is more of a laboratory language, convenient for playing with math and quickly prototyping things.

As a language that can scale to dozens of thousands of lines, it is poorly suited.

You definitely need a senior programmer in your team, else it will soon turn into a nightmare.

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#64
post #52
post #24

I will reiterate some of what others have said: - Use version control! - Hire a professional software developer - Good architecture and abstraction comes mostly from practice but if you really want to do some reading on software architecture check out "The Architecture of Open Source Applications" (vol 1 & vol 2) http://www.aosabook.org/en/intro1.html

Version control will be on the list starting next year. Thanks! I'll also take a look at the link. Unfortunately it isn't in our budget to hire a pro dev to the team but I can work attempt to increase time working with our corporate IT department which has some excellent devs.

>Version control will be on the list starting next year.

The fact that you make quant software trading millions of dollar without version control surprises me. Is the quant industry really like that?

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#65
Some simple rules I’ve found to be helpful:

Design from the top down; implement from the bottom up.

Write no subroutine longer than about 50-60 lines. Back in the day, that was a single printed page. We used listings because we didn’t have giant monitors.

Define a specific and single purpose for any given subroutine. Name it to match it’s purpose.

Don’t repeat yourself; got the same code in two places? Make it a subroutine.

If you don’t want to dive into git or other version control, use Time Machine or Dropbox to enable you to review what worked last week or last month.

Also, understand the worth of this code to your organization. 15k lines shouldn’t take a seasoned developer more than a few weeks to understand and refactor. If this code isn’t worth the $20k a good consultant would charge to fix it, then muddling through would appear to be part of your job description. There’s nothing wrong with slugging it out when economics dictate it.

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#66
I don't have much experience with Matlab, but I work with some analysts who write R, which I gather is quite similar.

A good first step is to get on top of your external dependencies. I find analysts tend not to think about this too much and happily just stick in whichever library, which can be a problem when you're working with a team.

So, make sure that your code base uses exactly one version of each library and everyone develops against that version. Next, make sure you only have one external library to server each purpose.

The R equivalent I've seen is a codebase which included dplyr, plyr (obsolete version of dplyr), data.tables (does the same job as dplyr, but with gibberish syntax), along with reshape (obsolete), reshape2 (obsolete) and tidyr. This sort of thing happens really easily because people want to use the tools they're familiar with.

Working with R has also led me to believe that some languages are just bad for writing large programs in.

So you may have to consider either a rewrite in a different language, or a rewrite so that you have several smaller programs connected with a glue language (e.g. `make`).

Either way, the software engineering part of software usually goes "extract a piece of this program, put it in a box, define the entrances and exits from the box carefully, then ensure your box does what it's supposed to".

The hard bit is deciding which way to cut the program up. That can have big consequences.

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#67
post #64
post #52

Earlier quoted context omitted.

Version control will be on the list starting next year. Thanks! I'll also take a look at the link. Unfortunately it isn't in our budget to hire a pro dev to the team but I can work attempt to increase time working with our corporate IT department which has some excellent devs.

>Version control will be on the list starting next year. The fact that you make quant software trading millions of dollar without version control surprises me. Is the quant industry really like that?

It is in commodities. Not at banks. In commodities it is the wild west.

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#68
post #54

A tangent: Places I've worked with no source control and "we'll fix it live" often lack reliable backups. A failed hard drive was an existential business risk. I recommend making sure you have a disaster recovery plan in place. Essentially, do you have up-to-date and reliable copies of things off site, and a documented way (which you've tested!) to get your stuff back up and running using only those copies.

Corporate IT backs up all of our files every day to multiple servers, so that isn't a huge issue (yet at least).

Re: Ask HN: How’d you go from a noodler to writing large well structured programs?

#70
post #23
post #22

Recommended resources to consider: * Code Complete https://www.amazon.com/Code-Complete-Practical-Handbook-Cons... * Programming Pearls https://www.amazon.com/Programming-Pearls-2nd-Jon-Bentley/dp... * Pragmatic Programmer https://www.amazon.com/Pragmatic-Programmer-Journeyman-Maste...

One more I missed regarding review of architecture, code structure/design of OSS: The Architecture of Open Source Applications (Vol 1 & 2) https://www.amazon.com/Architecture-Open-Source-Applications...

Available for on-line reading at http://www.aosabook.org/en/
Post reply on HN