Tag Info

New answers tagged

0

Every programming language is invented by different mind set, experience and objective, and there is no universal guideline setup for creating a language. So whenever a new language comes up it's their inventor choice to think about best naming/ syntax so this is all up to them what they think is best will add there. For example to add two numbers i will ...


4

What matters about programming languages are the semantics, not the syntax. However, syntax is a vehicle for semantics. It is easy to show that two languages can have incompatible semantics (e.g. unrestricted pointers vs. memory safety, or differences in type systems). Let's focus on the syntax and semantics of variable declarations. When we declare a ...


8

Why cant be a global Standard to do all Simple and Common things? We tried that. The concept was called UNCOL, and the idea was that it would be ported to every architecture in the world, everyone would use it for everything. As you can tell, things didn't work out that way. Why not? Because programming is a complex activity, and there is no single ...


1

Let's tackle this: Would it be most appropriate to return a double value as I've mentioned, or provide public multiply(), add(), etc. methods? Should said class know how to multiply and add? Sounds like you are building a calculator implementation... I would say it really depends on which part of the calculator you are building this for. If this is the ...


5

Is there any documented preference, in Java, for either of these conventions? The preference is that the end user has no idea what the backing primitive is for your type. This is encapsulation at its essence. Now, if your object exposes an interface to get a double (regardless of what the backing datatype is), either because you're serializing your ...


2

We'd have to ask the author of that style guide to know for sure, but I think the main reason I kind of agree with him is that the connection between struct and method is much looser in Go than other languages. In essence, when you write a method like this: func (m *MultiShape) area() float64 { ... } That's almost exactly the same thing as writing a ...


-1

This is from a perspective of JavaScript where this has actual keyword meaning to the compiler, but from my understanding, if they're okay with two-letter abbreviations for the object type, it should be easy enough to use that instead. The reason for the difference is that in a decently-large block of progressively deeper asynchronous code, it could be very ...


5

Personally, I would go for your second bullet point. widgetToHtml and widgetsToHtml. Because that is the best description of what it is doing. I.e. I wouldn't pass in multiple widgets and call it widgetToHtml which implies its for a single widget. I'd do the same even if widgetToHtml was private.



Top 50 recent answers are included