420chan now has a web-based IRC client available, right here
Leave these fields empty (spam trap):
You can leave this blank to post anonymously, or you can create a Tripcode by using the float Name#Password
A subject is required when posting a new thread
[*]Italic Text[/*]
[**]Bold Text[/**]
[~]Taimapedia Article[/~]
[%]Spoiler Text[/%]
>Highlight/Quote Text
[pre]Preformatted & Monospace text[/pre]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists


Community Updates

420chan now supports HTTPS! If you find any issues, you may report them in this thread
Imperative was a mistake, OOP was a mistake by Simon Nassleshit - Sat, 05 Dec 2015 21:40:59 EST ID:RGQiywhV No.34856 Ignore Report Reply Quick Reply
File: 1449369659078.png -(19671B / 19.21KB, 400x300) Thumbnail displayed, click image for full size. 19671
Haskell paves the way to the future, though cabal is shit. Something like backpack, which aims at a versioning system which accounts for library functionality rather than human hur-de-dur-I'll-just-increment-this-position versioning is the future. Stack is okay but curating is not good enough unless you have massive involvement.
32 posts and 2 images omitted. Click Reply to view.
Priscilla Blanningpat - Mon, 05 Sep 2016 21:02:44 EST ID:e7bTcYy7 No.36111 Ignore Report Quick Reply
If you are willing to try online courses this is probably one of the best online courses ever. It follows SICP directly for the first few chapters but is in Scala.
Shitting Chappertag - Sun, 18 Sep 2016 22:53:54 EST ID:BGrhRoIv No.36165 Ignore Report Quick Reply
Id rather just use forth.
Charles Worthingham - Sun, 18 Sep 2016 22:57:24 EST ID:RPCblsN0 No.36166 Ignore Report Quick Reply
No. I'm not going to let you force that shitty meme.
Cornelius Hallybot - Sun, 09 Oct 2016 12:15:47 EST ID:X7pjqB4m No.36239 Ignore Report Quick Reply
Nell Sidgelan - Mon, 10 Oct 2016 19:10:42 EST ID:CUa5MQaI No.36240 Ignore Report Quick Reply
Haskell is for autistic manbabies

Imageboard by Anon - Fri, 23 Sep 2016 19:29:38 EST ID:caKG/2O4 No.36196 Ignore Report Reply Quick Reply
File: 1474673378851.png -(286389B / 279.68KB, 395x575) Thumbnail displayed, click image for full size. 286389
I am looking to learn how to program an imageboard, I would love some help
Frederick Sorringlot - Fri, 23 Sep 2016 20:32:12 EST ID:Y5ePX1Ig No.36197 Ignore Report Quick Reply
  1. Learn to program in general. Then you can:
  2. Go look at the code for existing imageboards.
Simon Sengerbury - Wed, 28 Sep 2016 13:01:29 EST ID:KqbzNpbE No.36202 Ignore Report Quick Reply
Pretty sure this is what you want
Frederick Clayson - Wed, 28 Sep 2016 15:32:41 EST ID:xLz8+Ihk No.36204 Ignore Report Quick Reply
If you're taking input from users and putting it in a database you should bear this in mind;
the user cannot be trusted
the user is an enemy
the user wants to kill you, your family, your database and your webhost
the user wants to spread malware and cp
the user wants to spam their retarded message everywhere
Only when you truly see the user as your mortal foe will you know the user.
Nathaniel Pedgechadging - Sat, 08 Oct 2016 14:14:02 EST ID:4AC8OQBZ No.36238 Ignore Report Quick Reply
What is this, ReBoot?

Object serialization in C++ by Shitting Bapperhine - Sun, 02 Oct 2016 00:42:54 EST ID:CUa5MQaI No.36217 Ignore Report Reply Quick Reply
File: 1475383374511.png -(7997B / 7.81KB, 634x396) Thumbnail displayed, click image for full size. 7997
So I'm writing a tile-based platformer game with SDL. I just wrote a level editor, but the only thing missing is save functionality. I'm pretty new to serialization, the only time I've done it in the past was in a roguelike game I wrote in Python ages ago that used a YAML serialization library, and I've never done it in C++. Everyone says to use Boost, but I'm running Codeblocks on Windows and trying to compile it for that has been nothing but trouble, and all the information I've found on how to do it is out of date. Is there another decent library for serialization, preferably one that has pre-compiled builds available?
Hannah Blythewater - Sun, 02 Oct 2016 00:52:42 EST ID:JonWtTxr No.36218 Ignore Report Quick Reply
If compiling Boost code is a bridge too far for you, you are using the wrong fucking language.
Shitting Bapperhine - Sun, 02 Oct 2016 01:31:51 EST ID:CUa5MQaI No.36219 Ignore Report Quick Reply

Oh ok
Angus Hiblingstone - Mon, 03 Oct 2016 11:40:38 EST ID:9QSfnS0r No.36224 Ignore Report Quick Reply
Don't use codeblocks, if you want a decent open source c++ IDE get
qt creator
You don't have to use qt with it and are perfectly fine if you're just using SDL.

But honestly if you don't own a premium IDE package doing a full project in C++ is a pain. Why not make the game loop/engine in C++ and use Ctypes and python for the high level stuff. Even more so persisting and serializing data would make much more sense to be done in python.
Nathaniel Pedgechadging - Sat, 08 Oct 2016 04:11:24 EST ID:4AC8OQBZ No.36236 Ignore Report Quick Reply
OP you should use Visual Studio now that you can get a free version of it that doesn't have all of the features stripped out. It's what most other people use to build large projects on Windows.
Shitting Bidgeridge - Sat, 08 Oct 2016 07:42:00 EST ID:OheqWBBY No.36237 Ignore Report Quick Reply

Oh, and don't forget to setup a CI environment, because that's also a must in large projects.

Xamarin app design by Hannah Dogglebed - Tue, 04 Oct 2016 17:38:21 EST ID:ZvbVja19 No.36226 Ignore Report Reply Quick Reply
File: 1475617101731.jpg -(40442B / 39.49KB, 450x287) Thumbnail displayed, click image for full size. 40442
Hello, I've got a project as a paid job. It is basic Android app. I do it in Xamarin. I have no experience with Xamarin whatsoever, but I really need money so I take any jobs. Can you, guys, please help me out with some advice before I start doing it more deeply?

What's it used for?
10+- people in clubs scanning QR codes, that are uploaded to some internet storage in real time under their ID. Purpose is to determine how many QR codes were scanned in each club during the night.

-QR code scanes
code is compared to the list of possible codes and list of existing codes. Which means, code must match the list of possible codes and cannot be scanned more than once.
-code is then sent to some internet storage under curren ID

This is it. Of course I downloaded components for scanning QR codes, some uploader etc.. But I would like to ask some questions on best design possible used for this app.

Log in - Since there is only a certain number of accounts and we don't need any high security. (I higly doubt that some club bouncer would disassemble the app to do some scam) Is it enough and even the best way to authenticate via local database of users? Even so local that the login-password combos would be stored in code?

Now user is logged in and can start scanning.
Scan is successful -
Comment too long. Click here to view the full text.
Basil Honeyham - Wed, 05 Oct 2016 14:10:35 EST ID:9QSfnS0r No.36227 Ignore Report Quick Reply
>Hello, I've got a project as a paid job. It is basic Android app. I do it in Xamarin. I have no experience with Xamarin whatsoever,


Also the whole point of qr codes is to just have a short string of numbers, you "upload" the strings using a simple http request and the string url encoded to some endpoint. You store the string using SQL(ite).
The backend then replies with a 201 (created) message if you got an empty result to a simple query and a 409 (conflict) if it's already there.

Again, I'm baffled how you managed to convince somebody to pay you with that little knowledge.
Basil Honeyham - Wed, 05 Oct 2016 14:29:46 EST ID:9QSfnS0r No.36228 Ignore Report Quick Reply
Also storing anything local doesn't make sense, you have to connect to a sort of service either way to know if the code has been scanned.

Codes can be just a random number stored in a table, but it might turn out that doing it the right way is just as easy (or easier) using
json web tokens
for instance.

I still can't fathom how somebody would pay somebody that clueless for an app that would basically replace 4-6 people's labor, worth 5 figures in reality.
George Nickleworth - Fri, 07 Oct 2016 15:39:03 EST ID:xLz8+Ihk No.36235 Ignore Report Quick Reply
And I wonder why there is so much shit software around...

KC Game Jam #01 by nordicFrench - Thu, 06 Oct 2016 04:14:58 EST ID:s5NLs05u No.36230 Ignore Report Reply Quick Reply
File: 1475741698202.gif -(2085974B / 1.99MB, 320x200) Thumbnail displayed, click image for full size. 2085974
To: Amateur Gamedevs of 420chan
For: Training purpose

  • Develop the core gameplay of a game of Snake (aka. Nibbler, Blockade, ...).
  • The code should be in only one file
  • You should do it today.
  • Post the source ITT and at least a screenshot or a webm.
  • Rate others work and get your work rated
Molly Fanstock - Thu, 06 Oct 2016 04:18:29 EST ID:s5NLs05u No.36231 Ignore Report Quick Reply
1475741909273.jpg -(780831B / 762.53KB, 1024x768) Thumbnail displayed, click image for full size.
About 16 hours remaining.
No rush and no pressure though.
Good luck & have fun.
Barnaby Hummerfick - Thu, 06 Oct 2016 07:11:00 EST ID:hemOjN9f No.36232 Ignore Report Quick Reply
1475752260394.png -(618980B / 604.47KB, 757x833) Thumbnail displayed, click image for full size.
Barnaby Hummerfick - Thu, 06 Oct 2016 07:11:49 EST ID:hemOjN9f No.36233 Ignore Report Quick Reply
1475752309394.png -(705579B / 689.04KB, 805x898) Thumbnail displayed, click image for full size.
Sidney Worthingbanks - Fri, 07 Oct 2016 11:15:56 EST ID:LQVV02XK No.36234 Ignore Report Quick Reply
Level height and width
A vector for the pellet
The lenght of the snake
An array of vectors for the snake

Read user input
Check if snake eating pellet
If eaten spawn new pellet and increase size of snake
Move the snake forward
Check if collision with itself or borders to end game

Draw snake, pellets and borders
GOTO Read user input

Looking to learn more. by Doris Femmlewidge - Sat, 03 Sep 2016 14:28:27 EST ID:iP/biX2m No.36100 Ignore Report Reply Quick Reply
File: 1472927307091.jpg -(100601B / 98.24KB, 763x427) Thumbnail displayed, click image for full size. 100601
I am a beginner when it comes to programming. I am familiar with python and some front end but I wanted to learn something I considered obscure. I wanted to Learn LISP. I come here to ask for any suggestions on where or what I should start learning next?

Pic related.
13 posts and 3 images omitted. Click Reply to view.
Samuel Girringket - Fri, 23 Sep 2016 16:52:48 EST ID:mqog9WTN No.36195 Ignore Report Quick Reply
With a language like Haxe, I would think the typical use case for multiple main functions would be for having separate code for different compilation targets.
Hannah Lightham - Sat, 24 Sep 2016 20:25:29 EST ID:RufML0b0 No.36198 Ignore Report Quick Reply
1474763129546.png -(467733B / 456.77KB, 871x687) Thumbnail displayed, click image for full size.
That is what I mean by multiple programs. Often I'll have a client on JS and a server on C++ or Java. Both share models, but only JS needs graphics code.

It is pretty great that I don't need to implement client and server logic twice. And without resorting to a shitty NodeJS stack.
John Givinghall - Sat, 24 Sep 2016 21:02:14 EST ID:9QSfnS0r No.36199 Ignore Report Quick Reply
Yeah that's cool and all, but as I see there is really only documentation for how to use javascript native libraries. Documentation on other targets seems lacking or even missing ( in case of java ).
I guess if you are doing pretty basic stuff in the backend so you can only use haxe libraries and your own code is fine.
But then I can't imagine the community for haxe is large enough to provide that.

All in all I don't see a benefit to the traditional workflow where you write the frontend and backend code yourself besides not requiring any premium ide package.
Hannah Lightham - Sun, 25 Sep 2016 15:28:44 EST ID:RufML0b0 No.36200 Ignore Report Quick Reply
>Documentation on other targets seems lacking or even missing
Anyone can write a backend for Haxe, so some aren't as well documented. I've never found the documentation or support to be lacking thou, and I just crawl through source code if something isn't documented.

>I guess if you are doing pretty basic stuff in the backend so you can only use haxe libraries and your own code is fine
Not sure why you would assume that. I don't know how many libraries you normally use in a project, but I generally write most of my server code. The built in Java libraries are generally all I need.

>I don't see a benefit to the traditional workflow
Faster development? Macros? Pattern matching? Dynamic types and high order functions? Haxe has many improvements on its targets.

>besides not requiring any premium ide package
I'd avoid any language that needs an IDE. I rolled my own Emacs mode for haxe.
Jarvis Debberridge - Sun, 25 Sep 2016 20:27:27 EST ID:9QSfnS0r No.36201 Ignore Report Quick Reply
I try to avoid any software development library that doesn't provide a complete official documentation.
That said I see there is a MVC web framework for haxe which I would look into if it had documentation beyond the autogenerated API docs. http://ufront.net/

If you think software development is anything but 80% reading documentation and 20% writing code you are delusional imho.

GCC diagnostics are great, but they are not enough by Overflow - Thu, 01 Sep 2016 08:05:00 EST ID:1Cry0o0J No.36092 Ignore Report Reply Quick Reply
File: 1472731500014.png -(224154B / 218.90KB, 604x540) Thumbnail displayed, click image for full size. 224154
Bugs found in GCC with the help of PVS-Studio: http://www.viva64.com/en/b/0425/
Martin Clayhood - Thu, 01 Sep 2016 17:13:05 EST ID:aJAX07lc No.36095 Ignore Report Quick Reply
smells like spam.
Lydia Buzzridge - Sat, 03 Sep 2016 15:15:02 EST ID:F+scHBch No.36101 Ignore Report Quick Reply
Well how bad are the bugs?
Clang is probably better anyway, but never tried to switch.
Isabella Dundlebot - Tue, 20 Sep 2016 18:57:40 EST ID:CUeO0MBJ No.36185 Ignore Report Quick Reply
  1. This post is advertisement.
  2. -Wall isn't enough anyway. I recently found out about -Wconversion, which is not covered by -Wall. Go read: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
  3. PVS-Studio costs money (it even has licensing plans, yo!), GCC doesn't, and I'm only a hobbyist, probably like most posters here.
Isabella Dundlebot - Tue, 20 Sep 2016 19:02:18 EST ID:CUeO0MBJ No.36186 Ignore Report Quick Reply
Maybe pitting GCC vs PVS-Studio would be a good idea, anyway:
Let GCC try to find issues in PVS-Studio; then let PVS-Studio try to find issues in GCC.
Charles Pocklock - Tue, 20 Sep 2016 19:08:06 EST ID:4Qqv0Ibg No.36187 Ignore Report Quick Reply
You just bumped an ad to point out that it's an ad. Great job. nb

Advice by Hannah Clottingbury - Sat, 23 Jul 2016 08:05:47 EST ID:rK/rO6pk No.35894 Ignore Report Reply Quick Reply
File: 1469275547373.jpg -(106208B / 103.72KB, 1200x1628) Thumbnail displayed, click image for full size. 106208
I'm getting a small review done off my site (not very big or successful). It's made of angularJS, C# Web API and MS SQL Server (not very trendy). I'm being asked what the stack is.

Is it:

A: Bad for security reasons to tell them this.
B: Bad rep to admit it (since the cool kids don't use microsoft)

Thanks for any advice, really struggling with this one.
4 posts omitted. Click Reply to view.
Henry Feblingtadge - Sun, 24 Jul 2016 19:44:57 EST ID:Q1Kx57v7 No.35911 Ignore Report Quick Reply
Just say you are on an angular + MS stack.
David Gashson - Tue, 09 Aug 2016 03:20:43 EST ID:NKdom05x No.35981 Ignore Report Quick Reply

>security concern (don't want to increase chance of database hacking)

If your database is somehow vulnerable, it won't make a difference whether or not an attacker knows what database you are running. The kind of hacker that is a threat for your small website that -- no offense, the same applies to myself and my website -- nobody really cares about is the kind of hacker that is not doing manual work but just running scripts which try every kind of attack it knows about for every kind of database and other kind of applications. So due to this, if your database is vulnerable, they will find that vulnerability.
Charles Sanningbanks - Wed, 31 Aug 2016 14:22:59 EST ID:mX05OzHB No.36088 Ignore Report Quick Reply
Man I dont know.
Augustus Hennerfield - Wed, 14 Sep 2016 14:35:16 EST ID:pJbbrFEH No.36150 Ignore Report Quick Reply
1473878116090.jpg -(14563B / 14.22KB, 304x425) Thumbnail displayed, click image for full size.
Reported this stupid fucking idiot for shitting up OPs thread and no actions from staff.
I'm beginning to think bru is a troll mod.
pic related, it's bru / justin
Cedric Mushwudge - Thu, 15 Sep 2016 17:41:28 EST ID:h666BHp6 No.36156 Ignore Report Quick Reply
Don't hold out on us Bru are you going to get training with that lovely lady?

government computer programs by Priscilla Ceblingman - Thu, 25 Aug 2016 13:38:53 EST ID:xTilwW1W No.36059 Ignore Report Reply Quick Reply
File: 1472146733963.jpg -(410120B / 400.51KB, 1422x800) Thumbnail displayed, click image for full size. 410120
do you think computer programs could be created to run certain areas of the government?
1 posts omitted. Click Reply to view.
William Fuckinghood - Fri, 26 Aug 2016 17:14:05 EST ID:VAZu238H No.36065 Ignore Report Quick Reply
Imagine if you had to dig to catch something in pokemon go.
You could create an ant like species of human hiveminds.
Graham Hendleway - Fri, 26 Aug 2016 22:53:21 EST ID:W/zS63TD No.36066 Ignore Report Quick Reply
A program in deadlock could simulate Congress.
Albert Hebblestet - Sat, 27 Aug 2016 14:28:42 EST ID:e7bTcYy7 No.36072 Ignore Report Quick Reply
Absolutely. The tax code is clearly the biggest one begging to be turned into simple code. But a lot of middle man administration can replaced with code with no problem.
I'm hoping for a day when instead of voting on laws we vote on pull requests.
Ernest Pillybetch - Sat, 03 Sep 2016 15:49:28 EST ID:jqcg4eTQ No.36104 Ignore Report Quick Reply
Isn't there a movie coming out where these faggy 18 yo seniors get a mobile game that has them do life threatening shit for points?
Simon Gonkinworth - Sun, 11 Sep 2016 22:31:14 EST ID:RcamD32+ No.36134 Ignore Report Quick Reply
1473647474160.jpg -(45029B / 43.97KB, 274x406) Thumbnail displayed, click image for full size.
this might interest you

I'm bored. Should I learn SQL? by Albert Crappershaw - Sat, 13 Aug 2016 14:28:00 EST ID:Z4pGy3+m No.35991 Ignore Report Reply Quick Reply
File: 1471112880939.jpg -(50114B / 48.94KB, 348x541) Thumbnail displayed, click image for full size. 50114
Hey guys,

I've never looked much into SQL, probably because I always heard it's easy which made me think it would bore me pretty quickly.

Yet it appears to be a must-known language so now might be the time for me to finally dwell into it.

Should I go for it, should I use MySQL? If not, what would you recommend?

I'm pretty clueless about that, even after a few Google searches.

21 posts and 1 images omitted. Click Reply to view.
Ernest Dobbershaw - Mon, 22 Aug 2016 16:14:03 EST ID:wXwDJrio No.36044 Ignore Report Quick Reply
json-ld just looks like another network data model to me, I really don't see anything new in it.

It sounds like you want everything related to an employee to be marked as such. For that, I'd like to see support for domains and roles, separately, where we only have column names now. So all the employee_id columns can be unified under a single employee domain. FK constraints are mostly used for this now, but FK constraints are physical level integrity features, referring to specific columns and not logical domains, so a chain of constraints may be required to resolve whether two columns currently refer to the same domain, and in some cases no FK constraint is required. We really need a separate concept.
Martha Claddlekore - Wed, 24 Aug 2016 17:53:47 EST ID:9QSfnS0r No.36057 Ignore Report Quick Reply
Yeah the schema here can be done better, if every order has one employee it wouldn't make sense for many different employees to get bonuses from one order, but nevertheless that's what this is.
The point was more to show how you need one to one, one to many and many to many relationships and modelling them by sql feels somewhat like C pointer arithmetic.
Nell Guttinglirk - Thu, 25 Aug 2016 16:24:44 EST ID:LO1w4lnU No.36060 Ignore Report Quick Reply
What about higher order relationships like many-to-many-to-one?
Oliver Hippergold - Sat, 27 Aug 2016 20:22:51 EST ID:9QSfnS0r No.36075 Ignore Report Quick Reply
They can be expressed with a many to many and a one to many I guess.
Are you actively trying to make my brain hurt?

Anyway is there such a thing like an ominous high level database language? Like LDAP but fast? hmm...
Jenny Smalllock - Sun, 28 Aug 2016 15:16:13 EST ID:LO1w4lnU No.36080 Ignore Report Quick Reply
Decomposing an n-ary relationship into binary relationships require us to introduce n-1 surrogate keys and 2n-2 foreign key constraints. That's just nuts, why would you want to do that?

I'm just checking if you get the relational model. In the RM, relationships map to columns in tables, so an n-ary relationship is represented by a table with n components.

I have no idea how LDAP works, but check out Andl for a recently developed database language.

Java Sucks by Nicholas Drorringspear - Sun, 10 Apr 2016 20:14:48 EST ID:W/zS63TD No.35461 Ignore Report Reply Quick Reply
File: 1460333688209.jpg -(23367B / 22.82KB, 320x299) Thumbnail displayed, click image for full size. 23367
Hey, so why would you have an Interface that has an Abstract class as a subclass which then has a normal Class as a subclass of that?
The arrows look like:
Interface <-- Abstract <-- Class

Like, what exactly would the program be gaining by making it so hard to understand like this?
29 posts and 4 images omitted. Click Reply to view.
Doris Puggleford - Thu, 04 Aug 2016 16:17:01 EST ID:m6bw8rZX No.35953 Ignore Report Quick Reply
1470341821194.jpg -(91237B / 89.10KB, 500x661) Thumbnail displayed, click image for full size.
Nope, Eric Evans is the worst thing that happened to software development since goto.
Thomas Fezzlepedging - Fri, 05 Aug 2016 13:00:02 EST ID:9QSfnS0r No.35960 Ignore Report Quick Reply
Point taken.
James Snodbanks - Mon, 08 Aug 2016 10:18:11 EST ID:vIbiteGg No.35975 Ignore Report Quick Reply
I tend to use Go's embeds in other languages. Compose an instance of the derived class and inherit from it then just forward the necessary methods from the composed class. Feels more like actual building blocks than complicated type trees.
Hannah Senningdidge - Mon, 22 Aug 2016 20:51:31 EST ID:e7bTcYy7 No.36048 Ignore Report Quick Reply
At that point you just declare a bunch of type aliases for relevant functions instead of instead of classes.
type FoodUnpacker = FoodBox => FoodIngredients
type FoodCooker = FoodIngredients => CookedFood

Or in java
class FoodUnpacker extends Function<FoodBox, FoodIngredients> {}
class FoodCooker extends Function<FoodIngredients, CookedFood> {}

Fairly legible and nimble there IMO.
Hannah Senningdidge - Mon, 22 Aug 2016 23:05:46 EST ID:e7bTcYy7 No.36052 Ignore Report Quick Reply
sorry, those java classes should be interfaces and may need to forward some members or whatever.

Software Design by Lydia Seblingwell - Fri, 15 Jul 2016 21:14:09 EST ID:F+scHBch No.35856 Ignore Report Reply Quick Reply
File: 1468631649935.jpg -(63471B / 61.98KB, 883x273) Thumbnail displayed, click image for full size. 63471
You know how you download some source, and you have all these directories and header files and class files and this overwhelming complex system of files?

Well my school has taught me how to write short programs that consist of one file, but I want to start building a program and the problem is that I don't know where to begin as far as the design and architecture.

I have a vague idea of design patterns and general OO concepts, but I just don't know where to put what to start out. Is it possible that I could write out a whole function, only to have to re-write it when because I had to changed some other part of the overall design, you know?

So what do you guys recommend? How do you go about designing software?
It's a small CLI program, take inputs, work with files, do operations, print results, etc.
13 posts omitted. Click Reply to view.
James Snodbanks - Mon, 08 Aug 2016 12:28:14 EST ID:vIbiteGg No.35976 Ignore Report Quick Reply
> Imagine you have all these functions, each with unique parameters that can be customized
Standardize those functions to the same signature if they are will all be called from the same menu. You can make them void => void and have them refer to a global variable of the current settings/config but the best would be to pass them the configs as an interface and have them return some result state

trait Config {???}
type Result = Try[???]
type MenuAction = Config => Result
type MenuItem = JButton
type Menu = Map[MenuItem, MenuAction]
var result: Result = myMenu("run")(myConfig)
William Geffingfoot - Mon, 08 Aug 2016 15:39:29 EST ID:34i2KQQ+ No.35977 Ignore Report Quick Reply
The tag is (pre). Alright, so maybe something like this, once I learn how to use function pointers (but if theres a better way, do tell)
map<string, function> options_map; 
if(user_input == options_map.getElement) // lol idk
call that associated function

Which is what you had I think. Don't know what exactly "=>" means though.
Betsy Summlemidge - Fri, 12 Aug 2016 03:14:16 EST ID:Iq5puP1g No.35983 Ignore Report Quick Reply

Let's consider a car as an analogy. A car is a quite complex machine that relies on many different components working in harmony together to function. If any one of the critical components of a car, say the breaks, or the transmission, or the differential, does out the whole car doesn't work. Each one of these components is quite complex on it's own, and probably consists of sever complex sub components. Each component is going to have it's own puzzles and quirks to figure out. You need to be able to focus on a component in isolation or else it will be nearly impossible to tell what's going wrong when you test the whole program. You need to be able to test and revise a given part of your machine/program to the point that you can more or less rely on it. Then you can fit it into the bigger machine and only consider how it fits in, not whether it's acting strangely. Now, of course, probably no code is absolutely perfect, and some of the more frustrating parts of programming is when something you assume is rock solid is fucking up in some non-obvious way, like a library you're depending on. But by unit testing we make coding manageable. Also, you're going to be working in groups. By unit testing you can present something to the wider team they feel confident they can use. Otherwise it's highly likely you'll be wasting people's time with you buggy code.
Eliza Drupperstut - Fri, 12 Aug 2016 16:07:14 EST ID:VAZu238H No.35987 Ignore Report Quick Reply
>the hard coded menu is getting big and hard to maintain
So populate it dynamically.
However, it sounds like something is fucked with you design. Why is there is big ass menu?

The trendy fucks here will tell you it's wrong, but have your commands/menu items inherit from a base class that registers itself with a list that gets build at runtime. Or have a command factory.
James Turveyman - Tue, 16 Aug 2016 10:08:05 EST ID:vIbiteGg No.36010 Ignore Report Quick Reply
I was using scala code. T => R is a function that takes an argument of type T and returns type R. In Java 8 there is the java.util.function package and in that the equivalent classes would be Function<T, R>. There are many classes but they are all specific cases of Function<T, R> or Function<T1, T2, R>.

So in Java it would look something like this
Map<String, Function<Config, Result>> option_map =  new Map<String, Function<Config, Result>>;
option_map.put("Run", (Config c) -> someObject.run(c));
// add more options

then in your main function you could have something like:
Config config  =  //current state;
while (!config.doQuit) {
String user_input = //get user input
Comment too long. Click here to view the full text.

<<Last Pages Next>>
0 1 2 3 4 5 6 7 8 9 10 11
Report Post
Please be descriptive with report notes,
this helps staff resolve issues quicker.