#codeadvice
Explore tagged Tumblr posts
forcepusher · 2 years ago
Link
Pretty much everything you need for Netcode. By far the most useful videos was about Rocket League and Overwatch.
3 notes · View notes
hackernewsrobot · 7 years ago
Text
Show HN: Codeadvice – Create, edit and collaborate on code online
https://www.codeadvice.io/ Comments
0 notes
channelhour · 7 years ago
Text
New top story on Hacker News: Show HN: Codeadvice – Create, edit and collaborate on code online
Show HN: Codeadvice – Create, edit and collaborate on code online 38 by idarwishman | 16 comments from Blogger https://ift.tt/2SM6RxP
0 notes
stalen00bsblog · 7 years ago
Text
Show HN: Codeadvice – Create, edit and collaborate on code online https://ift.tt/2yP0C3K
Show HN: Codeadvice – Create, edit and collaborate on code online https://ift.tt/2QkCUmB November 6, 2018 at 06:52AM from Blogger https://ift.tt/2qw0bHd
0 notes
our-umair-mehry-stuff · 7 years ago
Link
Show HN: Codeadvice – Create, edit and collaborate on code online 38 by idarwishman | 16 comments
0 notes
technteacher · 7 years ago
Text
Show HN: Codeadvice – Create, edit and collaborate on code online
Show HN: Codeadvice – Create, edit and collaborate on code online 24 by idarwishman | from Blogger https://ift.tt/2yWytb1
0 notes
topicprinter · 7 years ago
Link
Article URL: https://www.codeadvice.io/
Comments URL: https://news.ycombinator.com/item?id=18387568
Points: 22
# Comments: 9
0 notes
forcepusher · 4 years ago
Text
My take on explaining OOP to traditional programmers.
Tumblr media
OOP... Everyone is bragging about it, yet only a few figured out how to use the thing in a meaningful way. Many developers tried it. Majority is now having seizures, while others enjoy trolling them.
I’ll start by saying that the term “Object-oriented“ sounds too generic and this is the first major entry barrier to the paradigm. What if I tell you to think of each object as a separate standalone program ?
Each class solves a problem. They receive the required parameters to solve problems trough a constructor, then its methods are being invoked via an Interface (often with additional parameters). That’s very similar to a command-line program. So Class is a program definition, and its instance object is a running program. Think of a “new” keyword as a Factory spawning programs. Interface is a messaging protocol to allow programs to talk to each other via method calls. We should not have to hold each program by hand and write a lot of imperative code. Tell the program to talk to another program instead. This is the way declarative programming is done.
Class should not be just a data container. We don’t want to write useless programs that do nothing within their own context, right ? Besides, internal object state should be vigorously protected by encapsulation. But what about a “List” class ? Well, that’s a pretty useless program indeed. However, List manages array allocations for adding and removing entries. It has behavior, so it’s a valid object. In most cases, trivial data classes should be structures instead, so they are treated as immutable primitives.
Lifecycle of a program is similar to an object - the program is born, it does the job, and when the time comes it dies. In the other hand, procedures and functions just execute. We need to create objects to solve problems, behavior cannot be floating on its own. Often we have the urge to create a static utility class that does all sorts of things, like “Math“. This violates single responsibility principle because math is too broad. So we would split it into separate “Lerp“, “Abs“, “Pow“ classes. Some of them could be static, as long as they represent a single immutable instance of an object that is essentially a pure function. So we don’t have to create a new object instance for every “Abs“ operation.
TL;DR: From the code standpoint, practical use case for OOP is division of a large program into smaller programs for easier maintainability. This is true for every other major programming paradigm, but objects happen to fully achieve this goal without any compromises. Because an object encapsulates a complete program with state and interface for communication with other programs. This approach achieves synergy with domain modelling. Whatever prevents an object from encapsulating a small complete program, is a bad practice.
1 note · View note
channelhour · 7 years ago
Text
New top story on Hacker News: Show HN: Codeadvice – Create, edit and collaborate on code online
Show HN: Codeadvice – Create, edit and collaborate on code online 38 by idarwishman | 16 comments from Blogger https://ift.tt/2SM6RxP
0 notes
forcepusher · 10 years ago
Text
Hyperbolic hover algorithm using physics
var acceleration = HoverHeight / (DistanceToGround + rigidbody.velocity.y * Damping) * -Physics.gravity.y; Damping should be from 0.0 to 1.0. Higher value kills hovering oscillation. HoverHeight is how high your object is supposed to be above the ground. DistanceToGround is ground Y coordinate subtracted from object’s Y coordinate. Use it via rigidbody.AddForce(0, acceleration, 0, ForceMode.Acceleration); Here’s a quick script to test it: using UnityEngine; public class Test : MonoBehaviour {    void FixedUpdate()    {        GetComponent<Rigidbody>().AddForce(0f,            3 / (transform.position.y + GetComponent<Rigidbody>().velocity.y * 0.5f) * -Physics.gravity.y, 0f,            ForceMode.Acceleration);    } }
13 notes · View notes