I’ve got just 2 now. Codium and Blackbox.ai. Not because they’re the best, but because I’m a cheapskate hobbyist and they’re free :)
I’m only just starting to play with AI tooling, so I don’t have an opinion on which is better, but something about the way Blackbox worked within VSCode means I went through the hassle of getting it installed to vscodium when I switched.
I suspect that Codium might be better at oddball stuff, though, like OpenSCAD. Blackbox seems to just make bad guesses while trying to regurgitate code I’ve already written. Codium seems to have at least a primitive idea of what’s going on with OpenSCAD. But Blackbox does a great job of cleaning up my comments and even generating decent comments for uncommented code.
FWIW, Codium actually labels OpenSCAD as “experimental”, but I don’t know if that’s just boilerplate for something it’s never been trained on or whether there is some training data in its system.
Blackbox is a pain to work with in other ways, though. It was like pulling teeth to get an account and I still can’t find anything on their pricing–or any documentation, for that matter–despite language suggesting that there are different tiers and a chat UI that offers different settings (like web browsing mode and fun mode). And the Blackbox name isn’t doing it any favours, given that “black box” is a generic term in the AI community and others. It’s own chat doesn’t seem to know that a question about the service might be about the service instead of the generic term.
I don’t know this particular project but honestly having your government documents and policies made available on Codeberg/GitLab/Github and available for PRs is actually an interesting idea. The government would still need to be the owners and ultimately decide on what gets merged, but the transparency and opportunity for accessible civic engagement would be kinda sweet.
The same reason people drive their car to buy groceries.
You bought it for something where it was the only option, driving 30km to work everyday. But ever since you got it, the trip to the super market is kinda too hot in the summer and too cold in the winter and what if you spontaneously need to buy more than expected?
People learn it for front end dev, and then they use what they know for back end too.
Like == but more strict. The == operator will do type conversion, so 0 == ‘’ will actually be true, as an example. Sometimes (honestly, most times) you may want to compare more strictly.
One neat feature is you can compare to both null and undefined at the same time, without other falsey values giving false positives. Although that’s not necessary as often now that we have nullish coalescing and optional chaining.
I just tested and Terser will convert v === null || v === undefined to null==v. Personally I would prefer to read the code that explicitly shows that it is checking for both and let my minifier/optimizer worry about generating compact code.
The short answer is that your language needs === when it fucked up the semantics of ==, but it’s also too popular and you can’t fix it without breaking half the web.
It’s also important if you’re checking hashes (at least, it was - if you’re using correct hashing algorithm that isn’t ancient, you will not have this problem).
Because if you take for example “0e462097431906509019562988736854” (which is md5(“240610708”), but also applicable to most other hashing algorithms that hash to a hex string), if(“0e462097431906509019562988736854” == 0) is true. So any other data that hashes to any variantion of “0e[1-9]+” will pass the check, for example:
I did use md5 as an example because the strings are pretty short, but it’s applicable to a whole lot of other hashes. And the problem is that if you use one of the strings that hash to a magic hash in a vulnerable site, it will pass the password check for any user who’s password also hashes to a magic hash. There’s not really a high chance of that happening, but there’s still a lot of hashes that do hash to it.
For unit tests, you should know the input and expected output from the start. Really responsible devs write the unit tests first, because you should know what you’re going to put in and what you’ll get out before you start writing anything. If you find yourself making the same mistakes in your tests as you do your code, you might be trying to do too much logic in the test itself. Consider moving that logic to its own testable class, or doing a one-time generation of a static set of input/output values to test instead of making them on the fly.
How granular your tests should be is a matter of constant debate, but generally I believe that different file/class = different test. If I have utility method B that’s called in method A, I generally test A in a way that ensures the function of B is done correctly instead of writing two different tests. If A relies on a method from another class, that gets mocked out and tested separately. If B’s code is suitably complex to warrant an individual test, I’d consider moving to to its own class.
If you have a super simple method (e.g. an API endpoint method that only fetches data from another class), or something that talks with an external resource (filesystem, database, API, etc.) it’s probably not worth writing a unit test for. Just make sure it’s covered in an integration test.
Perhaps most importantly, if you’re having a lot of trouble testing your code, think about if it’s the tests or the code that is the problem. Are your classes too tightly coupled? Are your external access methods trying to perform complex logic with fetched data? Are you doing too much work in a single function? Look into some antipatterns for the language/framework you’re using and make sure you’re not falling into any pitfalls. Don’t make your tests contort to fit your code, make your code easy to test.
If ever you feel lost, remember the words of the great Testivus.
Really responsible devs write the unit tests first, because you should know what you’re going to put in and what you’ll get out before you start writing anything.
I’ve obviously heard the general concept, but this is actually pretty helpful, now that I’m thinking about it a bit more.
I’ve written pretty mathy stuff for the most part, and a function might return an appropriately sized vector containing what looks like the right numbers to the naked eye, but which is actually wrong in some high-dimensional way. Since I haven’t even thought of whatever way it’s gone wrong, I can’t very well test for it. I suppose what I could do is come up with a few properties the correct result should have, unrelated to the actual use of it, and then test them and hope one fails. It might take a lot of extra time, but maybe it’s worth it.
How do you deal with side effects, if what you’re doing involves them?
For your vector issue, I’d go the route of some static examples if possible. Do you have a way to manually work out the answer that your code is trying to achieve?
For side effects, that may indicate what I referred to as tightly coupled code. Could you give an example of what you mean by “side effect”?
For your vector issue, I’d go the route of some static examples if possible. Do you have a way to manually work out the answer that your code is trying to achieve?
Not necessarily. In this scenario I’d imagine it’s a series of numbers as opposed to something more human-friendly exactly because there’s internal complexity that’s important but hard to manually survey, let alone generate. If you’ve worked with GANs at all, maybe it’s a point in a latent space.
For side effects, that may indicate what I referred to as tightly coupled code. Could you give an example of what you mean by “side effect”?
I mean it in the standard functional language way, if you’re familiar. There’s an operation that happens at some step of an algorithm, and it changes a data structure which is referred to or updated at another step. Sometimes you can’t really avoid it, because the problem itself has an interconnection like that.
A sorting algorithm example, if that doesn't make this too complicated.Concurrency it’s pretty much guaranteed to do it, so let’s say we’re trying to implement some sort of bespoke sorting algorithm, where each compare is large and complex enough we have bugs, and which runs in multiple threads. If threads are interfering with each other in this program, how do you test for that? The whole thing won’t give expected results, obviously, but another unsorted array or a failure to terminate doesn’t tell you much. Each compare and each swap might look correct at first, and give properly typed results. Let’s assume that each thread might traverse to anywhere in the array, so you can’t just check when they’re overlapping.
Open source is not a license. Open source literally just means that the source is openly available. It does not include the right for you to reuse or change any of the source.
That’s why most of the time, people are talking about “Free Open Source Software” (FOSS) when they think of openly licensed source code.
That’s why you can publish your project on e.g. Github (= open source) but if you don’t add a license statement, your work is still protected by an “all rights reserved copyright”. (= not free)
Anyhow, I would not necessarily deem a project OSS, just because the used language is readable by default. To me, OSS needs at least the developers intention to make it openly available.
Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose.
Well put me in a dress and call me Sheryl. Never knew that the “accepted definitions” were really that close. Thanks!
I knew that some definitions of OSS were really basic (as in “as long as there is source at some point”) but I didn’t know that the OSI definition was so close to the idea of “free software”.
While I agree with you , the Open Software Initiative doesn’t :
Open source doesn’t just mean access to the source code.
So according to the OSI’s definition of open source , a project being public on github , but with out a license or with a license which does not comply with the requirements set out by the OSI
programmer_humor
Active
This magazine is from a federated server and may be incomplete. Browse more on the original instance.