HNHacker News
TopNewBestAskShowJobs

okl

2,324 karma · joined March 7, 2018

submissionscomments
okl··on The big TDD misunderstanding (2022)
For C code you can use link-time substitution and a mock generator like CMock (http://www.throwtheswitch.org/cmock).

Link-time substitution means that you swap out certain objects with others when you build your test binaries.

For example, let's say your production software binary consists of a main function and objects A, B and C. For a unit test you could use a different main (the test), object B and a mock for object C - leaving out A.

okl··on The big TDD misunderstanding (2022)
"Never trust a test you didn't see fail"
okl··on The big TDD misunderstanding (2022)
> OR, it's a technique to try and combat against lazy devs,

I think that many of these practices are a result of programmers starting to code before having understood the problem in detail and before thinking through what they want to accomplish. Many times programmers feel an itch in their fingers to just start coding. TDD is an improvement for some because it forces them to think about edge cases and how to test their work results before starting to code their implementation. And bonus: they can do so while coding tests.

okl··on Scientists create artificial protein that can degrade PET plastics in bottles
Recent article suggests it can be "free" when selling the graphene, hydrogen: https://onlinelibrary.wiley.com/doi/10.1002/adma.202306763
okl··on Open-source network emulators and simulators
tc is the way to go if the options are sufficient. You can bridge two interfaces (also virtual ones) in a VM and set qdiscs. Also works asynchronously, e.g., different rules for up/downlink. Instead of a VM setup one could use a cheap linux/openWrt router or an SBC-type board.
okl··on Goodbye integers, hello UUIDv7
Need a new clock? https://retr0.id/stuff/2038/
okl··on Ask HN: What's the compile time of your project?
Once worked on a project that was regularly compiled by each developer/tester on their respective company laptops. The laptops had a weird mix of "security" software that "battled" each other in the background. Took ca. 25 minutes to compile. For fun a colleague compiled it on some project server, took less than a minute. Everyone in the department was furious when they found out.
okl··on Ask HN: Can bad code kill a product?
I have worked on several but can't go into much detail. One was a big industrial machine with a control software with 7-8 digits lines of code written in assembly language, some FORTRAN, some Ada, distributed over several processors. Problem was that the manufacturer started in the 70s and never made any attempt to document, rewrite, reengineer the system. Another project with similar characteristics suffered because they were switching tools so fast that they didn't trust them and ended up hoarding all information in the code and never deleted anything.

Both projects swallowed millions, had subcontractors that went bankrupt and are still going because without those products the respective companies would go out of business.

If you want to make an argument against duct-taping, I'd try to focus on the immediate effects, argue cost/benefit, because in my experience the demise of a project/product can be long of painful (sunken cost fallacy)

okl··on Want to pwn a satellite? Turns out it's surprisingly easy
Registers asr22/23 contain a cycle counter that you can use to time stuff. If it's not present, there's a register in the DSU that counts cycles but that requires an access via the AHB bus. You can measure a lot of things with those cycle counters, like context switch and interrupt handling times, memcpy vs naive for-loop, linear vs. binary search on small arrays...

I'd expect a few microseconds per overflow at most but it depends a lot on the characteristics of the system. Of course, if the application is not sensitive to a few microseconds here and a few microseconds there that optimization might not be worth it.

okl··on Want to pwn a satellite? Turns out it's surprisingly easy
There is a finite number of register windows, usually 8 but only 7 can be used because the 8th serves as "sentinel" to detect over- and underflow.

Once register windows are full (a function call wants to activate the next register window but there is no unused window left) window overflow occurs and a trap handler is activated.

The trap handler "unwinds" the register windows and stores all the contents in memory (stack). Now the next function can continue with an empty set of register windows. Once you return from the function, the contents of the windows have to be restored (window underflow trap).

Problem is that the trap handlers can't know which of the registers in each window were in use. Therefore all have to be saved/restored. This ratio will worsen when you write smaller functions that use less register and nest deeper.

So there are two issues: 1. You can't really know at which point in your program that underflow/overflow occurs because it changes depending on the exact path of execution through the program. 2. Unnecessary memory write/read operations. While ca. 120 x 32-bit words is not that much, with an 8-bit wide SRAM, some waitstates and EDAC this might be noticeable. (Consider that the LEON processors have a data cache for read access but for writing only a "store buffer" that queues few memory writes)

Using -mflat every register is saved by the caller/callee (as ABI demands) on the stack. This means that the memory accesses are predictable and spread out over each function call.

So, my personal conclusion is that register windows are an intriguing idea on the surface but become useless when you aren't writing 80s spaghetti code. There were many similar ideas at that time, e.g., Am29000.

okl··on Want to pwn a satellite? Turns out it's surprisingly easy
The Gaisler drivers are hideous if you're doing anything more serious than basic interface testing. Good that you are rolling your own. Consider the -mflat compiler option which can improve timing jitter and reduce memory pressure by avoiding spilling of unused registers :D
okl··on Want to pwn a satellite? Turns out it's surprisingly easy
Certainly something that applies more to cubesats and similar projects. "Normal" satellites typically carry at least an authentication unit that performs some kind of HMAC checking. You can find some of that stuff here: https://public.ccsds.org/Pubs/352x0b2.pdf

Here's an example of an AU: https://www.esa.int/Enabling_Support/Space_Engineering_Techn...

okl··on Want to pwn a satellite? Turns out it's surprisingly easy
When selecting components there's a certain range of "quality grades" to choose from ranging from commercial/automotive to space grade and radiation hardened parts. Often times a lower grade component can work with some precautions, for example, with a reset circuit in case of latch up. Many cubesats use non-space grade components because of their high price and are only expected to work for a limited time, e.g., a few years.
okl··on Ask HN: How long does it take to find a job?
Tip for your GF: always have another "card up your sleeve" when searching for opportunities. If you solely focus on the option at hand its easy to be disappointed when it doesn't work out and to dwell on it. But if you already sent out another application you have something to move on to.
okl··on Ask HN: Which math book(s) did you learn the most from?
Not really a math book but I really enjoyed "Genius At Play", a biography of John H. Conway.

Also anything from Raymond Smullyan (logic musings/riddles).

okl··on Ask HN: Am I the only one suffering from bullet points fatigue?
Sorry, this goes a bit beyond bullet points - In my opinion, this happens when people think they can work in parallel to the "formal" process because they don't need it, they are smarter then people who came before who figured out that its a good thing to collect and organize information and control its flow.

Regardless if you work according to some "formal" process or not, you are working in some way (process) which is then not "formal" (as its called in contrast to what actually?), i.e., unstructured.

Putting stuff in a mail formatted as bullet point provides the impression of it being organized but probably its not because it does not belong in that mail in the first place.

okl··on Git-appraise – Distributed Code Review for Git
I think your approach to code review is in general a good idea but don't underestimate the differences in skill level in the average project. I often work with domain experts who are not developers or beginners who are still learning basic git concepts and how to navigate the code base.
okl··on A Single-Cycle 64-Bit RISC-V Register File
It's Verilog in this article.
okl··on A surprisingly simple way to foil car thieves
Right, the image shows it connected to the battery pole. Just pop the hood, bridge the contacts. Any proper solution has to be integrated into some essential part that is difficult to access (like the ECU).

Maybe they want that thing to talk to the ECU? Otherwise, how is it locking the car?

okl··on Ariane 5 User’s Manual (2011) [pdf]
It didn't fail "due to software", it failed because the analysis wasn't redone, that came to the conclusion that range checks, as specified by the Ada programming language, can be disabled to increase performance.
okl··on The growing pains of database architecture
The "Active Record" pattern is used by many ORMs. Are you saying those ORMs use an antipattern?
okl··on Ask HN: Largest Postgres DBs?
For me, your numbers underline the "premature optimization is the root of all evil" saying. Maybe misunderstanding the performance implications of different orders of mangitudes is similar to the lack of understanding in statistics. I often encounter colleagues or customers who worry about some data structure or table when there are 10s of thousands of entries which is actually not enough to spend that much time worrying about.
okl··on Clever code considered harmful
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."
okl··on Clever code considered harmful
Writing code in a way that it can be understood by coworkers is a prerequisite for collaboration.
okl··on Clever code considered harmful
You describe an appeal to accomplishment fallacy. Whether or not someone has done x or y themselves has no bearing on whether your code has quality issues.
okl··on Ask HN: What concept opened your mind to a new world?
Understanding that a .zip file can be seen as a program that's interpreted by the decompressor.
okl··on Requirements (2007)
Requirements serve to define the goal/agree on what's in what's out. If that can't be spelled out in sufficient detail (regardless of form), production shouldn't begin - make a prototype (or something else that helps define the work to be done)
okl··on Requirements (2007)
I don't know how exactly you'd do that and depending on the project it might be fine.

One important feature of a requirements tool is that it allows you to "tag" a set/document of requirements with a version that corresponds to your released artifacts and create "diffs" between such versions. I don't think that's possible with plain Jira(?)

okl··on Requirements (2007)
The article focuses more on requirements but I think that traceability is at least equally important -- Why (what is the justification) to include feature X (in this way)? If this is disregarded it becomes difficult to work economically towards a goal. Unfortunately, it is often the way things are done because a) people want to satisfy their curiosity and "play" around with new things (which is fine if kept in check), b) problems are complex or poorly understood and doing something is easier than finding out.
okl··on Requirements (2007)
The name SRS for a "software requirements specification" is well established and depending on how it's understood it could be written by the customer or written by the supplier. Colloquially, both "requirements" and "specification" are regularly used to refer to such document. It is similar to calling a document that describes test instructions either a "test specification" or a "test procedure" -- different people/projects/companies, different conventions.

What matters is to have a common understanding and work together.

← PreviousPage 3 of 19Next →