Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 364 365 [366] 367 368 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 886869 times)

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5475 on: February 20, 2014, 06:56:01 am »

I know a Lead Tester who holds a view I quite like, which is that QA shouldn't be seen as existing as a team or a step, because everything is QA.
  • You do peer code reviews, because that's QA.
  • You do continuous integration, because that's QA.
  • You do test driven development, because that's QA.
  • You do manual testing of work before it's handed off to someone else to manually test, because that's QA.
  • You do pair programming, because that's QA.
  • You provide customer support, because that's QA.
  • You regularly meet with with your client to establish you are fulfilling their requirements with each iteration, because that's QA.
All of these things are Quality Assurance. QA Isn't a step or a team, it's a core tenant of professionalism and craftsmanship.

I hold that untouched code rots. Code can be good when written, and when you go back in 5 years requirements have changed, standards have changed, knowledge bases have changed, methodologies have changed, and code that hasn't been touched has become bad because it's original purpose is no longer in line with those things. This means that code rots unless you constantly work on it, it's inevitable and when you can accept that you free yourself to simply see code that has rotted and apply the boy scout rule, make some changes, and leave the code cleaner than you found it.
« Last Edit: February 20, 2014, 07:12:02 am by MorleyDev »
Logged

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5476 on: February 20, 2014, 10:13:38 am »

I hold that untouched code rots. Code can be good when written, and when you go back in 5 years requirements have changed, standards have changed, knowledge bases have changed, methodologies have changed, and code that hasn't been touched has become bad because it's original purpose is no longer in line with those things. This means that code rots unless you constantly work on it, it's inevitable and when you can accept that you free yourself to simply see code that has rotted and apply the boy scout rule, make some changes, and leave the code cleaner than you found it.
Does that mean code doesn't rot if you don't pay attention to any programming practices external to your own?
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5477 on: February 20, 2014, 11:00:13 am »

If you're revisiting a piece of code at some point it's because you need to do more work on it. Which means requirements have changed that make the code is no longer fit for purpose. And you still learn things as you code, one of the things about programming is you are always learning, so you'll always return with more knowledge than you had.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5478 on: February 21, 2014, 08:34:01 am »

I know a Lead Tester who holds a view I quite like, which is that QA shouldn't be seen as existing as a team or a step, because everything is QA.
  • You do peer code reviews, because that's QA.
  • You do continuous integration, because that's QA.
  • You do test driven development, because that's QA.
  • You do manual testing of work before it's handed off to someone else to manually test, because that's QA.
  • You do pair programming, because that's QA.
  • You provide customer support, because that's QA.
  • You regularly meet with with your client to establish you are fulfilling their requirements with each iteration, because that's QA.
All of these things are Quality Assurance. QA Isn't a step or a team, it's a core tenant of professionalism and craftsmanship.

This is effectively what we do, aside from the building toward test driven development.  We have only 3 main developers, so we often work together and review each others' work.  It definitely helps weed out some design flaws or bugs.  We also usually contact customers directly related to requirements and deployment of code, and this also usually helps a lot in weeding out problems.

Unfortunately, our typical development process tends to miss a lot of rather obvious bugs.  Things like uploading a .xls file where a system expects and only works with .csv files.  Maybe those are things we should just catch when we stop, step back and think about the interface and other components.

Test driven development is something that I've wanted to push our company toward for years now though.  I don't know how much it would help in cases like this, but stopping to think of test cases to write probably would help identify obvious things like, "Okay, what does the code do if someone uploads a Word document instead of a .csv file?  Oh, wait... or anything but a .csv file for that matter?"
Logged
Through pain, I find wisdom.

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5479 on: February 21, 2014, 07:44:29 pm »

Test driven development is something that I've wanted to push our company toward for years now though.  I don't know how much it would help in cases like this, but stopping to think of test cases to write probably would help identify obvious things like, "Okay, what does the code do if someone uploads a Word document instead of a .csv file?  Oh, wait... or anything but a .csv file for that matter?"
"I just uploaded a .pdf into your site, and nothing happened? :("
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

gnome42

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5480 on: February 22, 2014, 11:02:55 am »


Well.  The first thing someone does is try to upload a .csv file of 600 people.  That turns out to take several minutes to upload because we were doing a lot of unnecessary HTTP requests to our centralized API server, and people think it's hung up.  Commence hitting the submit button multiple times!  We had to fix it so that it disables the button (like it was supposed to do already) and had to optimize the code a lot to get it to work at acceptable speeds.

The next thing that happens is someone tries to upload a .xls file.  That won't work at all, and the code still expected a .csv file.  Cue thousands of people being uploaded with phone numbers like @#XDER)_@231.  Then people try uploading .csv files with the columns out of order, even though we provide an example .csv file.

Actually, I guess the moral of this story is we need some dedicated quality assurance people here.

One other moral to learn from this is never assume that data handed to you from an outside system is formatted correctly.  If there is a way to do it incorrectly, it will get done that way, at the least convenient time.  ( I've been on both sides of this... ) Sanity checks on the data you have no control over are always worth it.  Seeing a non-number in a phone field?  Crap.  Seeing something that does not conform to a valid address in an email field?  Something is wrong here.  Will the folks doing this still find amazingly creative ways to get past the filters?  Every time.  But at least the worst of the silliness gets caught and bounced. 
How abusive the rejection messages are depends on how laid back your bosses are.


gnome
Logged

freeformschooler

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5481 on: February 25, 2014, 11:43:21 pm »

Trying to learn raycasting.

http://lodev.org/cgtutor/raycasting.html#Untextured_Raycaster_

I understand most of this except for this bit of simple math:



Code: (C) [Select]
double deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX));
double deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY));

...How does √(1+rayDirY²/rayDirX²) work out to deltaDistX or change in X distance? Is this a forgotten high school formula?
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5482 on: February 25, 2014, 11:57:23 pm »

nvm
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

freeformschooler

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5483 on: February 26, 2014, 12:44:18 am »

For clarity: I'm aware this is A^2 + B^2 = C^2, but how B^2 equals (rayDirY^2/rayDirX^2) is uncertain.

Logged

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5484 on: February 26, 2014, 01:12:02 am »

It has something to do with trigonometry. If you imagine a triangle with the same angles as the deltaDistX triangle, but with its hypotenuse equal to 1, then you get that the tan of the angle the ray makes with the vertical is equal to rayDirX/rayDirY. Therefore the ratio of the horizontal side to the vertical side is also equal to rayDirX/rayDirY (since the angles are the same). I'm not sure how good an explanation this is, but I could make a picture or two to better demonstrate this if you want.
Logged

freeformschooler

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5485 on: February 26, 2014, 01:19:52 am »

A picture would help, yes. Thank you for your assistance.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5486 on: February 26, 2014, 04:51:12 am »

Does anyone know what the Processing language is? Alternatively, is Processing.js any better than just Javascript? :I
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5487 on: February 26, 2014, 05:08:07 am »

Alright, here is a diagram:
Spoiler: diagram (click to show/hide)
The triangle on the right is obtained because rayDirX and rayDirY form a vector which specifies the direction of the ray, which is how we know that it has the same angles as the triangle on the left (which is supposed to be representative of the deltaDistX triangle in your diagram). Now in the triangle on the right, we get that tan(a)=rayDirX/rayDirY (from the definition of the tan function). Since the two triangles have the same angles, we can also get tan(a)=1/B from the triangle on the left. Putting these two equations together gives us rayDirX/rayDirY=1/B, which can be solved for B to give B=rayDirY/rayDirX which is what the formula from that page gives us. Is there anything that I have failed to make clear here?
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5488 on: February 26, 2014, 01:49:03 pm »

Sweet yeah! Guess who has finally got access to the C++ IDE Preview from JetBrains? This guy! Awwwww yeah. Been using CodeLite over Visual Studio 2013 lately for it's CMake support and superior Clang-based code completion, but the JetBrains IDE supports loading projects directly from CMakeLists.txt, which is sweet.

So yeah, time for me to try my best hopes for a modern C++ IDE. Will report back when the download finishes and I get to play around with the Early Access build :)
« Last Edit: February 26, 2014, 01:51:26 pm by MorleyDev »
Logged

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: if self.isCoder(): post() #Programming Thread
« Reply #5489 on: February 26, 2014, 01:57:53 pm »

Does anyone know what the Processing language is? Alternatively, is Processing.js any better than just Javascript? :I

As far as I remember it's just Java with some nice libraries to make graphics easier. I hear it's used a lot for prototyping and for artsy stuff.
Pages: 1 ... 364 365 [366] 367 368 ... 796