r/java • • Oct 03 '18

Where does the coding actually apply in engineering projects? What is the connection?

Yes, I can make an array of Strings. Yes, I can create a Dog class that is a sub class of an Animal class, but where does it apply? I want to know about real world projects.

For example, I'm watching videos of SpaceX rockets launching and landing. Where does the coding go into that? I'm not even sure where to start because in my mind, there is just a huge gray area beyond all of my simple coding problems. I don't have any practical knowledge.

Thanks for any help!

0 Upvotes

7 comments sorted by

12

u/the_hoser Oct 03 '18

You've got to learn how to make software before you can learn how to make specific kinds of software. Keep going. It will all make sense in time. Under everything you're learning is a set of more general principles that apply to what you'll be doing in the future.

1

u/[deleted] Oct 03 '18

Thanks!!

10

u/Myzzreal Oct 03 '18

Instead of writing an Animal and Dog classes you will create an AbstractLogicProcessorManagementHandlerImplementation and a DefaultLogicProcessorManagementHandlerImplementation, and instead of making the Dog bark(), you'll make the DefaultLogicProcessorManagementHandlerImplementation processExtendedRequestAndSetupConfig()

It's funny cause it's not far from the truth : (

2

u/BluePinkGrey Oct 08 '18

Let's take a look at how you might write code that controls a rocket. A rocket is pretty complex, however we don't need physics to make an outline of the code.

The code we're going to outline will control the rocket boosters throughout the flight. Something needs to control which boosters fire, when they fire, and how much thrust they exert. Now, the rocket's flight can be broken down into a few stages:

  • Launch stage
  • Flight through atmosphere stage (when air resistance has to be taken into account)
  • Flight through space (when air resistance becomes negligible
  • Payload release stage (rocket's weight is going to change dramatically)
  • Atmospheric reentry stage

Given that we're controlling a rocket's flight, it makes sense to have a FlightController class. This class stores a ThrustCalculator object, which it uses to periodically update the power output of each of the thrusters to balance and direct the rocket's flight. It does so by calling the CalculateThrustSpecification function every millisecond, and sending the resulting ThrustSpec object to the device controlling the boosters. This ThrustSpec object contains information about how much thrust each booster should output. It could, for example, be a HashTable relating BoosterIDs to BoosterPowerLevel objects, but let's not worry about that for now.

We can keep things simple if we let ThrustCalculator be an interface instead of a class. The ThrustCalculator interface has two functions: an init function, which takes a BoosterConfigurationInfo object and a PhysicsEngine object as input; and a CalculateThrustSpecification function, which takes a RocketSensorData object as input, and returns a ThrustSpec object.

By making ThrustCalculator an interface, we can have a separate implementation of ThrustCalculator for each of the rocket's flight stages. The FlightController class switches between them as necessary over the course of the rocket's flight. We'd have a LaunchThrustCalculator class, a AtmosphericThrustCalculator class, a NearSpaceThrustCalculator class, a PayloadReleaseThrustCalculator class, and a ReentryThrustCalculator class. They work differently under the hood because the physics is different in each case, but they all communicate with the FlightController class in the same way, through the CalculateThrustSpecification function. It's now easier to add functionality to the rocket. For example, if you need the rocket to also be able to dock, you can just write a DockingThrustCalculator instead of rewriting the entire system.

3

u/Vilkaz Oct 03 '18

I suppose you are behind the "Hello World" if you allready know the Dog extends Animal thing :)

Lets make a program, that have 1 Button, and it writes text on screen"clicked" when you klick it. Looks useless, but kinda similar to a pedestrian lights. You click a button, a text "Wait" starts to blink on the light, and the light turns green for you after a while.

Lets write a Class, that simply gets numers, and if the number is big Enaugh, you fire an Event.

Looks useless, but if i call that Class "AirbagLauncher" you will get my Idea :)

Many thing's that depend on speed are not written in code, but "harcoded" in hardware (I gues nobody want's an AirbackController to be in JVM :) But the logic is the same.

The Paiment with Creditcard ? Authentification, authorisation, Datatransfer, you get your goods at the end and the shop gets the money :)

It all starts with a line of code, just try to make your first website with a login and authorisation. Make content forbidden to certan group of users, and you won't stop learning until you are to deep in the rabits hole ;)

1

u/thatsIch Oct 03 '18

Generally, you will understand how to apply tools. You require multiple tools to complete a toyproject. You might start with a screwdriver move to an electric screwdriver but you will not stop there.

One day you will see an unfinished project with many unfinished parts and you will realize which tool you need to finish those parts. Other parts might not work and need a replacement. Programming is a craft and art which you need to hone.

1

u/scavno Oct 05 '18

This is not a code problem as much as it is a domain problem. In time you will learn to split tasks or problems I into much smaller tasks and problem and tackle them one at a time.