Hacker Newsnew | past | comments | ask | show | jobs | submit | galephico's commentslogin

how would you call UserServiceImpl? Underlying question, how would you organize your CRUD (with business logic) operations?


I think I would reverse the question. Why does there have to be a UserService interface? If it only exists in order to be mocked in yet another place of the code you've added even more unnecessary layering in your codebase.


do you know where I could find those other patterns?


You probably have already seen them. It was just things such as structured programming, decomposition into functions, layering with minimal loops between layers, interface checks for invariants, avoiding risky languages/constructs, and usage-based testing.


Sincere question: do you really have the feeling the over cost is worth it? Do you do this for EVERY external library you're using?


It really depends on the library. Sometimes you look at the API of a library and you just want to wrap it because you know you're going to have to do a lot of work to get the data in and out of it in the right shape, or the lifecycle management is a pain, or the types involved aren't going to play well with tests, or it's just fundamentally relying on external state, thus preventing me writing proper unit tests of anything which might call it.

Other times, no, it doesn't seem worth it. And I don't do it for every single external library I use.

Although it does tend to end up being most of them - which seems to be a consequence of the way I've generally done n-tier application design at work. I'm not always a fan of this architecture, but sometimes it does fall out nicely.


Yeah, I don't get it. Swapping out a third party library is rare and usually because you want to get extra features another library doesn't have or some other big reason. Given how rare it is I would just use the library as is and refactor if/when the time comes. If you wrapped every library you'd waste a lot of time.

I had a senior developer suggest I wrap jQuery one time.


Honestly in JavaScript there's very little call for it because the language is so flexible, and you can't really build anything that's unmockable.

C# is a very, very different matter, and that's the perspective I was initially commenting from.


No, some libraries (like React-bootstrap) export a bunch of components that don't really need a facade. But be careful. Later, when you need to modify functionality (and it can't be done via modifying the bootstrap variables via Less) it's a slight pain to retrofit.


Even so, I like to keep the imports local so I only have to change one reference to a custom-wrapped version if/when the need arises. I have a lib file to act as a manifest of components, and while most are mine, there are also some "export {Grid} from 'react-bootstrap'" type things in there.


I'd recommend going through some courses like FreeCodeCamp [1] You have courses about Bootstrap, React and much, much more

[1] http://www.freecodecamp.com/


Welcome to the foot-in-the-door[1] technique

[1] https://en.wikipedia.org/wiki/Foot-in-the-door_technique


Nap can be really good for productivity for most people. I wish I could nap. Here's a great (and very long) article about the relationship between sleeping and learning http://super-memory.com/articles/sleep.htm


Altruism - Mathieu Ricard

Search Inside Yourself - Chade-Meng Tan

Bible - several authors

Siddhartha - Hermann Hesse

Fight Club - Chuck Palahniuk

Eléments de Philosophie Angélique - Denis Marquet (french)

Au coeur de l'instant - Jean Bouchart d'Orval (french)


The one book that I first thought of when I read the OP's original question was Mathieu Ricard's L'Art de la Méditation (an English translation aptly named The Art of Meditation is available).

At some point in my life, while I was going through severe depression, I got interested (by the folks on HN) into looking more into Buddhist philosophy and meditation. This little book, quick to read, made me realize that our selves are not what we think they are, and that our emotions are impermanent, that we can deal with them by simply acknowledging them instead of letting them overthrow us. It's a brilliant simple idea, though it is harder to put into practice. (I am still not quite managing to be a regular meditator to this day)

This little book changed my life, and I've now bought it or lent it to several people from my friends or family in the hope that it may have the same impact on them as it had on me.


I forgot to list this book but it is changing at the moment my way of managing thoughts and feelings, especially strong ones. Thanks !


Hackers in-depth interviews: « Coders at Work »

General topic: « The Pragmatic Programmer: From Journeyman to Master »

Java and more: « Effective Java » 2nd edition

About unit testing with Java tools: « Practical Unit Testing with Mockito and JUnit »


I've been through a similar situation. An important part of the grief was to accept that my father would never be the one he was supposed to be. He would never fill the role I expected.


Joel himselft talked about the difference between vertical and horizontal products, applied to Trello : http://www.joelonsoftware.com/items/2012/01/06.html


That's the post that convinced me to sign up for Trello! I was looking for it to post it, heh. I've been using it for... I guess about 6 months or so... maybe longer, in any case I seem to have the Blue Starfish of being in the first 500 000 users.


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

Search: