I thought i would subscribe back as the thread was getting interesting by Niya is provocation for VB6 was (if answered) will keep me away.
Printable View
I thought i would subscribe back as the thread was getting interesting by Niya is provocation for VB6 was (if answered) will keep me away.
Just remember. There are lines and they apply to everyone.
Ye, i mean we were talking bout job opportunities and JS and hating MVC and you had to go back and remember what this thread was about. :p Just like a little sapator apprentice.
You actually like JavaScript ? I find its dynamic type system an incredible pain to work with. You just have to be so careful with it. Really slows my flow. I love its other capabilities though like higher order/first class functions and such. With the right libraries, it can be quite a powerful and expressive language. This dynamic type nonsense really kills it though. Really stupid decision by its inventor not to make it statically typed.
Oh yes, another thing I have mixed feelings about in JavaScript is its duck typing. On one hand it can really make for some elegant solutions and on the other hand you can really shoot yourself in the foot if you start getting too complicated with it. I think they should have offered the ability to create statically typed classes as well.
You know its funny, there are some people that actually like dynamic typing. Don't think I could ever learn to appreciate that. Now type inference, that makes far more sense and serves the same purpose as far as developer productivity which I assume is the idea of dynamic typing(someone correct me if I'm wrong).
I personally hate it when I have to start working in javascript but I think that's because a) I'm not familiar with it and b) I miss an ide that'll tell me where the inevitable syntax error I just introduced actually is. I haven't had to use it much so I generally jusy bumble along but it does seem to be creeping more and more into my world so it's probably getting to be time when I invested some time in learning and finding some good tools.
I don't like dynamic typing but i can live with that. That's not why(everyone here i think) like JS.
Anyhow i don't think the original JS was meant to go this far and be so useful and that is a good thing because they made it sort of "rebel" language. Also if MS bought JS then you would have to create a 100k code to declare a JS class. :P
There is also something helpful you can use in JS. Debugger(only works on IE :cry: ).
So if you go like this and write the worst syntax ever created by a human:
You can debug and you also can go and do stuff on the immediate window.Code:<script type="text/javascript">
function gob() {
debugger;
var x;
x = 2;
if (x > 2) { y = 1; } else { g = 3; };
}
</script>
P.S. Do you like my code? :thumb:
I code nearly 100% of my time in JS - I'm not coming back to it occasionally. My web app is 10,500 lines of JS right now.
The flexibility in the development in JS of it is just perfect as long as you are a careful coder. I spend a lot of time in FireBug checking code by stepping through it. That's a habit from 30 years of coding - dozens of languages - and with JS it really helps. Write a new function - run the app - set a break point - see if I nailed it.
But regardless, my job as a programmer has always been really simple and consistent. I grab data - place it on a visual display - allow user to alter said data - and then I accept changes back to the database.
A major part of this is the CRUD - CREATE, READ, UPDATE and DELETE code - and it's the same in all languages. Some derivation of SQL and SPROCS or whatever you use.
The VISUAL DISPLAY part is where your options come in. JS is designed to managed the DOM of HTML. HTML, imo - is hands down the best way to talk to a visual display. It's got all the features you need for a fluid UI.
XAML is second, IMO - in this regard.
I feel that VB6 and VB/C#.Net only do clunky UI's - not very fluid at all.
Have a read here - it's good info on typing in JS
http://blog.jeremymartin.name/2008/0...typing-in.html
This I agree with. I love how flexible JavaScript is with HTML's DOM. You can do all kinds of amazing stuff with it.
I've felt this way since I first touched HTML. Its not the language's fault. UI's are just far more elegant to create using a declarative language like HTML than an imperative one like VB.
The last program I did in VB.Net pushed the limits of the UI capability. First - most of the form must be created at design time. If you have a complex form you are familiar with the DOCUMENT OUTLINE window (if you have never had a need to use this window you are probably making very simple UI's). VB6 allowed you to see this same info in the physical .FRM file (open in NOTEPAD).
I digress - back to my last big VB.Net app. I created lots of the UI during runtime by taking existing UI objects and moving them around and hiding them and showing them. You run into all kinds of road blocks - like you can't have that many items in a FlowLayoutPanel because it lags. I walked away from that experience feeling the bloat of those tools.
HTML is so hands down the polar opposite of this.
And once you have a library like jQuery - and you start hanging data onto the DOM - wow - what power. DATA is any OBJECT - you can hang a FUNCTION onto the DOM.
I see that as a marriage of the UI and the DATA in such an acrobatic way - so cool!
I wouldn't say I like WPF - just forced to use it for a prototype on a project I'm working on. We needed more and better control over UI.
I've got two other partners on that project - they are looking for venture capital funding right now.
When funding happens we will be considering how to re-create all this for production use with as little reliance on the .Net libraries as possible.
I don't think JavaScript is going to be as avoidable as in the past, at least for a while.
It has simply been making too many inroads into realms that used to be dominated by compiled languages, Java, or .Net and that era may be largely over.
If something else comes along and gets wide adoption that may change but I don't see a contender yet. Google's Dart was close but never saw wide adoption and JS processors (you can't say interpreters anymore, so many either JIT or AOT compile now and have improved GC) are outstripping it in performance.
They run in IIS - so basically it is an ASP.Net project
Look like this
Called like this from JS in my caseCode:Option Strict On
Option Explicit On
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports System.Web.Script.Serialization
Imports System.Data
.
.
.
Imports DocumentFormat.OpenXml
Imports DocumentFormat.OpenXml.Packaging
Imports DocumentFormat.OpenXml.Spreadsheet
<WebService(Namespace:="AWCService")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _
Public Class WebService
Inherits System.Web.Services.WebService
Dim g_prmSP As New Dictionary(Of String, SqlParameter())
Dim fileWrtr As System.IO.StreamWriter
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)> _
Public Function AddService(ByVal toddtype As String, ByVal fromddtype As String, ByVal fromwho As String _
, ByVal choice As Integer _
, ByVal objReturn As Dictionary(Of String, String) _
, ByVal addkey As String _
, ByVal username As String) As String
'Return "<b>This is the content of resource <tt>someResource</tt></b>"
Dim credDB As String = ""
If username.Contains(":") Then
credDB = username.Split(":"c)(0)
username = username.Split(":"c)(1)
End If
Code:$.ajax({
type: "POST",
url: "WebService.asmx/" + strService,
dataType: "json",
data: strWebParam,
contentType: "application/json; charset=utf-8",
success: function(msg) {
fncFinished(msg, sender, objWebParam);
},
failure: function(msg) {
fncFinished(msg, "failure", objWebParam);
},
error: function(msg) {
fncFinished(msg, "error", objWebParam);
}
});
ah ok, so you are using ASP.NET, to perform services, just not used for the web-page piece (or so it looks like) I was a little confused there. What tool would you build your page in to host the JS functions? The only thing I have seen is the basic web-forms project in VS2010. I am guessing your response is going to say "any tool that can consume the web service can be used". This seems a bit much, I would think that browser is the best bet to target a wide array of devices. When we talk about .NET becoming deprecated, unless I am misunderstanding, why are we saying that ASP.NET is losing relevance if the services are being built on it? Or do we mean the web-pages as a method of consuming the service? If ASP.NET has no more relevance, then what are we building the sites with?
Or you can do the server side in Node.js or something just as well.
Does that mean, your into UI/web development right now? But you haven't stepped away from exploring recent versions SQL Server are you? :)Quote:
I code nearly 100% of my time in JS - I'm not coming back to it occasionally. My web app is 10,500 lines of JS right now.
The flexibility in the development in JS of it is just perfect as long as you are a careful coder. I spend a lot of time in FireBug checking code by stepping through it. That's a habit from 30 years of coding - dozens of languages - and with JS it really helps. Write a new function - run the app - set a break point - see if I nailed it.
But regardless, my job as a programmer has always been really simple and consistent. I grab data - place it on a visual display - allow user to alter said data - and then I accept changes back to the database.
A major part of this is the CRUD - CREATE, READ, UPDATE and DELETE code - and it's the same in all languages. Some derivation of SQL and SPROCS or whatever you use.
The VISUAL DISPLAY part is where your options come in. JS is designed to managed the DOM of HTML. HTML, imo - is hands down the best way to talk to a visual display. It's got all the features you need for a fluid UI.
XAML is second, IMO - in this regard.
I feel that VB6 and VB/C#.Net only do clunky UI's - not very fluid at all.
I launch a small HTML page - which pretty much loads the scripts and then starts performing AJAX calls to login and pull down more HTML or other JSON strings that help build the HTML further.
You never leave the page - the page continues to make AJAX calls and build up further and further.
I should also point out that once I started working with Android devices they simply call these same web methods from the Java code of an Android app.
But in reality the server side can be switched out easily - it's just a layer that passes DATA back and forth from stored procedures. Although I see .Net being relevant as a web service layer between WEB and SQL
We currently use VS2013... but this dates back to VS2008.
Yup... pretty much. It's some pretty cool stuff. Even cooler is that because of our platform, I rarely have to get into the HTML or JS.
Correct, we're just using the web-service part of it... not for the pages. the pages are build dynamically by the services, then a JS controller takes the emitted HTML and stuffs it back into the page.
In our case, we do have different pages, but each one is designed for a specific use, like Dashboards, Navigational Areas, detail pages, list pages, process... etc.
-----
The platform is the webservice portion of it... for those basic blocks, there are aspx pages... so we are talking about maybe a couple dozen. then with that platform in hand, and the accompanying SDK, we're able to build some pretty complex forms. Best part is we do it all through SQL, XML, and VB (or C# if we're feeling a bit feisty). So what we end up with is a few dozen webservices, and a couple hundred DLLs and a nice collection of HTML and JS files.
We use the XML files to define what should be on the page, what's editable, etc. we can then let the platform render it by default. Or, we can then attach an HTML file to it to fine tune the layout, such as displaying in columns or tabs, or a different order of the fields. If we need even more functionality, depending on what it is, we tinker with the VB code... or we add a js file and tinker with it on the client side. So far I haven't run into much wehre I've needed to do that.
-tg
Basically you re-wrote ASP.Net to work the way you want - as I did myself (I am a small ISV)
I'd post some links to what we do, but I never know if I'm inside the network or not... but if anyone wants to check it out: http://www.blackbaud.com ... we have several products, the one that uses the framework I was talking about is our CRM solution.
Debugging can be a pain sometimes though. Especially when the problem is buried deep in the platform code.
-tg
So when the page is being built by the service is that automatically done for you or do you have to create some sort of template to fill the data? My example (probably terrible, remember I am barely a web-guy, I do a lot of winforms) would be lets say you have to query for data, and you want to return an html table filled with the queried data. You send a command to the web service, which runs a stored procedure and returns back this generated html table filled with the data. Was this html pre-determined by you or is there some existing framework (for example) that would just generate the table based on the parameters given? Also, how do you tie this into VB? How do you render the html? With a web browser control?
Sorry to harp, I have become fascinated. I would love to dive into this, the issue is that my job prefers desktop development instead of using servers because they have limited mainframes that do select jobs already, but to extend those mainframes costs money and in the business of maintaining accounts rather than driving new accounts, no ROI means no funding. This means I don't get to play much (yet) with anything involving servers.
The data is returned from the WEB METHOD in JSON or XML format. I prefer JSON - it's easily worked with in JavaScript. The HTML is built from the JSON (which is pure data from the SPROC call) and "injected" into the DOM. The jQuery library allows me to effortlessly create new HTML and put it wherever it want it to show up.
Here's a screen shot - those ACCORDIONS down the left side and those BUTTONS up top all get built from JSON returned from the DB (after my LOGIN method lets them get through).
Here is the SPROC data that determines all that - called once when the page load - you will see some JSON in the SQL columns - that's needed by the jQuery library to determine icons for buttons and such.
And this is some JS code using the jQuery library to build the buttons (this snippet does that).
It CLONES blank buttons from a hidden part of the initial HTML page and INSERT's or PREPEND's them (based on first button or subsequent button). With jQuery you add "classes" (styles) to HTML elements so you can find them and work them later - very much like you might with .TAG property of controls.Code:case "acs-operator":
switch (value[0]) {
case "button": /* 1:id, 2:options, 3:ddtype, 4:tooltip */
var options = value[2]; /*$.parseJSON(value[2].replace(/~/g, '"'));*/
var droppableoptions = {};
droppableoptions.drop = dropOn;
if (!$("#acs-operator").children().hasClass("acs-operator-button")) {
$("#acs-button").clone().prependTo("#acs-operator").removeAttr("id").attr("id", value[1])
.button(options).attr("title", value[4] || "")
.data("ddtype", value[3]).addClass("acs-operator-button").addClass("acs-operator-button-event")
.droppable(droppableoptions);
} else {
$("#acs-button").clone().insertAfter("#acs-operator .acs-operator-button:last").removeAttr("id").attr("id", value[1])
.button(options).attr("title", value[4] || "")
.data("ddtype", value[3]).addClass("acs-operator-button").addClass("acs-operator-button-event")
.droppable(droppableoptions);
}
$("#" + value[1]).clone().appendTo("#acs-button-list").removeAttr("id").attr("id", "acs-button-list-" + value[1])
.data("ddtype", value[3]).removeClass("acs-operator-button")
.removeClass("ui-button-text-icon-primary").addClass("ui-button-icon-primary")
.children(":last").remove();
break;
}
break;
W/o getting into IP or propriety stuff... it works like this:
For a query, we have two options... a DataList or a QueryView... They're very similar but have some differenciating functionality. So using the SDK template, I build a specification file:
xml Code:
<DataList Name="Some Name" ID = "some guid value" Description="a description"> <SQLProcedure> <![CDATA[ And here I'd put a Create Procedure sproc that selects and returns the data I need ]]> <Fields> <Field ID="Name of field from sproc" Caption="The header" DataType="the SQL Datatype for the field" Hidden="I can hide fields if I need to" /> ... </Fields> </DataList>
when that is rendered, it is rendered through the the datalist webservice... how it renders is then up to the webservice. there are some fine tuning issues I can control through the metadata in the XML, such as pagination, or export options.
Once I have that Lego block built, I can then use it in other specification files by including the list's ID and the appropriate tag.
For forms, such as data entry, it's a little more complicated, but similar process. With that, we can define an optional pre-load method, to get some initial data from the database, then define the save routine... then list out the files... then optionally define an HTML file and a handler DLL which handles events raised by elements on the form (buttons, changing of fields, etc).
That all said, the platform part, it largely a black box to me. I just know how it works based off of what I feed it. Nice thing about it being largely XML-based & SQL-based... if I need to add a field to an existing out of the box form... I just write an extension... it's almost like inheriting the form.
-tg
All I can say is there is big scary world outside my winforms :eek:
Is the IDE intellisense for JS as good as VB.NET?
It's not "that good" if you mean all the gadgets but Firebug is doing a decent job and the intelli on JS is build to support a stateless model,so i don't think you can really compare. And anyhow you get to see that cool data transfer requests live, something that i don't think you can do(?) in the VB.NET intelli :)
How do you manage this ? Do you just have a bunch of .js files with a tonne of methods or do you have some system or tool to neatly organize in a hierarchical manner ? My brief adventure into JavaScript left me with a tonne of code with no particular organization. With limited intellisense support and no classes or namespaces it was a major pain trying to find where I did what. Reminded me of BASICA where a whole program would be one long piece of text like an essay. I couldn't imagine having to maintain 10K lines of JavaScript this way.
I actually have it as a TEXT SCRIPT in the initial page to FORCE a new load every time the person logs in.
Internally I have a lot of classes that manage operations. So things are easy to find because I follow good OOP techniques.
Plus I do thorough debugging in FB so I follow code when it runs...