Hacker News new | past | comments | ask | show | jobs | submit | devthane's comments login

Just finished working through part 1 and subscribed! Thank you so much! I've always been interested in learning ML but the math has been the hurdle for me that seems to have been assumed knowledge elsewhere. Saw the title and was immediately hooked! Can't wait for more.


I'm working on this series of articles for folks like you! So glad to hear that you found it useful. Stay tuned for part 2!


Typically you mock them in unit tests.


I've rarely found this to be worth it, for the effort required for a proper mock, in a complex system. I've seen most people mock in ways that are so superficial that it's basically a no-op.


Mocks are a contentious topic as you've probably guessed. In my opinion they're a sign of coupled code, you should be able to hit very high coverage without a single mock, but if you're a dev in an org that tracks code coverage you'll probably end up writing a fair number of them since the odds are high you'll be consuming coupled code.


If you have a dependency like a third party API (or even internal code), and you write an API client, then depend on that client, would it be considered couple code?

In such cases, if I am using dependency injection and creating a (stub?) versions of that client which returns a hardcoded or configured output, would that be considered a mock? OR would this be OK and not "coupled"?


I think mocking with DI makes perfect sense.

Most people will say something like for unit tests you should test your functions by passing the state as parameters to test. I'm going to call this "outside in" loose coupling.

Mocking is for the inverse. When you want to test a unit of code that is calling some other outside unit code. Its really not any different just "inside out".

So imo with DI you gain loose coupling through dependency inversion. But because of dependency inversion you need to mock instead of passing state as params.

So I think if you are injecting a mocked stub this is still loose coupling because you are testing against its interface.

You're still passing state through your test but its coming from inside instead of outside, hence the mock.

Another way I have thought about this is: framework (framework calls you) vs library (you call library).

Frameworks naturally lend themselves to a more mock way of testing. Library lends itself to a more traditional way of testing.

Testing something that accepts a callback is also essentially a mock.

I hope that thought made sense.


Seems like such a test would be strictly less useful than a test that runs against the real dependeny.


But vastly faster.

A good rule of thumb for a unit test is that you should be able to run it a few thousand times in a relatively brief period (think: minutes or less) and it shouldn't ever fail/flake.

If a unit test (suite) takes more than a single digit number of seconds to run, it isn't a unit test. Integration tests are good to have, but unit tests should be really cheap and fundamentally a tool for iterative and interactive development. I should be able to run some of my unit tests on every save, and have them keep pace with my linter.


Testcontainers don't typically add more than a few seconds to a suite though. They are very fast.


Then don't do it in unit tests and write an integration test.


If the "thing" is a database, for example, then the way to mock it is to bring up a database container and load it with dummy data.


I was a QA tester at a transportation company with a PHP stack. My leader was great and allowed me to teach myself web development when tasks were done. Eventually I built a finance calendar in php/symfony modeled after the websites the team built.

I demo'd it to him and I was allowed to start picking up development issues. Eventually became a full time developer. Kept learning and ended up containerizing all our applications and set up a kubernetes cluster, moving us away from VMs. ( responding to a desire from all the devs to start using docker ).

Circled back around and built automation for spinning up k8s testing environments for each the story in the QA queue to simplify things for our testers. By the time I the left the company, they hired a whole company to do everything I was doing, which I held off leaving until they were set up and I was able to knowledge transfer fully to the company. Moved to GoLang also now, don't really do php anymore.

Though still get keepalived alerts when a node goes down.


I found it interesting to discover that an Ableton Live project file is a gzipped xml file as well, so you can get at the xml by gunzipping it.

I've played around with trying to generate a schema file from a project file with mixed results.

I very much wish Ableton would support this format or at least publish their schema somewhere so translation could be done.


This. I've been trying to write a VCS for Ableton projects but their schema is way too complex to try to make sense of it.

Ableton is incredibly hostile to third party devs building upon their work. Eg: There is no official documentation for any of their Python APIs.


Although the python API could be documented, it was not meant to be a public API. And it seems the open source community managed to generate the documentation.

I don't know any other DAW that allows as deep integration for third party devs through their Max for Live API.


If it was not meant to be public, then why do vendors who partner with Ableton and build hardware for Live complain about the lack of documentation?

The documentation generated by the community is severely lacking and it enables only elementary usage of the API


> it seems the open source community managed to generate the documentation

That would be terrific. Do you have more?

A while ago, I tried to cutomize a Novation Launchpad but couldn’t find coherent docs or an intro.

Some people have mastered it, as witnessed by this great extension [1]. But that’s example code, not a documentation.

[1] https://github.com/hdavid/Launchpad95


>I don't know any other DAW that allows as deep integration for third party devs through their Max for Live API.

REAPER?


Ah makes sense. I was just thinking of the "big name" ones. I need to look into Reaper again.


REAPER has unsurpassed scripting and extension, every other DAW looks like a joke in comparison.


Ya, Reaper is the only DAW (I know of) that allows me to import midi, apply fx, and render tracks via scripts.


Not really DAW but bipscript is interesting for this use case


FL Studio has a well documented python API to allows 3rd party scripts!


Kael Baldwin | DevOps Architect/Engineer | Site Reliability Engineer

Location: Tennessee, USA

Remote: Remote Only

Willing to relocate: No

Technologies: Kubernetes, Docker, GoLang, PHP, Python, JavaScript, Linux

Résumé/CV: http://www.devthane.com/resume.pdf

Email: kaelenbaldwin@gmail.com


https://kubernetes.io/docs/concepts/storage/persistent-volum...

I use https://rook.io/ to set storage up usually, they have a bunch of different options and good documentation.


It probably depends where you are located. There are some less developed countries countries that jumped the gun on hard lockdowns without any sort of care infrastructure I which people have died due to inability to get food or care for births.

For a source https://www.google.com/amp/s/mobile.reuters.com/article/amp/...

I don’t attempt to extend that to more developed countries however. And I can’t say they things wouldn’t be worse if they hadn’t locked down, but according to a family I know in Uganda, they were locked down before they had even one case. I haven’t done the research on whether that is true or not so take it or leave it.


This for certain. The piano is way more fun to play with weighted keys and much more expressive. I bought my first weighted key piano, a Roland FP-30, this year and have been playing almost every day just for the fun of it.


Whoever instigates violence is at fault, let me get that clear.

But I believe there is a responsibility on the side of organizers to be more vocal about peace than they are about the change they are trying to implement as other more righteous and respectable figures have done in the past.

If you allow your movement to become one of violence and all you have to say is to point the finger at others, whether you are correct or not, you are grossly inferior of the civil rights movements of the past.

But I believe, as many others do, that this movement was not born to achieve any measure of civil rights, though that may be the intent of many.

Making an enemy of an clear necessity of any society ( a police force ) and only being satisfied when injustice is performed on the offender is madness. There are corrupt police, do something productive about. Burning your own house down solves nothing, unless perhaps your goal is a new house.


Agreed, we use it as well, it’s shaping up nicely, though its a good bit more user complicated than other solutions. But hey, this is Kubernetes.


Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: