1,253 Matching Annotations
  1. Nov 2022
    1. In summary, terminal input is weird.  It’s weird largely because there’s a character-only pipe sitting between the terminal and shell.  And going one step back, the weirdness comes from the whole historical division of terminal vs. shell, which is based on emulating a physical hardware setup that hasn’t been built since the 80s. 

      Summary of why the terminal input is so weird.

    1. Currently Xournal++ does not have shortcuts/keybindings configurable in the preferences. However you can write your custom plugin to achieve exactly that.

      Must learn (and install) Lua (version >=5.3) to make custom shortcuts for Xournal++ via personally made plugins.

    1. What does 'passing an argument' mean in programming?You have a grinder that will grind anything that you pass on to her. You give her Rice. She grind it. You give her wheat. She grind it. You give her a Justin Bieber song CD. She grind it. She grinds every thing that you hand over to her. In programming, we create function that does the stuff we need. Say add, subtract, multiply or print the stuff that you pass on to it. Then we pass on stuff upon which the function will operate and return us the results. This process of passing the 'stuff' to be processed is referred to as passing an 'argument' in programming. Thank You.
    1. I like to say that in ECS we design bottom-up. We look at data and which behaviour depends on which data. In OO we design top-down, we search for abstractions and generic behaviours / definitions.
    1. there is no single perfect universal programming language. Until I came to that point, I wasted a lot of time thinking that GW-BASIC QBASIC QB 4.5 VB4 Delphi Java C++ C# 1.0 was the only language I would ever need
    1. There are three main types of module and function mocking in Jest:jest.fn: Mock a functionjest.mock: Mock a modulejest.spyOn: Spy or mock a function

      Esto es sólo una prueba para Juanda

    2. One of the common ways to use the Mock Function is by passing it directly as an argument to the function you are testing.

      curioso

    1. Clean code examples (YouTube)Why Are You Still Creating CRUD APIs?Remove Your If-Else and Switch CasesWhy Cognitive and Cyclomatic Complexity Matters in Software DevelopmentWriting Cleaner Code (With Examples)Resources for the curious📚 Source Code (GitHub) by Nicklas Millard, the authorRESTful API Design by MicrosoftArchitectural Styles and the Design of Network-based Software Architectures by R.T. FieldingWhat is REST by codeacademyIs Crud Bad For Rest? by Boris LublinskyHATEOAS Driven REST APIs by restfulapi.netHATEOAS — a simple explanation by Bartosz JedrzejewskiWhy HATEOAS is useless and what it means for REST by Andreas ReiserRESTful Considered Harmful by Tomasz NurkiewiczTask-Based UI on cqrs.wordpress.comCRUD is an antipattern by Mathias VerraesWhy REST sucks by Troy A. Griffitts

      Useful links for Web & generic programming.

    2. RPC-like but still REST-full is way more preferred than those rotten CRUD designs.

  2. Oct 2022
    1. The first interaction with a programming language should be what it can do for you, rather than an exhaustive glossary of what it is.
    1. she says in contrast to e.g. reading, we don’t know much of anything about teaching programming. There’s no body of work

      Hermans posits that there is no actual body of work about how to effectively teach programming. In contrast to reading.

    1. it can be ‘run’ at some point, which produces the ‘running program’. Not to be confused with a ‘non-running program’, the running program is the original program plus some run time state attached to its various parts which changes as it runs.

      Reminiscent of The Pinocchio Problem.

    2. The program is a document like construct created by a programmer—it has some structure presented via a primary visual representation through which the programmer views and manipulates it.

      Reminiscent of the distinctions Martin Fowler makes on Projectional Editing.

    1. On “good” days, developers spend more time developing and less time collaborating
  3. pointersgonewild.files.wordpress.com pointersgonewild.files.wordpress.com
    1. IMO: one of the biggest problems in modern softwaredevelopment• Code breaks constantly, even if it doesn’t change• Huge cause of reliability issues and time wasted• This is somehow accepted as normal

      ⬑ "The Code Rot Problem"

    1. The program will compile, but not run, because JVM will not recognize the main() method. Remember JVM always looks for the main() method with a string type array as a parameter.

      With out String args[] in main().

    1. An object in Java is the physical as well as a logical entity, whereas, a class in Java is a logical entity only.

      Object exists but Class is just logical steps to make object. Class --> Blue print and Object ---> Car

    1. Many popular SQL clients do not use SSL by default. If you aren’t deliberate about choosing encryption, the connection will be unencrypted.

      Table with SQL clients and their default SSL mode:

    2. SSL is disabled by default in jdbc, npgsql, node-postgres, and pgx.

      Table with programming libraires and their default SSL mode:

  4. Sep 2022
    1. I have a simple coding principle: write lines of code as though instructing a real person how to do the job. And that naturally expands to designing and modelling systems like real organisations with their own divisions, departments, branches, and all the various “job positions” that need to be filled. Make the whole system appear as human as possible.
    1. A line of code containing 6+ pieces of information should be simplified.

      When to simplify a line of code?

    1. That’s why it was such a life-changing event for me when I found Dash in 2012.

      Offline docs: - macOS: Dash ($30) - Windows/Linux: Zeal (free) - Windows: [Velocity] (https://velocity.silverlakesoftware.com/) ($20) - Web: DevDocs

    1. Also be aware of how Ruby handles aliases and inheritance: an alias references the method that was resolved at the time the alias was defined; it is not dispatched dynamically.
    1. For example, whereas C programmers have argued for years about where to put their brackets, and whether code should be indented with tabs or spaces, both Rust and Go eliminate such issues completely by using a standard formatting tool (gofmt for Go, rustfmt for Rust) which rewrites your code automatically using the canonical style. It’s not that this particular style is so wonderful in itself: it’s the standardisation which Rust and Go programmers appreciate.
    2. If you like the functional style of programming, though, you’ll find a lot more facilities for it in Rust, because Rust has a lot more facilities than Go in general.
    1. The LISP part, though, is not going well. Porting clever 1970s Stanford AI Lab macros written on the original SAIL machine to modern Common LISP is hard. Anybody with a knowledge of MACLISP want to help?
    1. When you run a command like python or pip, your operating system searches through a list of directories to find an executable file with that name. This list of directories lives in an environment variable called PATH, with each directory in the list separated by a colon: /usr/local/bin:/usr/bin:/bin Directories in PATH are searched from left to right, so a matching executable in a directory at the beginning of the list takes precedence over another one at the end. In this example, the /usr/local/bin directory will be searched first, then /usr/bin, then /bin.

      What is PATH?

    1. Now, not every programmer prefers that kind of development. Some programmers prefer to think of development as a process of designing, planning, making blueprints, and assembling parts on a workbench. There’s nothing wrong with that. Indeed, a multibillion-dollar international industry has been built upon it.

      I still think they should worry about it. Production systems need to evolve and contain data; reasoning about the systems completely statically from the source code with no regard to the existing data is a lot more complicated than it needs to be.

    2. In fact, there’s a style of programming, well known in Lisp and Smalltalk circles, in which you define a toplevel function with calls to other functions that don’t yet exist, and then define those functions as you go in the resulting breakloops. It’s a fast way to implement a procedure when you already know how it should work.
    3. Moreover, because the entire language and development system are available, unrestricted, in the repl, you can define the missing function bar, resume foo, and get a sensible result.

      This seems like one of the key points. The ability to edit computations while running. Type holes with resuming gets you most of the way there but there's probably also modifications. I wonder how you can keep it from getting confusing. Something similar to FRP?

  5. Aug 2022
    1. Obnoxious.

      As someone recently pointed out on HN, it's very common nowadays to encounter the no-one-knows-else-what-they're-doing-here refrain as cover—I don't have to feel insecure about not understanding this because not only am I not alone, nobody else understands it either.

      Secondly, if your code is hard to understand regarding its use of this, then your code his hard to understand. this isn't super easy, but it's also not hard. Your code (or the code you're being made to wade into) probably just sucks. The this confusion is making you confront it, though, instead of letting it otherwise fly under the radar.* So fix it and stop going in for the low-effort, this-centric clapter.

      * Not claiming here that this is unique; there are allowed to be other things that work as the same sort of indicator.

    1. Mob requires good communication skills. There is no space for passive-aggressiveness; or arrogance. If You want to show You are better than Your colleagues, You aren’t a candidate for Mob.

      Main requirement of effective mob programming

    1. Corollary: Spolsky (at least at the time of this article) didn't really understand types, having about the same grasp on computing fundamentals as your average C programmer.

    1. It should be dead simple to distribute content (eg. static content).It should be easy to build apps.It should be not too hard to build a platform.

      The thing that gets me about takes like this is that it's all the stuff below the Web content layer that accounts for what makes all this stuff harder than it needs to be.

      What's the hard part about distributing content (static or not, but let's go with static for simplicity)? It's registering a domain, updating DNS, and keeping a Web server up—all systems that have nothing to do with the "infernal" trio and also generally programmed in what are typically described as saner languages and their traditions. It's either that, or it's relying on somebody else, like GitHub Pages, and integrating the implementation details/design decisions for their value-add into your workflow.

      To "build a platform" is ambiguous, but it sounds a lot like "creating a server-side application to serve non-static content and handle associated requests". Is the infernal trio to blame for the difficulties of that, too?

    1. Dynamic typing makes that harder

      So run a typechecker on the code to check your work if you want type checking. That is what TypeScript does, after all. And it's been around long enough that people shouldn't be making the mistake that a runtime that support dynamic types at runtime means that you can't use a static typechecker at "compile time" (i.e. while the code is still on the developer workstation).

    1. In computing, serialization (US and Oxford spelling) or serialisation (UK spelling) is the process of translating a data structure or object state into a format that can be stored (for example, in a file or memory data buffer) or transmitted (for example, over a computer network) and reconstructed later (possibly in a different computer environment).[1] When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward. Serialization of object-oriented objects does not include any of their associated methods with which they were previously linked.

      This process of serializing an object is also called marshalling an object in some situations. The opposite operation, extracting a data structure from a series of bytes, is deserialization, (also called unserialization or unmarshalling).

    1. What is not OK is what I perceive as the dominant attitude today: sell SciPy as a great easy-to-use tool for all scientists, and then, when people get bitten by breaking changes, tell them that it’s their fault for not having a solid maintenance plan for their code.
    1. An ActivePaper is, by defini-tion, a package combining the code, data, and documentationthat describe together a computational scientific study.
    1. What I call software collapse is what is more commonly referred to as software rot: the fact that software stops working eventually if is not actively maintained. The rot/maintenance metaphor is not appropriate in my opinion because it blames the phenomenon on the wrong part. Software does not disintegrate with time. It stops working because the foundations on which it was built start to move.
    1. I can't possibly keep updating software to deal with new JavaScript versions

      There's a fundamental misunderstanding (alternatively, misdirection) about what the source of breakage is. JS is not an SDK, and neither is the Web platform. Whatever worked in the old "JavaScript version" will work in the new one.

    1. and free of globals

      Ah! This remark highlights a fundamental difference in understanding between two camps, which I have been (painfully) aware of, but the source of this confusion has eluded me until only just right now. (Really, this is a source of frustration going back years.)

      In one camp, the advice "don't use global variables" is a way of attacking a bunch of things endemic to their use, most notably unnecessary coupling to spooky state. In another camp "no global variables" is understood to mean literally that and taken no further—so you can have as much spookiness as you like, and so long as the value is not directly accessible (visible) from, say, another given piece of code appearing at the top-level ("global") context, as with the way i is bound to the activation record in this example but is not accessible outside the scope of getGetNext, then you're good.

      That is, there are two aspects to variables: visibility and extent, and the first interpretation seeks to avoid the negative effects on both dimensions, while the second is satisfied by narrowly prohibiting direct visibility across boundaries.

      I find the latter interpretation bizarre and completely at odds with the spirit of the exhortation for avoiding globals in the first place.

      (What's worse is the the second interpretation usually goes hand in hand with the practice of making extensive use of closures, which because they are propped up as being closely associated with functions, then leads people to regretfully refer to this style as functional programming. This is a grave error—and, to repeat, totally at odds with the spirit of the thing.)

  6. Jul 2022
    1. Later in life and irrespective to the character of the relationship held, the good enough approachinforms how communication between people can be practiced. One of the widest known formulasfor that is called Nonviolent Communication, subtitled as the ‘language of life’ [ 39]. The subtitle seemsparticularly appropriate to our case, as it describes a method of communication that does not servesocial programming and allow humans to author and own their speech. A nonviolent communicatordoes not reinforce the boundary cuts and refrains from installing the personware-shaping doublebinds.

      !- definition : nonviolent communication, language of life * a method of communication that does not prioritize social programming over an individual's right to articulate and own their own speech.

    1. von neumann was furious at him furious that he would waste precious machine time 00:04:20 doing the assembly that was clerical work that was supposed to be for people right and so we saw the same story happened just a little bit later when john backus and friends came up with us idea they called fortran this is so call high-level language where you could write out your formulas as if your writing mathmatical notation you could write out loops and this was shown to the assembly programmers and once again they just 00:04:46 they weren't interested they don't see any value in that they just didn't get it so um I want you to keep this in mind as I talk about the four big ideas that I'm going to talk about today that it's easy to think that technology technology is always getting better because Moore's law because computers are getting always more capable but ideas that require people to unlearn what they've learned and think in new ways there's often 00:05:10 enormous amount of resistance people over here they think they know what they're doing they think they know a programming is this programming that's not programming and so there's going to be a lot of resistance to adopting new ideas

      Cumulative cultural learning seems to be stuck in its own recursive loop- the developers of the old paradigm become the old "guard", resistant to any change that will disrupt their change. Paradigm shifts are resisted tooth and nail.

    1. In computer programming, Intentional Programming is a programming paradigm developed by Charles Simonyi that encodes in software source code the precise intention which programmers (or users) have in mind when conceiving their work. By using the appropriate level of abstraction at which the programmer is thinking, creating and maintaining computer programs become easier. By separating the concerns for intentions and how they are being operated upon, the software becomes more modular and allows for more reusable software code

      Definition of Intentional Programming * In computer programming, * Intentional Programming is a programming paradigm * developed by Charles Simonyi * that encodes in software source code the precise intention which programmers (or users) have in mind when conceiving their work. * By using the appropriate level of abstraction at which the programmer is thinking, * creating and maintaining computer programs become easier. * By separating the concerns for intentions and how they are being operated upon, * the software becomes more modular and allows for more reusable software code. * Can we see an example of this in action for clarification?

    2. Intentional programming
    1. The thing that bugs me when I listen to the Muse podcast—it's something that's present here along with the episode with gklitt—is that there's this overarching suggestion that the solution to this is elusive or that there are platform constraints (especially re the Web) that keep any of these things from being made. But lots of what gets talked about here is possible today, it's just that no one's doing it, because the software development practices that have captured the attention of e.g. GitHub and Programmer Twitter value things that go against the grain of these desires. This is especially obvious in the parts that mention dealing with files. You could write your Web app to do that. So go do it! Even where problems exist, like with mobile OSes (esp. iOS), there're things like remoteStorage. Think remoteStorage sucks? Fine! Go embrace and extend it and make it work. It's not actually a technical problem at this point.

    2. @18:52:

      I wanna also dig a little more into the kind of... dynamism, ease-of-making-changes thing, because I think there's actually two ways to look at the ease of making changes when you solve a problem with software. One way is to make software sufficiency sophisticated so that you can swap any arbitrary part out and you can keep making changes. The other is to make the software so simple that it's easy to rewrite and you can just rewrite it when the constraints change.

    1. // NB: Since line terminators can be the multibyte CRLF sequence, care // must be taken to ensure we work for calls where `tokenPosition` is some // start minus 1, where that "start" is some line start itself.

      I think this satisfies the threshold of "minimum viable publication". So write this up and reference it here.

      Full impl.:

      getLineStart(tokenPosition, anteTerminators = null) {
        if (tokenPosition > this._edge && tokenPosition != this.length) {
          throw new Error("random access too far out"); // XXX
        }
      
        // NB: Since line terminators can be the multibyte CRLF sequence, care
        // must be taken to ensure we work for calls where `tokenPosition` is some
        // start minus 1, where that "start" is some line start itself.
        for (let i = this._lineTerminators.length - 1; i >= 0; --i) {
          let current = this._lineTerminators[i];
          if (tokenPosition >= current.position + current.content.length) {
            if (anteTerminators) {
              anteTerminators.push(...this._lineTerminators.slice(0, i));
            }
            return current.position + current.content.length;
          }
        }
      
        return 0;
      }
      

      (Inlined for posterity, since this comes from an uncommitted working directory.)

    1. In terms of this analogy, a lot of objections to end-user programming sound to me like arguing that Home Depot is a waste of time because their customers will never be able to build their own skyscrapers. And then on the other side are the people arguing that people will be able to build their own skyscrapers and it will change the world. I just think it would be nice if people had the tools to put up their own shelves if they wanted to.
    1. Debugging is the process of finding and removing errors (bugs) from a software program. Bugs occur in programs when a line of code or a statement conflicts with other elements of the code. We also call errors or defects in hardware bugs.

      Debugging and debugging software

      Debugging is the process of finding and removing errors (bugs) from a software program. Bugs occur in programs when a line of code or a statement conflicts with other elements of the code. We also call errors or defects in hardware bugs.

    1. Review: a formal assessment or examination of something with the possibility or intention of instituting change if necessary.

      (comment with good examples of code review comments)

  7. Jun 2022
    1. YouArentGonnaNeedIt (often abbreviated YAGNI, or YagNi on this wiki) is an ExtremeProgramming practice which states: "Always implement things when you actually need them, never when you just foresee that you need them."

      Only implement features in code when you actually need them. Never implement features that you anticipate needing, because you aren't gonna need it (YAGNI).

    1. But to my knowledge, this is the first time anyone has collected public info about Bigco dev environments in one place

      Examples of big companies moving to development in the cloud

    1. It is NOT an exception if the username is not valid or the password is not correct. Those are things you should expect in the normal flow of operation. Exceptions are things that are not part of the normal program operation and are rather rare.

      Exceptions are things that are not part of the normal program operation and are rather rare.

    2. Exceptions should be reserved for what's truly exceptional.

      Exceptions should be reserved for what is truly exceptional.

    3. Make sure the exceptions are at the same level of abstraction as the rest of your routine.

      Make sure that exceptions are at the same level of abstraction as the rest of your routine.

    4. Don't use exceptions if the error can be handled locally

      Don't use exceptions if the error can be handled locally.

    5. Use exceptions to notify about things that should not be ignored.

      Use exceptions for things that should not be ignored.

    6. if the function's assumptions about its inputs are violated, it should throw an exception instead of returning normally.

      If a function's assumptions about it's inputs are violated, throw an exception.

  8. May 2022
    1. I think RSpec should provide around(:context)/around(:all). Not because of any particular use case, but simply for API consistency. It's much simpler to tell users "there are 3 kinds of hooks (before, after and around) and each can be used with any of 3 scopes (example, context and suite)". Having some kinds of hooks work with only some kinds of scopes makes the API inconsistent and forces us to add special case code to emit warnings and also write extra documentation for this fact.
    2. I've been thinking of looking into implementing this in rspec-core, primarily to make the API more consistent (e.g. so that you can combine any scope -- example/context/suite -- with any hook type before/after/around).
    1. Knuth recommended getting familiar with the program by picking up one particular part and "navigating" the program to study just that part. (See https://youtu.be/D1jhVMx5lLo?t=4103 at 1:08:25, transcribed a bit at https://shreevatsa.net/tex/program/videos/s04/) He seems to find using the index (at the back of the book, and on each two-page spread in the book) to be a really convenient way of "navigate" the program (and indeed randomly jumping through code, as you said), and he thinks that one of the convenient things about the "web" format is that you can explore it the way you want. This is really strange (to us) as the affordances we're used to from IDEs / code browsers etc are really not there

      I can't help but think that currentgen programmers are misunderstanding Knuth and anachronizing him, with their being a product of the current programming regime where most never lived in a world without structured programming, for example, when we hear "literate programming", we attempt to understand it by building off our conception of current programming practices and try to work out what Knuth could mean given widespread modern affordances as a precondition, when really Knuth is just advocating for something that approximates (with ink and paper) currentgen tooling, and is therefore in fact more primitive than our reference point which we are trying to understand as being capable of being improved upon, but Knuth's LP is an improvement nonetheless of something even more primitive further still.

    1. With every generation of computing comes a dominant new software or hardware stack that sweeps away the competition and catapults a fledgling technology into the mainstream.I call it the Canonical Stack (CS).Think the WinTel dynasty in the 80s and 90s, with Microsoft on 95% of all PCs with “Intel inside.” Think LAMP and MEAN stack. Think Amazon’s S3 becoming a near universal API for storage. Think of Kubernetes and Docker for cloud orchestration.

      Explanation of Canonical Stack (CS)

    1. By offering to have a real-time technical discussion, you are reframing the code review process away from an 'instructor correcting student' dynamic and into a 'colleagues working together' mindset.
    1. Level 5: Stop the line. The highest level of code review comments. Borrowing the term from Toyota's manufacturing process this is when the code reviewer noticed something in the PR that signals a major defect.

      Stop the line - 5th type of MR comments

    2. Level 4: Infringement. This is where things get more serious, note that infringement means rules were broken. In this context, rules can mean a number of things, from the more obvious feature spec and framework rules to things like style guides and coding principles.

      Infringement - 4th type of MR comments

    3. Level 3: Suggestions. These can also be thought of as recommendations and alternatives.

      Suggestions - 3rd type of MR comments

    4. Level 2: Nitpicks. Usually, comments about grammar errors and minor stylistic issues/typos go there. The solution to the nitpicks is usually very obvious and if the solution is opinionated, the opinion is not strongly held. Naming a method foobarGenerator vs foobarFactory goes in here, and nitpick comments often start with Nitpick:.

      Nitpicks - 2nd type of MR comments

    5. Level 1: Clarifications. I also think of these as sanity checks, I may even start the comment with something like I may be completely off the base here... or Just to sanity check...

      Clarifications - 1st type of MR comments

    1. The problem is that a lot of old school website devs can write jQuery and very very little actual JavaScript.

      This happens to be true of many of the new/up-to-date Web developers I see, too.

      Anecdote: I never really did StackOverflow, either as a reader or a contributor. One day several years ago (well after StackOverflow had taken off), I figured that since I see people complain about JS being confusing all the time and since I know JS well, then I'd go answer a bunch of questions. The only problem was that when I went to the site and looked at the JS section, it was just a bunch of jQuery and framework shit—too much to simply ignore and try to find the ones that were actually questions about JS-the-language. "I know," I thought. "I'm in the JS section. I'll just manually rewrite the URL to jump to the ECMAScript section, which surely exists, right? So I did that, and I just got redirected to the JS section...

    Tags

    Annotators

    1. now something breaks elsewhere that was unsuspected and subtle. Maybe it’s an off-by-one problem, or the polarity of a sign seems reversed. Maybe it’s a slight race condition that’s hard to tease out. Nevermind, I can patch over this by changing a <= to a <, or fixing the sign, or adding a lock: I’m still fleshing out the system and getting an idea of the entire structure. Eventually, these little hacks tend to metastasize into a cancer that reaches into every dependent module because the whole reason things even worked was because of the “cheat”; when I go back to excise the hack, I eventually conclude it’s not worth the effort and so the next best option is to burn the whole thing down and rewrite it…but unfortunately, we’re already behind schedule and over budget so the re-write never happens, and the hack lives on.

      I'm having real difficulty understanding what is going on here and in what situations such cascading problems occur.

      Is it a case of under-abstraction?

    1. as if the only option we had to eat was factory-farmed fast food, and we didn’t have any way to make home-cooked meals

      See also An app can be a home-cooked meal along with this comment containing RMS's remarks with his code-as-recipe metaphor in the HN thread about Sloan's post:

      some of you may not ever write computer programs, but perhaps you cook. And if you cook, unless you're really great, you probably use recipes. And, if you use recipes, you've probably had the experience of getting a copy of a recipe from a friend who's sharing it. And you've probably also had the experience — unless you're a total neophyte — of changing a recipe. You know, it says certain things, but you don't have to do exactly that. You can leave out some ingredients. Add some mushrooms, 'cause you like mushrooms. Put in less salt because your doctor said you should cut down on salt — whatever. You can even make bigger changes according to your skill. And if you've made changes in a recipe, and you cook it for your friends, and they like it, one of your friends might say, “Hey, could I have the recipe?” And then, what do you do? You could write down your modified version of the recipe and make a copy for your friend. These are the natural things to do with functionally useful recipes of any kind.

      Now a recipe is a lot like a computer program. A computer program's a lot like a recipe: a series of steps to be carried out to get some result that you want. So it's just as natural to do those same things with computer programs — hand a copy to your friend. Make changes in it because the job it was written to do isn't exactly what you want. It did a great job for somebody else, but your job is a different job. And after you've changed it, that's likely to be useful for other people. Maybe they have a job to do that's like the job you do. So they ask, “Hey, can I have a copy?” Of course, if you're a nice person, you're going to give a copy. That's the way to be a decent person.

    2. If you’re a coder, when’s the last time you just quickly built something to solve a problem for yourself or simply because it was a fun idea?

      And how future-proof was the result or how easy was it to make sure you could share it with others in a form that they could make use of (and not be dependent on you or some third-party or their internet connection)?

    1. This column will continue only if I hear from people who use literate-programming systems that they have not designed themselves. and it did not continue.
    1. To keep tiny mistakes from crashing our software or trashing our data, we write more software to do error checking and correction.

      This is supposed to be the justification for increasing code size. So what's the excuse for projects today? Software of today is not exactly known for adding more "error checking and correction". It feels more like growth for growth's sake, or stimulating some developer's sense of "wouldn't it be cool if [...]?".

    1. suppose when you needed to make a permanent edit to the style sheet on your homepage, you opened up the CSS viewer, made the edit, and the result persists—not just in your browser, but by changing the very style sheet itself
    1. an acknowledgement of network effects: LP is unlikely to ever catch on enough to be the majority, so there needs to be a way for a random programmer using their preferred IDE/editor to edit a "literate" program

      This is part of the reason why I advocate for language skins for comparatively esoteric languages like Ada.

    2. in other words, there would be no "weave" step

      Well, there could still be a weave step—same as there is like with triple scripts (to go from compilation form back to the original modules) or with Markdown, which should be readable both as plain text and in rendered form.

    1. memory usage and (lack of) parallelism are concerns

      Memory usage is a concern? wat

      It's a problem, sure, if you're programming the way NPMers do. So don't do that.

      This is a huge problem I've noticed when it comes to people programming in JS—even, bizarrely, people coming from other languages like Java or C# and where you'd expect them to at least try to continue to do things in JS just like they're comfortable doing in their own language. Just because it's there (i.e. possible in the language, e.g. dynamic language features) doesn't mean you have to use it...

      (Relevant: How (and why) developers use the dynamic features of programming languages https://users.dcc.uchile.cl/~rrobbes/p/EMSE-features.pdf)

      The really annoying thing is that the NPM style isn't even idiomatic for the language! So much of what the NodeJS camp does is so clearly done in frustration and the byproduct of a desire to work against the language. Case in point: the absolutely nonsensical attitude about always using triple equals (as if to ward off some evil spirits) and the undeniable contempt that so many have for this.

  9. www.mindprod.com www.mindprod.com
    1. local a (e.g. aPoint) param p (e.g. pPoint) member instance m (e.g. mPoint) static s (e.g. sPoint)

      This is really only a problem in languages that make the unfortunate mistake of allowing references to unqualified names that get fixed up as if the programmer had written this.mPoint or Foo.point. Even if you're writing in a language where that's possible, just don't write code like that! Just because you can doesn't mean you have to.

      The only real exception is distinguishing locals from parameters. Keep your procedures short and it's less of a problem.

    1. This can get much worse than the above example; the number of \’s required is exponential in the nesting depth. Rc fixes this by making the backquote a unary operator whose argument is a command, like this: size=‘{wc -l ‘{ls -t|sed 1q}}
    1. The argument used to propose its use is to avoid the construction of multiple volatile objects. This supposed advantage is not real in virtual machines with efficient garbage collection mechanisms.

      Consider a Sufficiently Smart Compiler/Runtime where a multiply-instanced class has the exact same runtime characteristics as code that has been hand-"tuned" to use a singleton.

    1. When creating a singleton, the author is making the assumption that no program will ever have any reason to have more than one instance of the class.  This is a big assumption, and it often proves wrong later on when the requirements change.
    2. Avoid singletons from the start.
    1. Stop using TODO for everything in your comments that requires you to do something later.

      Possible alternatives of TODO: * FIXME - something is broken * HACK/OPTIMIZE - the code is suboptimal and should be refactored * BUG - there is a bug in the code * CHECKME/REVIEW - the code needs to be reviewed * DOCME - the code needs to be documented (either in codebase or external documentation) * TESTME - the specified code needs to be tested or that tests need to be written for that selection of code

  10. Apr 2022
    1. I'm not sure what $name is

      This post is filled with programming/debugging missteps that are the result of nothing other than overlooking what's already right in front of the person who's writing.

    2. comparing the event and window.event isn't enough to know if event is a variable in scope in the function or if it's being looked up in the window object

      Sounds like a good use case for an expansion to the jsmirrors API.

    1. Then, if the string can be represented as ASCII, only one byte of memory is used per character. If the string uses more extended characters, it might end up using as many as 4 bytes per character. We can see how much memory an object needs using sys.getsizeof()

      "a" takes less bytes than "❄", which takes less bytes than "💵"

    1. I feel like better code visualization would solve a lot of my problems. Or at least highlight them.

      The other commenter talks about a typical sw.eng. approach to visualization (flame graphs), but I want programs visualized as a manufacturing/packing/assembly line on a factory floor. Almost like node editors like Unreal's Blueprints, but in three dimensions, and shit visibly moving around between tools on the line in a way that you can actually perceive. Run the testcase on a loop, so you have a constant stream of "shit visibly moving around", and it runs at fractional speed so the whole process takes, say 10 seconds from front-to-back instead of near instantaneously like it normally would (and allow the person who's debugging to control the time scaling, of course). You find bugs by walking the line and seeing, "oh, man, this purple shit is supposed to be a flanged green gewgaw at this point in the line", so you walk over and fix it.

      (This is what I want VR to really be used for, instead of what's capturing people's attention today—games and lame substitutes for real world interaction like Zuckerberg is advocating for.)

    1. Let’s look at a recent paper by Xia, Bao, Lo, Xing, Hassan, & Li entitled Measuring Program Comprehension: A Large-Scale Field Study with Professionals and published in IEEE Transactions on Software Engineering, 44, 951-976, 2018. This paper is quite interesting in that it describes in great details how the figures are obtained. And it says that Comprehension took on average ~58%.

      Developers spend most of their time figuring the system out

    1. The SE server is also responsible for building ebooks when they get released or updated. This is done using our ebook production command line toolset.

      It would be great if these tools were also authored to be a book—a comprehensive, machine-executable runbook.

    1. # Input Input: 123, Output: Input: 121, Output: Input: 111, Output: Input: 123454321, Output: Input 123123, Output: # Instruction Output true if input is a palindrome # Output Input: 123, Output: false Input: 121, Output: true Input: 111, Output: true Input: 123454321, Output: true Input 123123, Output: false

      Example of using GPT-3 for programming

    1. Using named arguments is nice for languages that support it, but this is not always a possibility. Even in Python, where time.sleep is defined with a single argument named secs, we can’t call sleep(secs=300) due to implementation reasons. In that case, we can give the value a name instead.Instead of this:time.sleep(300)Do this:sleep_seconds = 300 time.sleep(sleep_seconds)Now the code is unambiguous, and readable without having to consult the documentation.

      Putting units in variable names

    1. Core: like an engine in a car. The product is meaningless without it.Necessary: like a car’s spare wheel. It’s rarely used but when needed, its function decides the success of the system.Added value: like a car’s cup-holder. It’s nice to have but the product is perfectly usable without it.Unique Selling Point: the main reason people should buy your product instead of your rivals. For example, your car is the best off-road vehicle.

      4 categories of software features

  11. Mar 2022
    1. front-end dumpster fires, where nothing that is over 18 months old, can build, compile or get support anymore. In my day job, I inherit "fun" tasks as 'get this thing someone glued together with webpack4 and frontend-du-jour to work with webpack5 in 2022
    1. In 1994, The Unix-Haters Handbook was published containing a long list of missives about the software—everything from overly-cryptic command names that were optimized for Teletype machines, to irreversible file deletion, to unintuitive programs with far too many options. Over twenty years later, an overwhelming majority of these complaints are still valid even across the dozens of modern derivatives. Unix had become so widely used that changing its behavior would have challenging implications. For better
    1. Object hierarchies are very different from relational hierarchies. Relational hierarchies focus on data and its relationships, whereas objects manage not only data, but also their identity and the behavior centered around that data.
    1. it doesn't mean that we actually want all the instances in the heap to be reinitialized

      It's conceivable that people would find it overly cumbersome having to deal with this when prototyping from a REPL—enough to consider it a bad experience to keep them from trying.

      A live IDE could recognize that the user probably doesn't want that to happen for a given object, since it only just appeared a little while ago, so it should offer some fixup to save time for the user.

    1. The PA group has given the name cliche to commonly used programming constructs.

      Later the industry began to call them "patterns" (cf Gabriel).

    1. Another unanchored thought I've had on these matters is coming around to viewing namespace collision as a feature, not a bug. If a programming system is designed to allow you to link against a given module and more or less ignore any and every transitive dependency that this will bring in—because the programming environment makes it excessively easy to do so—then that's a pretty strong reason to consider whether or not that approach to information hiding is actually an anti-feature.

      On the other hand, if during your work on a program you have to reconcile the names used within the system (i.e., such that no two module names collide), then it subtly encourages you to make sure you are able to account for every module that your program depends on.

      People reflexively assume that this would make it cumbersome (or even intractable) to work on a program any larger than a toy, but empiraclly we can observe that a single, shared namespace can, by and large, scale way better than these protests would lead us to believe. It's not out of the question that a project might reach, say, 100kloc with very little friction arising as a consequence of this sort of forced reckoning. (And it's worth considering of the friction that it does impose: is it any worse than the costs we've observed over the last ~10 years from the systems that set out to solve this problem?)

    2. Understanding a strange codebase is hard.

      John Nagle is fond of making the observation that there are three fundamental and recurring questions that dominate one's concerns when programming in C.

      More broadly (speaking of software development generally), one of the two big frustrations I have when dealing with a foreign codebase is the simple question, "Where the hell does this type/function come from?" (esp. in C and, unfortunately, in Go, too, since the team didn't take the opportunity to fix it there when they could have...). There's something to be said for Intellisense-like smarts in IDEs, but I think the criticism of IDEs is justified. I shouldn't need an IDE just to be able to make sense of what I'm reading.

      The other big frustration I often have is "Where does the program really start?" Gilad Bracha seems to really get this, from what I've understood of his descriptions about how module definitions work in Newspeak. Even though it's reviled, I think Java was really shrewd about its decisions here (and on the previous problem, too, for that matter—don't know exactly where FooBar comes from? welp, at least you can be reasonably sure that it's in a file called FooBar.java somewhere, so you can do a simple (and cheap) search across file names instead of a (slow, more expensive) full-text search). Except for static initializers, Java classes are just definitions. You don't get to have live code in the top-level scope the way you can with JS or Python or Go. As cumbersome as Java's design decision might feel like it's getting in your way when you're working on your own projects and no matter how much you hate it for making you pay the boilerplate tax, when it comes to diving in to a foreign codebase, it's great when modules are "inert". They don't get to do anything, save for changing the visibility of some symbol (e.g. the FooBar of FooBar.java). If you want to know how a program works, then you can trace the whole thing, in theory, starting from main. That's really convenient when it means you don't have to think about how something might be dependent on a loop in an arbitrary file that immediately executes on import, or any other top-level diddling (i.e. critical functionality obscured by some esoteric global mutable state).

  12. Feb 2022
    1. the guide shall be written in such a way that all we have to do is produce the guide itself and then a computer can do the heavy lifting—where we might otherwise expect a separate, possibly GUI-driven, "app" to be created for the end user to interact with, we accomplish the same effect by making the guide very detailed—in part also an attempt to evoke the style and quality of old equipment operation and repair manuals that used to be available, when such manuals could be expected to include e.g. full schematics. If done correctly, this should be sufficient for the guide itself to be interpretable by a machine.

      "comprehensive codebook"?

    Tags

    Annotators

    1. "Context" manipulation is one of big topic and there are many related terminologies (academic, language/implementation specific, promotion terminologies). In fact, there is confusing. In few minutes I remember the following related words and it is good CS exam to describe each :p Thread (Ruby) Green thread (CS terminology) Native thread (CS terminology) Non-preemptive thread (CS terminology) Preemptive thread (CS terminology) Fiber (Ruby/using resume/yield) Fiber (Ruby/using transfer) Fiber (Win32API) Generator (Python/JavaScript) Generator (Ruby) Continuation (CS terminology/Ruby, Scheme, ...) Partial continuation (CS terminology/ functional lang.) Exception handling (many languages) Coroutine (CS terminology/ALGOL) Semi-coroutine (CS terminology) Process (Unix/Ruby) Process (Erlang/Elixir) setjmp/longjmp (C) makecontext/swapcontext (POSIX) Task (...)
    1. This (somewhat contrived) example allows the inner loop to abandon processing early: callcc {|cont|   for i in 0..4     print "\n#{i}: "     for j in i*5...(i+1)*5       cont.call() if j == 17       printf "%3d", j     end   end }
  13. Jan 2022
    1. Make simple changes to (some carefully chosen fork of) any project in an afternoon, no matter how large it is. Gain an hour’s worth of understanding for an hour’s worth of effort, rather than a quantum leap in understanding after a week or month of effort.

      Accessibility is more important, after all, than Kartik says it is (elsewhere; cf recent Mastodon posts).

  14. www.npmjs.com www.npmjs.com
    1. The yieldable objects currently supported are: promises thunks (functions) array (parallel execution) objects (parallel execution) generators (delegation) generator functions (delegation) Nested yieldable objects are supported, meaning you can nest promises within objects within arrays, and so on!
    1. <a href="https://web.hypothes.is/help/" class="hyp-u-horizontal-spacing--2 hyp-u-layout-row--center HelpPanel-tabs__link" target="_blank" rel="noopener noreferrer"><span>Help topics</span>

      How to get remote control over the Hypothesis sidebar (one way, at least):

      1. Use the bookmarklet to open the sidebar
      2. Click the sidebar's "Help" icon in the top right
      3. Right click the "Help topics" link and select "Inspect" in the context menu to open the element in the browser devtools
      4. Remove "noopener" from the link (easiest way is to just delete the element's "rel" attribute)
      5. Change the link target to something other than "_blank" (e.g. "foobar")
      6. In the sidebar, click the now-modified "Help topics" link
      7. For good measure, in the new tab that opens, navigate to the same URL loaded in the sidebar (should be something like https://hypothes.is/app.html with a site-specific URL fragment; you can get the actual URL from the devtools JS console with document.documentURI, or right-clicking the sidebar and selecting "View Frame Info")

      From the secondary tab ("foobar" opened by click in step #6) you should now have unrestricted, scriptable access to the DOM of the original sidebar iframe, using e.g. the JS console in devtools instance or a bookmarklet applied to the secondary tab—access it as window.opener.

    Tags

    Annotators

    1. Smalltalk image is unlike a collection of Java class files in that it can store your programs (both source and compiled bytecode), their data, and execution state. You can quit and save your work while some code is executing, move your image to an entirely different machine, load your image… and your program picks up where it left off.

      Advantage of *Smalltalk** VM

    2. Smalltalk has a virtual machine which allows you to execute your code on any platform where the VM can run. The image however is not only all your code, but the entire Smalltalk system, including said virtual machine (because of course it’s written in itself).

      Smalltalk has a VM

    1. This was because dynamic typing doesn’t give the safety net that static typing does. So you write more tests. Which is a good thing.

      Tests are a good thing, but not all devs are even aware of the loss of safety net and so there's no guarantee that using a dynamic language results in more tests.

      Using tests and static-types together would mean that there's whole categories of bugs that get eliminated while also getting more coverage for less lines of test-code.

  15. Dec 2021
    1. I think one of the ways that remote work changes this is that I can do other things while I think through a tricky problem; I can do dishes or walk my dog or something instead of trying to look busy in a room with 6-12 other people who are furiously typing because that's how the manager and project manager understand that work gets done.

      Way work often looks like during remote dev work

    1. What is an assembler language? https://en.itpedia.nl/2019/11/11/wat-is-een-assembler-taal/ An #assembler_language is a low-level programming_language designed for a specific processor type. We can produce Assembler by compiling #source_code from a high-level programming language (such as C / C ++). But we can also write #programs in this language ourselves. In turn, we can convert Assembler_code into machine_code using an assembler.

  16. Nov 2021
    1. What Makes Ruby on Rails Perfect for Marketplace Development?AlinaE-Commerce & SaaS StrategistMarketplaceRuby/RailsHomeBlogEntrepreneurshipWhat Makes Ruby on Rails Perfect for Marketplace Development?PublishedJul 13, 2020UpdatedJul 13, 202012 min readThe last several years have been marked with the rise of different marketplaces. Airbnb, AliExpress, Etsy, Booking.com are on everyone’s lips. That's not surprising that the idea of launching a second Amazon or eBay seems so appealing. To win the e-commerce race, entrepreneurs focus on providing excellent customer experience and build fast-loading and scalable websites. Besides, business owners take various security measures to protect their customers’ sensitive information. This way, they can gain clients’ trust and boost sales. When building a custom marketplace, what technology stack is best to achieve all these goals? Our answer is simple: Ruby on Rails. In this article, we will fill you in on the Ruby on Rails marketplace development. At Codica, we are passionate fans of this framework and have built numerous e-commerce platforms with its help. Based on our experience, we will discuss the key reasons to choose RoR for building a successful marketplace.

      The last several years have been marked with the rise of different marketplaces. Airbnb, AliExpress, Etsy, Booking.com are on everyone’s lips. That's not surprising that the idea of launching a second Amazon or eBay seems so appealing.

      To win the e-commerce race, entrepreneurs focus on providing excellent customer experience and build fast-loading and scalable websites. Besides, business owners take various security measures to protect their customers’ sensitive information. This way, they can gain clients’ trust and boost sales.

      When building a custom marketplace, what technology stack is best to achieve all these goals? Our answer is simple: Ruby on Rails.

      In this article, we will fill you in on the Ruby on Rails marketplace development. At Codica, we are passionate fans of this framework and have built numerous e-commerce platforms with its help. Based on our experience, we will discuss the key reasons to choose RoR for building a successful marketplace.

  17. Oct 2021
    1. The main idea behind the space-based pattern is the distributed shared memory to mitigate issues that frequently occur at the database level. The assumption is that by processing most of operations using in-memory data we can avoid extra operations in the database, thus any future problems that may evolve from there (for example, if your user activity data entity has changed, you don’t need to change a bunch of code persisting to & retrieving that data from the DB).The basic approach is to separate the application into processing units (that can automatically scale up and down based on demand), where the data will be replicated and processed between those units without any persistence to the central database (though there will be local storages for the occasion of system failures).

      Space-based architecture

    2. Microservices architecture consists of separately deployed services, where each service would have ideally single responsibility. Those services are independent of each other and if one service fails others will not stop running.

      Microservices architecture

    3. First of all, if you know the basics of architecture patterns, then it is easier for you to follow the requirements of your architect. Secondly, knowing those patterns will help you to make decisions in your code

      2 main advantages of using design patterns:

      • easier to follow requirements of an architect
      • easier to make decisions in your code
    4. Mikrokernel Architecture, also known as Plugin architecture, is the design pattern with two main components: a core system and plug-in modules (or extensions). A great example would be a Web browser (core system) where you can install endless extensions (or plugins).

      Microkernel (plugin) architecture

    5. The idea behind this pattern is to decouple the application logic into single-purpose event processing components that asynchronously receive and process events. This pattern is one of the popular distributed asynchronous architecture patterns known for high scalability and adaptability.

      Event-driven architecture: high scalability and adaptability

    6. It is the most common architecture for monolithic applications. The basic idea behind the pattern is to divide the app logic into several layers each encapsulating specific role. For example, the Persistence layer would be responsible for the communication of your app with the database engine.

      Layered architecture

    1. Another option is the use the functional library Ramda, while the syntax may be a bit different from the Ruby and Pure JS version, I find it to be more declarive: list = [null, "say", "kenglish", "co", null] R.reject(R.isNil, list) // return new array [ 'say', 'kenglish', 'co' ]
    1. In my method, program segments are embedded in the midst of a word processor document--like raisins in cake--so that the emphasis is on the explanation rather than the code.
    1. Any language or system that does not allow full flowing and arbitrarily long comments is seriously behind the times. That we use escape characters to “escape” from code to comment is backwards. Ideally, comment should be the default, with a way to signal the occasional lines of code.

      Sounds like literate programming.

    1. I'm not a naturally quick programmer. Learning to program was a real struggle for me and I was pretty slow at it for a long time (and I still am in aspects that I haven't practiced). My "one weird trick" is that I've explicitly worked on speeding up things that I do frequently and most people have not.
    1. Ungar, around @1:00:00:

      I try to explain to people that the notion of compiler is broken. Of course I learned this from Smalltalk, but what we want to build is experiences--artificial realities that convince you that your source code is real. It's directly executed. There's no lag between editing and running[...] The environment stresses things in your program, not tools--which is another rant I have. It's this whole idea that we want to put you in an artificial reality--I got that from Randy [Smith]--in which it's easy and natural and low-cognitive-burden to get the computer to do what you want it to do, rather than running language translators that turn weird strings of text into bits the machine can run

    1. Wet behind the ears: the ones that have just started working as a professional programmers and need lots of guidance. Sort of knows what they are doing: professional programmers, who have sort of figured what is going on and can mostly finish their tasks on their own. Experienced: the ones who have been around the block for a while and are most likely the brains behind all the major design decisions of a large software project. Coworkers usually turn to them when they need advice for a hard technical problem. Some programmers will never reach this level, despite their official title stating otherwise (but more on that later).

      3 levels of programming experience:

      1. wet behind the ears
      2. sort of knows what they are doing
      3. experienced
    1. The problem with the first approach is that it considers software development to be a deterministic process when, in fact, it’s stochastic. In other words, you can’t accurately determine how long it will take to write a particular piece of code unless you have already written it.

      Estimation around software development is a stochastic process

  18. Sep 2021
    1. you're guilty of making the same mistake as people who used to say that templates and styles and JavaScript should be in separate files

      At last, another one realizing that they ha dbeen structuring MVC web-apps counter-intuitively for decades.