« first day (741 days earlier)      last day (4212 days later) » 

10:00 AM
@MartinJames do not confuse 'ready to use' with 'has no need for further information to be thrown at it'
for instance, you might start a webserver object, and then tell it 'load configuration'
 
user142019
Removing init calls won’t slow your browser, it can only speed it up.
 
user142019
And make development speed up because your code is more maintainable.
 
It's Friday, that poses a problem. I want the weekend to be here already.
 
@R.MartinhoFernandes Yup. And that is why I'm in favor of absolute rules. Deciding when to ignore them should be left up to the programmer. A rule like "goto is evil" is simple and to the point and nearly always points you towards doing the right thing. And a competent programmer will know when to disregard the rule anyway, so the rule doesn't need to cover any exceptions that might be applicable
 
user142019
@TonyTheLion Ik heb vakantie. :D
 
10:01 AM
@WTP'-- Are you all talking out of your arse now?
 
@WTP'-- You lucky son of a bitch :)
 
user142019
@R.MartinhoFernandes can, not will.
 
Same with "use constructors and get rid if init functions". It's just the right advice to give. And if a programmer finds himself in a situation where it's best to ignore the rule then he can ignore that rule
 
@WTP'-- OK, suppose the class is a subsystem - includes a displayed web page fetched from a server. It takes 10 seconds for the network connection to be set up and another ten to fetch/render the page. Now construct 20 of these classes, serially.
 
No rule can possibly cover every exception anyway
 
10:02 AM
@MartinJames No one said anything about the constructor doing page fetch and render....
 
I have no idea what you guys are talking about. I'm also not going to read the transcript.
Also, rules, meh
 
user142019
@MartinJames why would the ctor do everything?
 
So your argument is "because it is possible to design a completely broken class, we should use init functions"
Best kind of logic
 
@jalf Yeah, me too.
 
@TonyTheLion Oh the bullshit
 
10:02 AM
It's Friday, Your argument is Invalid!
 
@WTP'-- ..because otherwise it would need a Init function?
 
user142019
@MartinJames no?
 
user142019
Why does the page need to be rendered immediately?
 
@jalf ever, ever, ever, ever.....
 
@MartinJames so you're saying the init function should take 20 seconds and do page fetch and render?
 
10:03 AM
@kbok Well some of the stuff makes a point, but then some of it is not so helpful
 
That is equally horrible and broken
 
@jalf No.
 
user142019
Something like class Page { DocumentObjectModel dom; public: Page(std::string const& url) { /* stuff */ } void render() {} }; would make much more sense.
 
That said, a private 'init' function can be helpful for making code readable, though I would probably not have a single 'init' function. Something like 'initXdisplay' followed by 'initOGLContext' comes to mind
 
Wait, why isn't there a page::fetch() and/or a page::render()
WTF does init() do.
 
10:04 AM
@MartinJames yes. YOu are proposing moving logic from the constructor to the init function. And you implied that the constructor would normally be doing all this, and that this work took 20 seconds. So your fix of putting it into an init function simply means that the init function will now take 20 seconds (or perhaps that the constructor takes 5 seconds and init takes 15, or however you want to split the workload. It's still broken and stupud)
 
The ctor of such a subsystem should take an 'OnInitialised' callback parameter.
 
user142019
@MartinJames uhm.
 
no
 
@MartinJames No, "initialization" should simply be decoupled from "fetched data from the internet and performed rendering"
 
just learn2concurrency
 
10:05 AM
they have nothing to do with each others
 
user142019
Why not just create the object on a separate thread then?
 
and SRP
 
@jalf No - I did not suggest that an Init functino was a good solution.
 
Then WTF are you complaining about.
 
@MartinJames you said you had a problem with rules specifying that init functions should be avoided
 
10:06 AM
8 mins ago, by Martin James
@WTP'-- 'Init methods should never, ever, ever, ever, ever, ever, ever, ever be used' and 'a class should be good to go for all it's functions as soon as the constructor is done ' - I have some little problem with these absolutes.
 
So now you're basically saying that rules against init functions are bad because while an init function won't in any way improve matters, writing a badly designed class with a badly designed constructor will result in an unusable application.
 
user142019
And your class shouldn’t be a god class. It shouldn’t do a page fetch and parsing and rendering. In fact, DocumentObjectModel class/struct and then a std::string fetch(std::string const& url); and DocumentObjectModel parse(std::string const& html); and void render(DocumentObjectModel const&) is much, much better. Those are all free functions.
 
IF you have a subsystem for rendering webpages, then it is initialized once it has been constructed, once it is ready to do its thing (once it is ready to render). It is not initialized when it has finished rendering a page
 
@jalf I had a problem with 'a class should be good to go for all it's functions as soon as the constructor is done ' - not always possible. Init functions - not so much, though it seems a bit wasteful to call a ctor that, at the time it is called, can only do half a job because other subsystems that it required to become useable are not yet ready.
 
user142019
I suggest you take a look at WebKit’s codebase.
 
10:09 AM
@MartinJames be more specific then. What is it you want "initialization" to cover, which is not possible to do in the constructor?
 
user142019
Or Gecko’s, for that matter.
 
Which required subsystems are not usable yet?
In a sane world, you would only call a constructor when you are ready to construct an object. That is, when the things it depend on are available
 
If you need a two-phase initialization, then you need two objects period
 
user142019
WebView view; // completely initialized
mainWindow.addSubView(view);
std::thread([&view] {
    auto html = fetch(url);
    view.dom = parse(html);
    view.render();
});
// Roughly.
 
@kbok I would like all the tabs etc. of the GUI to be set up 'immediately', before the network setup, (that is proceeding in parallel), is complete.
 
10:13 AM
@WTP'-- Meh, blocking network.
@MartinJames I don't see the problem.
Create all the tabs of the GUI.
 
@MartinJames and why would that not be possible i you use constructors the way they're intended?
 
user142019
@R.MartinhoFernandes roughly, just to give an idea of how you could do it. Just a simple example.
 
I see no reason to need the network to initialize a tab.
 
@MartinJames So ? This has nothing to do with class initialization.
 
user142019
Setting up the GUI and opening the window shouldn’t take more than 100 ms.
 
10:14 AM
Seriously, if your GUI tabs need the network to initialize, you're doing it wrong. I see no other way of putting it.
 
user142019
And if it does, your GUI library is terrible or you are terrible. Usually the latter.
 
if you have to call an init function in order to be able to use an object, that work should be done as part of the constructor. AFAIK there are no situations where an object will need to be passed some data that cannot be passed into the constructor
 
@WTP'-- the former is usually also trivially true though
 
@thecoshman Constructors are in most respects like normal functions. They can be passed anything a normal function can be passed.
 
@thecoshman By ditching exceptions, people need to use init methods to have feedback on possible failure. That's why google says you should.
 
user142019
10:15 AM
@jalf the latter even more often. :)
 
@R.MartinhoFernandes That's my point. The tabs can be set up on the GUI before the network init is complete. Why wait?
 
@R.MartinhoFernandes further to my point
 
anybody knows small C compiler other that Turbo
 
@MartinJames We're not saying they should wait. We're saying they can be constructed at any time
 
user142019
@DextOr clang
 
10:16 AM
 
user142019
And if you don’t like it, define “small”.
 
Once again, it seems you're arguing that when you have terribly bad design... Something.
 
you seem to want them to have some dependency on a network connection, and on fetching an rendering a page that takes 10 seconds to fetch
 
@kbok I downloaded tcc but unable to run it :/
 
@thecoshman ...hmm.. not 100% convinced. 99%.
 
10:17 AM
@MartinJames There's a great difference between initializing your application or subsystem and initializing your class instances
 
@kbok I know that, but 'init' functions are a solution to a problem (not throwing exceptions) that you would not want to have. If you for some reason cannot have ctors throwing, then init functions are, sadly, the way to go
@MartinJames like stated, the only reason to use init functions is fear of exceptions
 
@DextOr so did you get your program working?
 
@thecoshman Agreed. I did not make the rules about exceptions :)
 
user142019
@DextOr why do you need a small compiler?
 
@kbok The whole app is made up of class instances. It's an OO app!
 
10:18 AM
@thecoshman init functions are also a solution to the lack of "virtual constructors". I find that is rarely needed though.
 
user142019
Running it on an embedded system?
 
@DextOr You are looking for IDE I guess. Codeblocks is good.
 
@melak47 I think it will def work now
 
user142019
@MartinJames ah, so it’s terrible anyway.
 
@MartinJames instances, plural. In other words, hopefully you can initialize one instance without waiting for every other instance
I still don't understand how any of this is relevant to your preferred solution
 
10:19 AM
@WTP'-- fed up of that Big Blue screen :P
 
user142019
@R.MartinhoFernandes I needed it once for that reason. But my designs are always terrible.
 
user142019
@DextOr what. Do you have only 10MB RAM or something?
 
You seem to want a design where all objects are constructed at the beginning of the main function, and internally, they go into a waiting state, waiting for all their dependencies to become available, and once those become available, they finish initializing, and invoke a callback, allowing the next object(s) to wake up and do their initialization?
 
@VinayakGarg I want to run .c file and create exe out of it
 
Still, whilst their are some valid reasons for init functions (not allowed to make use of exceptions, but need to run code the might fail and as the robot says cheaty virtual ctors), you should be writing ctors such that once they return the class is ready to use.
 
10:20 AM
@DextOr Codeblocks can do it.
 
@DextOr Just get visual studio
 
user142019
@VinayakGarg No, Code::Blocks is terrible.
 
user142019
On Windows, use Visual Studio.
 
Code::Blocks sucks
 
@jalf sounds like a terrible solution
 
10:20 AM
@VinayakGarg going to try it thx
 
Seriously, learning to program in C is hard enough, don't run around telling newbs to use terrible IDEs and toolchains
 
@thecoshman agreed
 
@DextOr The other guys here don't seem to like it, so you may want to try Visual Studio Express instead.
 
user142019
Does Visual Studio even compile C?
 
@jalf That would be OK.
 
10:21 AM
@WTP'-- Yes.
 
user142019
I thought it only had a C++ compiler, not a C compiler.
 
user142019
How conforming is it?
 
@MartinJames Yeah, seems like we have found the point of disagreement.
@WTP'-- C89 plus the C99 stuff that is in C++.
 
@WTP'-- depends on how you define C. It doesn't compile C99, but it's fairly good at C89
 
user142019
I see.
 
10:22 AM
@VinayakGarg only if its size less than 5MB :P
 
@R.MartinhoFernandes partial C99 preprocessor, too, right? :p
 
@MartinJames ... okay. I rest my case then. I just don't know how to answer that
 
1 min ago, by thecoshman
@jalf sounds like a terrible solution
 
user142019
C89 xD
 
@melak47 Yeah, there's some C99 in it: whatever they have for free from C++.
 
10:22 AM
@DextOr What?? None of them are any close to 5MB
 
user142019
Microsoft y u no update compilers regularly.
 
CodeBlock 74 MB O.o
 
user142019
I mean, not even C11, come on.
 
user142019
@DextOr Code::Blocks sucks anyway.
 
hahah @WTP'--
 
user142019
10:23 AM
Don’t use it, especially not when a you’re a beginner.
 
@WTP'-- C11 came out a year ago.
 
user142019
@R.MartinhoFernandes A YEAR
 
@WTP'-- The thing is, they don't care about C.
 
@WTP'-- that's a different issue. They've just decided not to prioritize C. Has nothing to do with their update cycle (which has a lot of problems in itself)
 
user142019
That’s 365 days to improve your compiler!
 
10:24 AM
ok so final decision is Turbo C
+_+
 
No one cares about C except some caveman bearded linux people
 
user142019
Use Visual Studio in Windows.
 
but no matter how fast they delivered updates, it wouldn't change their level of C support, because they just don't intend to implement a C99 (or later) compiler
 
@WTP'-- He wants it under 5MB
 
user142019
Or MinGW or maybe even clang if you’re into self-punishment.
 
10:24 AM
how to run TCC
?
 
user142019
@VinayakGarg Oh yeah, of course.
 
@VinayakGarg Download a Visual Studio download bootstraper!
 
The "C++ is a terrible language and all C++ programmers are complete morons and should die" kind of people
 
meh 'IDEs'
yet to find one with a decent editor
 
@thecoshman Stick VisVim or ViEmu on Visual Studio. Done.
 
user142019
10:25 AM
@thecoshman define “decent”.
 
@thecoshman tried to get sublime text working with clang for auto complete, but it doesn't like boost :p guess no auto complete for kyrostat :(
 
@DextOr Why the hell do you need a "small" compiler ? Do you have a dialup connection or what ?
 
user142019
Visual Studio has a terribly awesome editor (at least for C#).
 
@DextOr Seriously, get yourself a decent compiler, IDE and debugger and save you hours of suffering
 
user142019
Never used it for C or C++, though.
 
10:26 AM
@WTP'-- No, it doesn't.
 
@WTP'-- You mean auto completion?
 
user142019
I like Xcode’s editor very much for C++.
 
@WTP'-- This is someone that used C# from 2003 through 2011.
 
user142019
@VinayakGarg yeah.
 
Guies CALM down I have Installed TURBO
:P
 
user142019
10:27 AM
@R.MartinhoFernandes about yesterday.
 
@WTP'-- "decent: acceptable to ones taste. Note, this is a highly subject term, what might be considered 'decent' for one person may not for another. Usage 'Sublime Text is a decent editor', or it's negation 'Visual is not a decent editor'"
happy?
 
user142019
Visual Studio 2012 RC on Windows 7.
 
@DextOr Uninstall it
 
user142019
@thecoshman I just wanted to know what you thought was decent.
 
O_=
 
user142019
10:28 AM
So maybe I could make a suggestion.
 
@WTP'-- why RC? RtM is out
 
user142019
ALSO WAHT IS WITH ALL THE FLAGS WHAT MORONS FLAG EVERYTHING
 
@WTP'-- Why the RC? I thought it was out already.
 
@R.MartinhoFernandes It was beta.
 
user142019
@melak47 I know, but I had the RC already installed. /cc @R.MartinhoFernandes
 
10:29 AM
? who is flagging what?
 
user142019
I might install the new version today.
 
@DextOr Don't ask for advice if you just want to install the shittiest compiler in the end.
 
@MartinJames Dunno. The flags are gone already. Which means they were really stupid.
 
@kbok lol
 
@WTP'-- oh right :P well, it's hard to say. I just find the sublime is very nice to work with, and very fast. Has a nice feature where it can 'open' files so that you can see what is in them, but not slap a tab at the top, very nice when you are trying to find the right file you are on.
 
user142019
10:30 AM
@thecoshman I agree.
 
I do need to see about getting a console plugin for it though
@WTP'-- ofc
 
The Awkward moment when Advices turns into World wars :P
 
user142019
Did you buy it or do you just use the trial?
 
@thecoshman yeah that's nice. VS does this too
 
@thecoshman But, a decent editor would never give you the wrong file!
 
10:31 AM
@WTP'-- it's free - jut a nag screen every n saves
 
user142019
Visual Studio is confusing. Some files open with the tab on the right-hand side.
 
user142019
Don’t know how to disable it since the preferences window is also a mess.
 
@thecoshman How do you do that ?
 
user142019
@melak47 I know.
 
user142019
Just like WinRAR.
 
10:32 AM
@WTP'-- if you got there through "go to definition/declaration", or through debugging
 
user142019
Except less often.
 
@WTP'-- The "navigation"-opened files go on the right, you can promote them if you want. Right-pinned files get cleared every so often
 
@WTP'-- in 2012? I think that's to do with how you open it. The idea is that if you open a file "normally", it stays open in its own tab. If you navigated there through debugging or the like, then you likely opened it "temporarily", so it goes in that special group and gets closed again on certain conditions
 
user142019
Ah I see.
 
I haven't used vs2012 enough to say how well it works, but it's a long overdue attempt at solving what's always been a major problem IMO
 
10:33 AM
A very nice feature indeed.
 
you end up with 40 tabs open because during a debug session you run through so many files that you just don't care about
 
@jalf which problem?
 
but you have to go through them, so now they're open and clutter up your tabs
 
user142019
Can I build C# apps from the command line?
 
^that problem :)
 
user142019
10:33 AM
I want to use Sublime Text 2. :P
 
yes
Hipster.
 
user142019
Is it something like
 
user142019
@melak47 I have used it at my job. :P
 
10:34 AM
@R.MartinhoFernandes ... except when I don't know for sure what file I want to open
 
user142019
Can I also add files to the solution from the command-line?
 
user142019
Or do I need VS for that?
 
Or write you makefiles and just call the compiler yourself.
 
user142019
@kbok Of course. :)
 
@kbok you can enable a side panel that shows a directory tree, if you just single click on files in that, it will open a preview of the file
 
user142019
10:35 AM
Ah yeah msbuild.
 
how to disable the full screen size of that shitty TURBO C
 
@DextOr ...your compiler is full screen?
 
user142019
LOL full-screen compiler.
 
Hehe - looks like msbuild driven by XML files :(( Have fun with that.
 
@thecoshman The mouse?!
 
10:36 AM
yes @melak47
how to gett small screen :/
 
@DextOr wat
 
@R.MartinhoFernandes oh get over it
 
in turbo c
 
user142019
@thecoshman s/get/hover/
 
@DextOr screenshot please
 
10:37 AM
+_+
 
user142019
I love Sublime’s command window.
 
@WTP'-- wait... you where just saying you wanted to use it?
 
Why doesn't it always open files quickly?
"were" :(
 
I'm failing to be interested in what I do.
 
@R.MartinhoFernandes tee hee hee
 
10:38 AM
I blame Friday
 
user142019
@thecoshman huh? I don’t understand what you mean.
 
@TonyTheLion That's not good, is it?
 
@R.MartinhoFernandes No. It's not.
I'm just not sure what it is that is causing it.
 
well, what are you doing
 
@WTP'-- sounded to me like you don't already use it
 
10:39 AM
Writing C++ code that creates SQL statements
 
DONE ......
 
it's not the most exciting thing to do
 
phew
 
user142019
@thecoshman I’ve used it at work.
 
user142019
When I still had a job.
 
10:39 AM
@WTP'-- you don't have one anymore?
 
@DextOr I want to see your fullscreen compiler :(
 
user142019
@TonyTheLion No, I’m in college. :(
 
ah right
 
@WTP'-- ah
 
user142019
Hogeschool Rotterdam is terrible.
 
10:40 AM
@TonyTheLion Oh gawd! You building SQL commands from strings? Yech!
 
@MartinJames basically.
 
user142019
@TonyTheLion I hope not to inject values?
 
user142019
Use prepared statements and bindings for that.
 
@MartinJames it's the most tedious job I've done in a while
 
@melak47 search "turbo c" on google images :P
 
10:41 AM
@TonyTheLion are you writing a clever thing that can generate SQL strings, or just embedding SQL strings into the C++ code base?
 
user142019
std::string sql = "SELECT * FROM Users WHERE id=" + id; // All you deserve is your database getting pwnt by Russian hackers.
 
@thecoshman I'm not writing anything remotely clever. I'm writing SQL statements as std::wstring in a C++ codebase.
 
@WTP'-- <shudder>
 
Ell
@MartinJames I'm going to be doing that soon too :3 because I cba to set up ruby -> sql, so I'll just get it to generate a huge INSERT INTO statement
 
@WTP'-- that's exactly what I'm doing
 
user142019
10:42 AM
@TonyTheLion use prepared statements.
 
@WTP'-- Looks like Tony is already in hell or, at least purgatory.
 
@WTP'-- except you can still validate 'id', to prevent inject attacks
 
user142019
@thecoshman yeah, but you can easily forget.
 
@WTP'-- what are those?
 
@WTP'-- oh for sure
 
10:43 AM
@DextOr Eek! Can you run it in a VM?
 
@MartinJames I've gone beyond Hell. I don't even have a name for that place...
 
user142019
sqlite3_stmt* stmt;
sqlite3_prepare(db, &stmt, "SELECT * FROM Users WHERE id=?");
sqlite3_bind_int(stmt, /* 1-based :< */ 1, boost::lexical_cast<int>(id));
 
user142019
@TonyTheLion ^ something like that.
 
@TonyTheLion Java-vil
 
user142019
You compile the SQL and afterwards insert the values.
 
user142019
10:44 AM
That way there is a chance of 0% that you have SQL injection attacks.
 
user142019
And it’s much faster than string concatenation in most cases.
 
@thecoshman yes
 
user142019
And you can reuse the prepared statement, so you don’t have to parse and compile the SQL every time.
 
user142019
So it’s usually faster.
 
@TonyTheLion welcome, population, you and me
 
10:45 AM
@thecoshman shoot me
 
user142019
In database management systems, a prepared statement or parameterized statement is a feature used to execute the same or similar database statements repeatedly with high efficiency. Typically used with SQL statements such as queries or updates, the prepared statement takes the form of a template into which certain constant values are substituted during each execution. The typical workflow of using a prepared statement is as follows: # Prepare: The statement template is created by the application and sent to the database management system (DBMS). Certain values are left unspecified, called...
 
I think that's the only legitimate thing I can ask for, is for someone to relieve me of this sub optimal position by using brute force. :P
 
user142019
Why does Wikipedia give code examples in PHP?
 
user142019
PHP is Perl’s retarded cousin, Perl is Ruby’s retarded cousin and Ruby is Python’s retarded cousin.
 
@TonyTheLion you shoot me first!
 
Ell
10:47 AM
ruby is pretty chill imho
 
user142019
Only Ruby on Rails is chill since it does everything for me.
 
user142019
But I prefer CherryPy because it’s Python and not Ruby.
 
user142019
@TonyTheLion which DBMS are you using?
 
@thecoshman Simple solution to the shooting paradox - use another method. Both get into the same car and one drives it into a tree at speed. Use a hire-car, get plenty insurance and make a will.
 
@MartinJames but how do we get shot?
 
10:50 AM
easy - move to the US
 
@sehe LOL, get a free star:)
 
user142019
Why would anyone want to pay for a star?
 
@WTP'-- MSSQL Server
 
so... finally finished reading through cat's rant against Google's style guide. Apart from the their "our code base is shit so we can't use exceptions" which obviously only applies to their case, for the most part, he agrees with what they say. Conclusion, cat actually likes Google's style guide, but is too hung up on one or two points of contention
 
which rant?
 
10:53 AM
@WTP'-- Posters pay bounties sometimes. Maybe the starboard should charge for its services.
 
@KillianDS look at the star board
 
user142019
@TonyTheLion MSSQL supports prepared statements.
 
user142019
Honestly, they make your code better (unless you don’t care, of course).
 
user142019
At least you won’t have to do string concatenation and escaping anymore. :P
 
YEAH my code is running :O
Oppa Gangnam Style :P
 
10:56 AM
congrats
now ditch C :p
 
thx :D
 
@melak47 You could move to C++ Builder. It's slightly less cretaceous and doesn't need full-screen:)
 
@MartinJames me?
 
user142019
Or buy a computer from after the 80’s and use clang.
 
@melak47 Not you, no, sorry - screen scrolled.
 
10:59 AM
@WTP'-- I've come to a point where I really couldn't give a fuck about this.
 

« first day (741 days earlier)      last day (4212 days later) »