Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've found that a "rough draft" is pretty hard to maintain as a "draft," when you have a typical tech manager.

Instead, it becomes "final ship" code.

I tend to write ship code from the start, but do so, in a manner that allows a lot of flexibility. I've learned to write "ship everywhere," even my test harnesses tend to be fairly robust, ship-Quality apps.

A big part of that, is very high-Quality modules. There's always stuff that we know won't change, or, if so, a change is a fairly big deal, so we sequester those parts into standalone modules, and import them as dependencies.

Here's an example of one that I just finished revamping[0]. I use it in this app[1], in the settings popover. I also have this[2] as a baseline dependency that I import into almost everything.

It can make it really fast, to develop a new application, and can keep the Quality pretty high, even when that's not a principal objective.

[0] https://github.com/RiftValleySoftware/RVS_Checkbox

[1] https://github.com/RiftValleySoftware/ambiamara

[2] https://github.com/RiftValleySoftware/RVS_Generic_Swift_Tool...



Tangent, is it a Swift thing to have "* ################################################################## / comment markers ?

It becomes quickly very visually dominant in the source code:

> / ###################################################################################################################################### / // MARK: - PUBLIC BASE CLASS OVERRIDES - / ###################################################################################################################################### */


Nope. It's a "Me" thing. I write code that I want to see. I have fairly big files, and it makes it easy to scroll through, quickly. It also displays well, when compiling with docc or Jazzy.

My comment/blank line-to-code ratio is about 50/50. Most of my comments are method/function/property headerdoc/docc labels.

Here's the cloc on the middle project:

    github.com/AlDanial/cloc v 2.04  T=0.03 s (1319.9 files/s, 468842.4 lines/s)
    -------------------------------------------------------------------------------
    Language                     files          blank        comment           code
    -------------------------------------------------------------------------------
    Swift                           33           1737           4765           5220
    -------------------------------------------------------------------------------
    SUM:                            33           1737           4765           5220
    -------------------------------------------------------------------------------


i see lots of python with blocks like

    ###############################################################################
    ############################### LIBRARY IMPORTS ###############################
    ###############################################################################

    import sys
    from pathlib import Path

(not in this case but) it helps me for long files where modularization would be inconvenient




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

Search: