Math library methods in Google’s Go Programming Language
I have been programming in google Golang and have been enjoying it due to its brevity but I find it surprising that almost all its Math standard library methods are for the floating point type. Is there any particular reason why these methods do not exist for ints?
Should a method’s parameter list contain objects or object identifiers?
Our teams is having the following discussion:
Understanding high cohesion principle for methods in object oriented design
I know the idea of strong cohesion applies to methods as much it applies to classes. Just to be clear when I say strong cohesion of a method I mean a method which does only one task and does it well. This idea really works for simple getters and setters. But sometimes we usually come across methods that does more than one task internally , although it seems to be doing a single task if you look at a higher level of abstraction. An example of such a method can be :
Why sequential cohesion for operations in a method is not a good idea?
I read from the seminal Code Complete book that method statements that require to be executed in order passing parameter from one to the next is a code smell and is an example of a sequential cohesion. Why is this not a good idea?
What is a static method compared to instance/class/private/public methods?
I’m learning programming in Objective-C and I can’t understand what a static method is. I know what class/instance/private/public methods are. Can someone explain what it is using an example and comparing it to the others I mentioned? And in what situation would someone use it?
Is it OK to split long functions and methods into smaller ones even though they won’t be called by anything else? [duplicate]
This question already has answers here: One-line functions that are called only once (12 answers) Should I extract specific functionality into a function and why? (6 answers) Closed 11 years ago. Lately I’ve been trying to split long methods into several short ones. For example: I have a process_url() function which splits URLs into components […]
Naming functions that retrieve a value
I have this personal rule to start all function/method names with a verb. My verb of choice for functions or methods that get a value based on some data structure or object is get. I’m wondering if that’s a good idea.
Is it a good practice to write a method that gets something and checks the value? [duplicate]
This question already has answers here: Should a method do one thing and be good at it? [duplicate] (3 answers) Style for control flow with validation checks (4 answers) Closed 11 years ago. Occassinally I have to write methods like this: string GetReportOutputDirectoryAndMakeSureExist() { string path = Path.Combine ( … ) //whatever logic if(!Directory.Exists(path)) Directory.Create(path); […]
What is the reason for using lowercase for the first word in a local variable (eg, employeeCount, firstName)
I take a good deal of criticism from other programmers due to my use of full proper casing for all my variables. For example, your typical programmer will use employeeCount
for a variable name, but I use EmployeeCount
. I use full proper casing for everything, be it a void method, return method, variable, property, or constant. I even follow this convention in Javascript. That last one really rustles people’s jimmies.
What is the reason for using lowercase for the first word in a local variable (eg, employeeCount, firstName)
I take a good deal of criticism from other programmers due to my use of full proper casing for all my variables. For example, your typical programmer will use employeeCount
for a variable name, but I use EmployeeCount
. I use full proper casing for everything, be it a void method, return method, variable, property, or constant. I even follow this convention in Javascript. That last one really rustles people’s jimmies.