Reason for using 4-spaces instead of 2-spaces? [closed] - node.js

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Is there any rationale why HapiJS endorses using 4-space indentations?
Source: http://hapijs.com/styleguide

Short answer: No better reason than anyone else - styleguides are typically only rules for project maintainers. They had to adopt some convention and that was the choice. As a user, you don't really need to care.
Long answer: Hapi is a great framework, built by the folks at Walmart. and specifically a person named Eran Hammer who was unhappy about some architectural choices made by Express, another server framework for Node. It is somewhat opinionated in general, it was effectively created in an environment of opinion, not to mention a large company (which means it desperately needed a convention). That said, you can safely use the Hapi API with any indentation you want, including tabs, though. Likewise, the Hapi internals could have been written the same way. Their specific choice likely comes down to established tools or conventions already in use at the company. Many different projects make different choices for a variety of reasons. In my experience, many large JavaScript applications go with 2 spaces and the Node.js core itself is written with 2. But there's nothing wrong with those that do otherwise.

Related

How to answer this interview questions about software engineer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 months ago.
Improve this question
Describe the system architecture in the last 3 projects you worked on. In this case I don't know what system architecture they mean?
Which components listed above have you been working on?
What frameworks are used during the development of these components?"
From a interviewer perspective, they are trying to assess candidates knowledge of overall system they worked up on.
Describing system architecture will help interviewer to know whether candidate knows the big picture of the systems they were part of. The answer could be by explaining the logical architecture(functional view) of application or a component architecture(tech view) depending on context. For a person who is oriented more on infrastructure side, this could be still a bit different, but rarely the case.
Question "on which component have you worked" primarily is intended to understand what exactly was candidates role in project. Explanation on how the component was designed, what technologies are used etc could be answered.
"Frameworks used" would probably tell the interviewer whether candidate was into decision making roles for design or at least can evaluate what is best fit for the need and what is not. Mentioning the frameworks(or libraries or plugins based on tech landscape) used and how that well suit the needs would be a good answer.

Is it a good practice to use both active_model_serializer and Jbuilder? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have a legacy Ruby on Rails API project, I notice that the project uses both active_model_serializer and Jbuilder. There are app/serializers diretory for active_model_serializer, and app/view/api/ for Jbuilder.
I'm new to Ruby on Rails API. From what I have read from the internet it seems active_model_serializer and Jbuilder are both used to deal with JSON data, there's even an article arguing which one is better.
I don't know which one is better, but is it a good practice to use both?
There's no problem in using both, but it's definitely not a good practice. It can be confusing for new people coming to the project. I'd say it's ok to use both if you transition from one to the other (most often from Jbuilder to AMS), but it's good to eventually stick with one of them.

Which library to use for cryptographic functions [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
Note: this is not asking for a personal viewpoint on what is the better library, but rather what is the "safest" library or what is a good indication of a "safe" library.
I was looking for a Haskell library with AES256 encryption/decryption capabilities and found quite a few.
cryptocipher
cryptonite
AES
The problem is that most of these seem abandoned, except cryptonite who again seems like the least popular library (the one with the least amount of downloads).
I was wondering if using a library that seems outdated could be a problem (should I worry about possible security flaws, etc.) or if I should simply go with the one that seems most popular?
I'd definitely recommend cryptonite. It's a newer library consolidating a number of older libraries, and the ecosystem hasn't moved over yet.

Structure recommendation [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I try to find a good directory structure for my nodejs/express/mongoDB application.
Currently I use the native-mongodb driver which feels nice and fast but is limited when a proper structure should be defined... when MVC is the express/node way to go defining proper db models is not that easy.
Although mongoose and its concept of schemas would make the actual design of models easy but I am not that big of a fan of another layer on top of my stack... it feels kinda bloated to me.
I looked for an alternative and found mongoskin which is a thin wrapper on top of the native-driver but adds some features to support MVC-ish patterns.
In general I found this to be a common problem for other people too. I appreciate the idea presented in the link: https://stackoverflow.com/a/8428281/1055685
Nevertheless the query inside the model directory is not really MVC-like (as mentioned in the comments...) - I do not like it...
The MVC demos in express are not that helpful... did you find some inspiration there?
Which pattern do you recommend to follow (if MVC is recommended models are the real problem)?
Do you recommend mongoskin in general?
I would suggest looking at either LocomotiveJS or RailwayJS
LocomotiveJS is more "lightweight" and there is a great boilerplate available to get you started.
RailwayJS contains more "generators" to make it more rails-like however.

DDL Script for installation anti-agile? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have heard a comment that using a DDL script for a database installation is anti-agile. Is this true and if so why? I have been looking online for my answers but couldn't find anything.
Thanks
I don't know your exact context, but I would say that DDL is very pro-agile as it supports a repeatable installation process. Maybe they meant that designing the entire database prior to development is anti-agile. I would tend to agree with this assessment, but there is nothing inherently anti-agile about DDL.
Hope that helps!
Brandon
Supporting incremental updates is more convenient and also allows for repeatable builds.
This allows the database to be "refactored" or "evolve" - as changes to it are seen as a series of small adjustments to a base schema.
This allows for constant upgrades without having to manage database versioning explicitly yourself. The database is the source of its own version and the upgrade process only applies appropriate deltas if they are required.
There are several tools that can help with this - the best know being probably ruby on rails active record migrations. For java environments then dbdeploy is pretty good (I think there are versions of dbdeploy for .net and php environments too).

Resources