1. Share just one idea
2. Give people a reason to care about it
3. Build your idea using pieces the audience understands
4. Make your idea worth sharing
Wednesday, August 31, 2016
Tuesday, August 23, 2016
Capitalization (Coding in style in 60 seconds)
Welcome to “Coding in Style in 60 seconds”, a collection of short videos about how we can improve our code in simple steps. This is Dragos, the speaker for this video.
Do you have any idea what is the first reason for which the code is discarded? Of course, other than the fact that it is not working. Eh? Because it is ugly!!!
Who likes to keep ugly things around? We like to live in a beautiful house, drive a beautiful car and marry a beautiful woman or a handsome guy. But I digress.
One of the fundamental pieces of the code is a variable. So we need to make it beautiful.
To start with, decide on the capitalization. For example, in Swift, the most common one is lower camel case. That is: start the name of the variable with a lower letter and capitalize each of the next words in the name if any.
Let’s take a look at few examples.
var clientName = "john"
var cityOfBirth = "Toronto"
var numberOfSecondsInAMinute = 60
In this example, all the variables are nicely formatted, with first word starting with a lower letter and the next ones with a capital.
Here is another example, not that good this time.
var first_name = "ugly name"
var FirstName = "this is a class name"
var firstNAME = "another ugly name"
The first variable has an underscore, the second one has both words capitalized and the last is a mess.
Let’s talk a bit about constants. A constant is a variable that does not vary so we can use the same rules. With just one addition. To differentiate a constant from a variable, we can start its name with a k.
Here is a good example.
let kClientName = "john"
let kCityOfBirth = "Toronto"
let kNumberOfSecondsInAMinute = 60
And here is a messy one.
let CLIENT_NAME = "john"
let CITY_OF_BIRTH = "Toronto"
let NUMBER_OF_SECONDS_IN_A_MINUTE = 60
Monday, August 15, 2016
Coding in Style in 60 seconds
We are starting a new initiative to promote beautiful coding: "Coding in style in 60 seconds", a collection of short videos.
Each video will present a small topic that can have a great impact on the code quality.
You can receive the video by email by subscribing to the blog: http://blog.adelante.ca/ or see them on Facebook at https://www.facebook.com/adelanteconsultinginc/
Each video will present a small topic that can have a great impact on the code quality.
You can receive the video by email by subscribing to the blog: http://blog.adelante.ca/ or see them on Facebook at https://www.facebook.com/adelanteconsultinginc/
Subscribe to:
Posts (Atom)