Hacker Newsnew | past | comments | ask | show | jobs | submit | more interactivecode's commentslogin

Are you familiar with Literate Programming? https://en.wikipedia.org/wiki/Literate_programming


Thanks for the pointer - I had read about it, but hadn't put two and two together. The kinds of things I work on (cacheable wesbites) don't need to be highly tuned for back-end performance, so I guess it's easier for me to do that.


Lit style probably doesn't have much impact on performances, it's handled by the parser and mostly by ignoring the comments.

It can impact the memory of runtime-oriented languages, especially if they keep the text around (e.g. for reflection or whatever) but that's about it.


That’s horrible because the git commit messages are easily lost, disconnected or hard to find in any reasonably active codebase. For example as soon as you do a change and move a file it almost always disconnects from the previous change history.

Whats even more difficult is searching through a code base when the documentation isn’t in or near the code. I don’t know any IDE or editor that makes it easy to search though git commit message and source code at the same time.

On top of that, do you review git commit message in code review? Do you aks people to improve descriptions, typos and language in commit messages?


I don't understand how they are hard to find. It's trivial to find where the file was moved from.

What I truly care about is why something is the way it is, what is the rationale behind it, how it works with other parts of the codebase, what problems it solves, what is tricky about it, what to pay attention to and so on. I don't care at all about the code that was written and an explanation to it because this I can read myself in the code. The best place I've found for this is a code commit because it can tie different parts of the codebase together and add a lot of context to a change. I commit heavily and don't squash. A long comment in a commit that contains all file changes related to a certain feature, bug or whatever adds a lot more information than a comment in one file. When other people do it, it helps me a lot more than chasing their (outdated) code comments throughout the codebase.

But if that doesn't work for you, then don't do it. Just don't be dogmatic and dismissive. I accept there might be situations and codebases where this doesn't work.


I'm lost. Are you talking about meta-level comments, like "here's why this change is being made", that aren't directly tied to any particular line of code? If so, certainly putting that stuff in commits makes sense.

But for regular "explanatory note about this variable/function/etc" comments, how does one work if those things are in commit logs? If you're reading code and something is unclear, do you look back through the commit messages of every commit that's ever touched that line, just in case one of them has something relevant?


IDEs can show commit history. But you're right that it can get messy tracing back to the original commit when a file has been changed many times.

But for the most part I feel like comments should be automated tests. If a line is there for an edge case it should have a matching test for that edge case.

The only exceptions I see are for performance optimizations or some other situation where you can't easily test.


> IDEs can show commit history.

How you check the commit history is beside the point - the question is, do you read the entire commit log history for a chunk of code before editing it?

If not, any comments there might as well not exist - functionally speaking you're maintaining an uncommented codebase.


Tests are not a replacement for comments or documentation. Tests check that A() returns x but don't explain what is A, x and why it should return it.


That goes in the test name. You'll have something like

Feature A

"It should return X in [some edge case]"

That's where any link to a use case should be.


Lot's of IDEs and external tools do very basic git integration ¯\_(ツ)_/¯

I think JetBrains is probably the best of the IDEs


Your comments applies very little to commit messages, and much more so to comments.

> That’s horrible because the git commit messages are easily lost, disconnected or hard to find in any reasonably active codebase. For example as soon as you do a change and move a file it almost always disconnects from the previous change history.

Learn your tools or get better ones, `git log --follow` has no issues with renames, and when files get munged in ways it can't handle (e.g. content is split out or merged) it's easy enough to stitch back, and good annotate UIs (Jetbrain's is stellar and one of the few things I don't use magit for) make flitting through a snippet's history trivial.

Meanwhile finding removed comments is nearly impossible (VCS are nowhere near as good for finding when was removed than when it was added), and comments can easily drift apart from their point of origin as developers aren't too careful about maintaining them when adding unrelated comments.

> On top of that, do you review git commit message in code review? Do you aks people to improve descriptions, typos and language in commit messages?

Bet your ass I do.


> I don’t know any IDE or editor that makes it easy to search though git commit message and source code at the same time.

Any editor from Jetbrains with the GitToolbox plugin does that.


Can second that. Having the commit message as a virtual comment on the end of the current line is immensely helpful in tracking changes. It’s like git blame on steroids.


I also like seeing the commit messages in this way! In the case of VSCode this comes with the Git Lens extension.


  git log --follow -p file
edit: here's another

  git log -p -L:show_commit:builtin/rev-list.c


> On top of that, do you review git commit message in code review? Do you aks people to improve descriptions, typos and language in commit messages?

Absolutely I do. The commit message is part of the commit just like the code; why would it be excluded from review? The number of times that a good commit message has helped me when dealing with a bug, and that a poor one has stymied me, have firmly convinced me that they are just as important as any other project documentation. They should be clear and informative, and I ask for those aspects to be improved when needed.


Hopefully this speeds up the adoption of solar panels. We have the tech to be less reliant on fossil fuel and ee should be doing that


> Hopefully this speeds up the adoption of solar panels

Except the solar energy potential in Northern Europe is too low to be cost effective. Going big on solar isn’t going to lower prices.


I come to think that an MVP is only that, when after validating your product case. You scrap the mvp and build the product from scratch.

If you’re not able yo scrap what you have you aren’t validating product market fit, you are forcing a product onto the market.


Not sure I agree with you. It’sa minimal product. It’s still something you can carry forward, improve on, and enhance.

Seems wasteful to build something only to scrap it once people say they want it.

I’m right now testing out demand for a headless CMS @ https://moogle.cc/nirvaancms.html and I’m not planning to redo the entire tech stack if there seems to be demand for such a product.


> Seems wasteful to build something only to scrap it once people say they want it.

It can be. But you probably shouldn't build a product to test whether people in your chosen market say they want it, or to find out whether buyers or sellers are hardest to acquire to bootstrap a two-sided market, when you can probably validate that with some landing pages or user interviews.

If you need to test whether people will use it after buying (or perhaps which users will use it after buying, or how many users will keep using it and paying for it), you probably need to build something, but it may only need to be implemented using manual processes behind the scenes.

If you need to test whether you can serve the customer at scale for less than your cost to acquire them, that is a different sort of MVP.

In any case, there are definitely MVPs that can and should be scrapped when you are done using them to validate (or invalidate) whichever proposition is then your biggest source of risk.

Keep in mind that should you invalidate the hypothesis being tested, you may need to scrap the MVP anyway when you pivot away from that particular hypothesis. And, some of your hypotheses will be invalidated, so making sure you don't run out of resources for testing new ones is kind of important.


If you’re on mac mimestream is really good:

https://mimestream.com/


So what language do you use for cranking out enterprise crud apps and getting actual work done?


I don’t get it, what’s the difference between nix and other dependency or package managers?


Nix does more things than other package managers.

Compared to other package managers: You could use Nix to install packages, in the same way you would with other package managers. An advantage to this is you'll get the same version of the package regardless of which distribution you use. (Whereas with, say, Ubuntu you might need to add a PPA to get versions as bleeding-edge as what Arch would offer).

Nix's tooling is also broader in scope:

e.g. with nix-shell, you can have a shell which has a Go-lang compiler (or whatever) in that shell, but without needing the Go-lang compiler installed on the computer. This is comparable to e.g. asdf, or to running your toolchain in a Docker container (like what VSCode Remote Containers offers). -- i.e. Nix can be useful for development.

NixOS takes the same Nix declarative language, and allows describing the configuration of the whole OS setup with it. Just as Terraform declares an orchestration of cloud infrastructure, NixOS allows declaring how the OS is setup. (Here, Nix is comparable to e.g. cloud-init or Ansible). -- i.e. Nix can be useful for deployment.


Nix as a package manager is a subset of a broader concept of a graph database of reproducible build instructions that explicitly track every dependency of your project, and a set of tools that allow you to build and cache said dependencies in an isolated, distributed (parallel), and transparent way. Add filesystem- / path-sandboxing to the equation and you'll get a set of features that make Nix different to other conventional package managers.


MacOS is simple, open xcode, new project, choose the app and press run.


Well, so just like on Windows :P

Open VS -> New Project -> Winform/WPF -> Run


to elabolate:

1. Open VS, wait a minute. 2. New Project 3. Run, wait 10 minutes for dependencies to download. 4. Want to use Sublime Text or VS Code, haha lol.


>3. Run, wait 10 minutes for dependencies to download.

Why would you need 10 minutes?

>dotnet new winforms

>dotnet run

>app appears

takes a few secs

even on old .NET there was no such a thing like 10 min wait for dependencies to load


You didn't ask about their internet quality, computer specs, etc.

If you're used to developing on Linux where you can self-host entire repos, it's incredible how fragile and ephemeral the MS stack must feel.


What do you mean?

>If you're used to developing on Linux where you can self-host entire repos, it's incredible how fragile and ephemeral the MS stack must feel.

I guess he's talking about restoring nuget packages, so of course you don't want to have all existing nugets in all versions on your disk.


> 1. Open VS, wait a minute. 2. New Project 3. Run, wait 10 minutes for dependencies to download. 4. Want to use Sublime Text or VS Code, haha lol.

You're playing on hard mode; try using Visual Studio for everything.


#3 is a one-time cost, #4 is you are doing it wrong


Can you really trust those average 3 engineers you work with to build any sort of complex piece of software more reliably just to get started with the project you're actually building?


In my experience, not generally, no.


Everyone always talking about simple code. But what can we agree on that makes code simple?


SOLID[0] is always somewhere to start if you really have no idea where to begin understanding what makes code more maintainable. There are plenty of books out there, but those can be a minefield in terms of knowing which ones to really commit energy to learning. The only real answer that I know of here is personal experience though.

[0]: https://en.wikipedia.org/wiki/SOLID


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: