d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Old Habits? New Ones
12Next
Add Reply New Topic New Poll
Member
Posts: 20,139
Joined: Nov 11 2008
Gold: 20.50
Jan 22 2017 11:48am
i used to say things like

choose1 = input()

now I do,

response = input()

rather than, confusing_phrase = input()

what are some old habits you have broken?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 22 2017 04:03pm
i used to use short function names. like if i wanted to split a string, i'd use a function name like `split`. now i use a much more meaningful name like `componentsSeparatedByString`. similarly, unintuitive functions like `replace` are now much more meaningful as `stringByReplacingOccurrencesOfString`
Member
Posts: 20,139
Joined: Nov 11 2008
Gold: 20.50
Jan 22 2017 05:58pm
Quote (carteblanche @ Jan 22 2017 10:03pm)
i used to use short function names. like if i wanted to split a string, i'd use a function name like `split`. now i use a much more meaningful name like `componentsSeparatedByString`. similarly, unintuitive functions like `replace` are now much more meaningful as `stringByReplacingOccurrencesOfString`


oh interesting, can you give me another example of what you mean?
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jan 22 2017 06:09pm
Quote (spoofdaboss @ Jan 22 2017 07:58pm)
oh interesting, can you give me another example of what you mean?


He takes a bad name and gives it more meaning.

Rather than sex() he calls the function hasSexWithUnderAgedWaifus()
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 22 2017 07:15pm
Quote (spoofdaboss @ Jan 22 2017 06:58pm)
oh interesting, can you give me another example of what you mean?


i'm just venting about swift.

Quote (AbDuCt @ Jan 22 2017 07:09pm)
He takes a bad name and gives it more meaning.

Rather than sex() he calls the function hasSexWithUnderAgedWaifus()


that's redundant though. i mean, who else would you have sex with?
Member
Posts: 8,112
Joined: Sep 23 2006
Gold: 3,558.23
Jan 22 2017 07:20pm
Old habit: mixing languages. I used to do a lot of automation tasks at work using auto it. Then I was asked to update a bunch older vbscripts. Then I was asked to take some time to learn powershell basics. So, I had a powershell script that called an auto it script that would use regex make changes a to a vbscript on the fly, and then run it. There were many like that...I have since just rewritten them all in powershell completely.
Member
Posts: 36,389
Joined: Jul 18 2008
Gold: 3,192.00
Jan 23 2017 06:55am
Started actually using try/catch blocks to gracefully handle errors instead of just letting a program crash.
Member
Posts: 20,139
Joined: Nov 11 2008
Gold: 20.50
Jan 23 2017 11:41am
lol u guise..

welp i cant mix languages yet, because im only learning the ssh term and python! but... soon

Quote (Mastersam93 @ Jan 23 2017 12:55pm)
Started actually using try/catch blocks to gracefully handle errors instead of just letting a program crash.


i'll let you know when i get there, i just started with pygame yesterday

followed a tutorial and had the ball bouncing across the screen at different speeds...

do you remember space quest 6? pygame reminds me a lot of this:

Member
Posts: 36,389
Joined: Jul 18 2008
Gold: 3,192.00
Jan 23 2017 02:22pm
Quote (spoofdaboss @ Jan 23 2017 12:41pm)
lol u guise..

welp i cant mix languages yet, because im only learning the ssh term and python! but... soon



i'll let you know when i get there, i just started with pygame yesterday

followed a tutorial and had the ball bouncing across the screen at different speeds...

do you remember space quest 6? pygame reminds me a lot of this:

http://www.myabandonware.com/media/screenshots/s/space-quest-6-roger-wilco-in-the-spinal-frontier-333/space-quest-6-roger-wilco-in-the-spinal-frontier_10.png



Try/except blocks are super easy in Python. A lot of the time I just do

Code
try:
#some command
except:
print("Fatal error.")
exit(-1)


I know just exitting kind of defeats the purpose of an exception, but it's often the behavior that I need.
Member
Posts: 5,167
Joined: Nov 23 2006
Gold: 11.01
Jan 24 2017 07:35am
Not splitting things into small services.

ie: I'd have one "service" that did all of the work for a large portion of the website. Now, I break things up into as many services as I can so that they have separation of concerns and can be deployed independently. This helps at scale so that I don't need to shill out a lot of $$$ for load balancing entire app servers.
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll